blob: eabe7bcbe176184442a6fece271aa28ad114664e [file] [log] [blame]
Andrew Geisslerc926e172021-05-07 16:11:35 -05001From 57d2965e979f886e03eecd7e351bf01812053971 Mon Sep 17 00:00:00 2001
2From: Jose Quaresma <quaresma.jose@gmail.com>
3Date: Sun, 2 May 2021 01:58:01 +0100
4Subject: [PATCH 4/4] tests: install the environment for installed_tests
5
6- adapt the test environment for installed_tests
7- install the test environment for installed_tests
8- run the tests using the installed environment
9
10Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/789]
11
12Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
13---
14 template.test.in | 2 +-
15 tests/check/meson.build | 18 ++++++++++++++++++
16 2 files changed, 19 insertions(+), 1 deletion(-)
17
18diff --git a/template.test.in b/template.test.in
19index f701627f8..9a3fbdd09 100644
20--- a/template.test.in
21+++ b/template.test.in
22@@ -1,3 +1,3 @@
23 [Test]
24 Type=session
25-Exec=@installed_tests_dir@/@program@
26+Exec=sh -c 'set -aex && source @installed_tests_dir@/@program@.env && exec @installed_tests_dir@/@program@'
27diff --git a/tests/check/meson.build b/tests/check/meson.build
28index f64524904..a67e0f8dd 100644
29--- a/tests/check/meson.build
30+++ b/tests/check/meson.build
31@@ -183,6 +183,24 @@ foreach t : core_tests
32 install_dir: installed_tests_metadir,
33 configuration: test_conf
34 )
35+
36+ env += {'GST_REGISTRY': '~/.cache/gstreamer-1.0/@0@.registry'.format(test_name)}
37+ configure_file(
38+ output: test_name + '.env',
39+ install_dir: installed_tests_execdir,
40+ configuration : env,
41+ )
42+ # helper to convert a meson environment dictionay object exported with configure_file
43+ # this also remove not needed variables for the installed tests
44+ meson.add_postconf_script('sed', '-i',
45+ '-e', '/^#define/!d',
46+ '-e', 's/^#define //g',
47+ '-e', '/^GST_PLUGIN_PATH_1_0/d',
48+ '-e', '/^GST_PLUGIN_SYSTEM_PATH_1_0/d',
49+ '-e', '/^GST_PLUGIN_SCANNER_1_0/d',
50+ '-e', 's/ /=/',
51+ join_paths(meson.current_build_dir(), test_name + '.env')
52+ )
53 endif
54
55 test(test_name, exe, env: env, timeout : 3 * 60)
56--
572.31.1
58