summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/gstreamer/gstreamer1.0/0004-tests-add-helper-script-to-run-the-installed_tests.patch
blob: 5689dc9fbbc733b60c921d449c2672a6b436e81d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 1b1d1ce4227b6bea7c7def5dac4a663486e070c2 Mon Sep 17 00:00:00 2001
From: Jose Quaresma <quaresma.jose@gmail.com>
Date: Sun, 2 May 2021 01:58:01 +0100
Subject: [PATCH] tests: add helper script to run the installed_tests

- this is a bash script that will run the installed_tests
with some of the environment variables used in the meson
testing framework.

Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/789]

Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>

---
 tests/check/meson.build      | 17 +++++++++++++++++
 tests/check/template.sh.in   |  9 +++++++++
 tests/check/template.test.in |  2 +-
 3 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100755 tests/check/template.sh.in

diff --git a/tests/check/meson.build b/tests/check/meson.build
index 50dff7f..2b9e979 100644
--- a/tests/check/meson.build
+++ b/tests/check/meson.build
@@ -184,6 +184,23 @@ foreach t : core_tests
         install_dir: installed_tests_metadir,
         configuration: test_conf
       )
+
+      # All the tests will be deployed on the target machine and
+      # we use the home folder ~ for the registry which will then expand at runtime.
+      # Using the /tmp/gstreamer-1.0/@0@.registry can be problematic as it mostly
+      # is mounted using tmpfs and if the machine crash from some reason we can lost the registry
+      # that is useful for debug propose of the tests itself.
+      env += {'GST_REGISTRY': '~/.cache/gstreamer-1.0/@0@.registry'.format(test_name)}
+
+      # Set the full path for the test it self.
+      env += {'TEST': '@0@/@1@'.format(join_paths(prefix, installed_tests_execdir), test_name)}
+
+      configure_file(
+        input : 'template.sh.in',
+        output: test_name + '.sh',
+        install_dir: installed_tests_execdir,
+        configuration : env,
+      )
     endif
 
     test(test_name, exe, env: env, timeout : 3 * 60)
diff --git a/tests/check/template.sh.in b/tests/check/template.sh.in
new file mode 100755
index 0000000..cf7d31b
--- /dev/null
+++ b/tests/check/template.sh.in
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -ax
+
+CK_DEFAULT_TIMEOUT="@CK_DEFAULT_TIMEOUT@"
+GST_PLUGIN_LOADING_WHITELIST="@GST_PLUGIN_LOADING_WHITELIST@"
+GST_REGISTRY=@GST_REGISTRY@
+GST_STATE_IGNORE_ELEMENTS="@GST_STATE_IGNORE_ELEMENTS@"
+exec @TEST@
diff --git a/tests/check/template.test.in b/tests/check/template.test.in
index f701627..b74ef6a 100644
--- a/tests/check/template.test.in
+++ b/tests/check/template.test.in
@@ -1,3 +1,3 @@
 [Test]
 Type=session
-Exec=@installed_tests_dir@/@program@
+Exec=@installed_tests_dir@/@program@.sh