blob: 5689dc9fbbc733b60c921d449c2672a6b436e81d [file] [log] [blame]
Patrick Williams73bd93f2024-02-20 08:07:48 -06001From 1b1d1ce4227b6bea7c7def5dac4a663486e070c2 Mon Sep 17 00:00:00 2001
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00002From: Jose Quaresma <quaresma.jose@gmail.com>
3Date: Sun, 2 May 2021 01:58:01 +0100
Patrick Williams73bd93f2024-02-20 08:07:48 -06004Subject: [PATCH] tests: add helper script to run the installed_tests
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00005
6- this is a bash script that will run the installed_tests
7with some of the environment variables used in the meson
8testing framework.
9
10Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/789]
11
12Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000013
Patrick Williams73bd93f2024-02-20 08:07:48 -060014---
15 tests/check/meson.build | 17 +++++++++++++++++
16 tests/check/template.sh.in | 9 +++++++++
17 tests/check/template.test.in | 2 +-
18 3 files changed, 27 insertions(+), 1 deletion(-)
19 create mode 100755 tests/check/template.sh.in
20
21diff --git a/tests/check/meson.build b/tests/check/meson.build
22index 50dff7f..2b9e979 100644
23--- a/tests/check/meson.build
24+++ b/tests/check/meson.build
25@@ -184,6 +184,23 @@ foreach t : core_tests
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000026 install_dir: installed_tests_metadir,
27 configuration: test_conf
28 )
29+
30+ # All the tests will be deployed on the target machine and
31+ # we use the home folder ~ for the registry which will then expand at runtime.
32+ # Using the /tmp/gstreamer-1.0/@0@.registry can be problematic as it mostly
33+ # is mounted using tmpfs and if the machine crash from some reason we can lost the registry
34+ # that is useful for debug propose of the tests itself.
35+ env += {'GST_REGISTRY': '~/.cache/gstreamer-1.0/@0@.registry'.format(test_name)}
36+
37+ # Set the full path for the test it self.
38+ env += {'TEST': '@0@/@1@'.format(join_paths(prefix, installed_tests_execdir), test_name)}
39+
40+ configure_file(
41+ input : 'template.sh.in',
42+ output: test_name + '.sh',
43+ install_dir: installed_tests_execdir,
44+ configuration : env,
45+ )
46 endif
47
48 test(test_name, exe, env: env, timeout : 3 * 60)
Patrick Williams73bd93f2024-02-20 08:07:48 -060049diff --git a/tests/check/template.sh.in b/tests/check/template.sh.in
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000050new file mode 100755
Patrick Williams73bd93f2024-02-20 08:07:48 -060051index 0000000..cf7d31b
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000052--- /dev/null
Patrick Williams73bd93f2024-02-20 08:07:48 -060053+++ b/tests/check/template.sh.in
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000054@@ -0,0 +1,9 @@
55+#!/bin/sh
56+
57+set -ax
58+
59+CK_DEFAULT_TIMEOUT="@CK_DEFAULT_TIMEOUT@"
60+GST_PLUGIN_LOADING_WHITELIST="@GST_PLUGIN_LOADING_WHITELIST@"
61+GST_REGISTRY=@GST_REGISTRY@
62+GST_STATE_IGNORE_ELEMENTS="@GST_STATE_IGNORE_ELEMENTS@"
63+exec @TEST@
Patrick Williams73bd93f2024-02-20 08:07:48 -060064diff --git a/tests/check/template.test.in b/tests/check/template.test.in
65index f701627..b74ef6a 100644
66--- a/tests/check/template.test.in
67+++ b/tests/check/template.test.in
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000068@@ -1,3 +1,3 @@
69 [Test]
70 Type=session
71-Exec=@installed_tests_dir@/@program@
72+Exec=@installed_tests_dir@/@program@.sh