1From 62f5bb7bfc2498219df7280e73480d8ed2378ce5 Mon Sep 17 00:00:00 2001 2From: Jose Quaresma <quaresma.jose@gmail.com> 3Date: Sun, 11 Apr 2021 19:48:13 +0100 4Subject: [PATCH 2/4] tests: add support for install the tests 5 6This will provide to run the tests using the gnome-desktop-testing [1] 7 8[1] https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests 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 subprojects/gstreamer/meson.build | 4 ++++ 15 subprojects/gstreamer/meson_options.txt | 1 + 16 subprojects/gstreamer/tests/check/meson.build | 22 ++++++++++++++++++- 17 .../gstreamer/tests/check/template.test.in | 3 +++ 18 4 files changed, 29 insertions(+), 1 deletion(-) 19 create mode 100644 subprojects/gstreamer/tests/check/template.test.in 20 21diff --git a/subprojects/gstreamer/meson.build b/subprojects/gstreamer/meson.build 22index d20fe0040f..b595d8f990 100644 23--- a/subprojects/gstreamer/meson.build 24+++ b/subprojects/gstreamer/meson.build 25@@ -562,6 +562,10 @@ if bashcomp_dep.found() 26 endif 27 endif 28 29+installed_tests_enabled = get_option('installed_tests') 30+installed_tests_metadir = join_paths(datadir, 'installed-tests', meson.project_name()) 31+installed_tests_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name()) 32+ 33 plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0') 34 35 pkgconfig = import('pkgconfig') 36diff --git a/subprojects/gstreamer/meson_options.txt b/subprojects/gstreamer/meson_options.txt 37index 7363bdb7a1..a34ba37dad 100644 38--- a/subprojects/gstreamer/meson_options.txt 39+++ b/subprojects/gstreamer/meson_options.txt 40@@ -15,6 +15,7 @@ option('poisoning', type : 'boolean', value : false, description : 'Enable poiso 41 option('memory-alignment', type: 'combo', 42 choices : ['1', '2', '4', '8', '16', '32', '64', '128', '256', '512', '1024', '2048', '4096', '8192', 'malloc', 'pagesize'], 43 value: 'malloc') 44+option('installed_tests', type : 'boolean', value : false, description : 'Enable installed tests') 45 46 # Feature options 47 option('check', type : 'feature', value : 'auto', description : 'Build unit test libraries') 48diff --git a/subprojects/gstreamer/tests/check/meson.build b/subprojects/gstreamer/tests/check/meson.build 49index 506606684d..00a138a568 100644 50--- a/subprojects/gstreamer/tests/check/meson.build 51+++ b/subprojects/gstreamer/tests/check/meson.build 52@@ -124,10 +124,16 @@ test_defines = [ 53 '-UG_DISABLE_ASSERT', 54 '-UG_DISABLE_CAST_CHECKS', 55 '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_STATE_IGNORE_ELEMENTS"', 56- '-DTESTFILE="' + meson.current_source_dir() + '/meson.build"', 57 '-DGST_DISABLE_DEPRECATED', 58 ] 59 60+testfile = meson.current_source_dir() + '/meson.build' 61+if installed_tests_enabled 62+ install_data(testfile, install_dir : installed_tests_metadir, rename : 'testfile') 63+ testfile = installed_tests_metadir + '/testfile' 64+endif 65+test_defines += '-DTESTFILE="@0@"'.format(testfile) 66+ 67 # sanity checking 68 if get_option('check').disabled() 69 if get_option('tests').enabled() 70@@ -151,6 +157,8 @@ foreach t : core_tests 71 include_directories : [configinc], 72 link_with : link_with_libs, 73 dependencies : test_deps + glib_deps + gst_deps, 74+ install_dir: installed_tests_execdir, 75+ install: installed_tests_enabled, 76 ) 77 78 env = environment() 79@@ -162,6 +170,18 @@ foreach t : core_tests 80 env.set('GST_PLUGIN_SCANNER_1_0', gst_scanner_dir + '/gst-plugin-scanner') 81 env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer') 82 83+ if installed_tests_enabled 84+ test_conf = configuration_data() 85+ test_conf.set('installed_tests_dir', join_paths(prefix, installed_tests_execdir)) 86+ test_conf.set('program', test_name) 87+ configure_file( 88+ input: 'template.test.in', 89+ output: test_name + '.test', 90+ install_dir: installed_tests_metadir, 91+ configuration: test_conf 92+ ) 93+ endif 94+ 95 test(test_name, exe, env: env, timeout : 3 * 60) 96 endif 97 endforeach 98diff --git a/subprojects/gstreamer/tests/check/template.test.in b/subprojects/gstreamer/tests/check/template.test.in 99new file mode 100644 100index 0000000000..f701627f87 101--- /dev/null 102+++ b/subprojects/gstreamer/tests/check/template.test.in 103@@ -0,0 +1,3 @@ 104+[Test] 105+Type=session 106+Exec=@installed_tests_dir@/@program@ 107-- 1082.33.1 109 110