diff options
8 files changed, 261 insertions, 283 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-ptest.inc b/meta/recipes-multimedia/gstreamer/gstreamer1.0-ptest.inc deleted file mode 100644 index b698067041..0000000000 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-ptest.inc +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | inherit ptest-gnome | ||
| 2 | |||
| 3 | TEST_FILES_PATH = "${datadir}/installed-tests/gstreamer-1.0/test-files" | ||
| 4 | RUN_PTEST_FILE = "${D}${PTEST_PATH}/run-ptest" | ||
| 5 | |||
| 6 | EXTRA_OEMESON += "-Dtest-files-path=${TEST_FILES_PATH}" | ||
| 7 | |||
| 8 | GST_TEST_SUITE_NAME ?= "gstreamer-1.0" | ||
| 9 | |||
| 10 | # Using do_install_ptest_base instead of do_install_ptest, since | ||
| 11 | # the default do_install_ptest_base is hardcoded to expect Makefiles. | ||
| 12 | do_install_ptest_base() { | ||
| 13 | # Generate run-ptest file | ||
| 14 | echo "#!/usr/bin/env sh" > "${RUN_PTEST_FILE}" | ||
| 15 | echo "gnome-desktop-testing-runner ${GST_TEST_SUITE_NAME}" >> "${RUN_PTEST_FILE}" | ||
| 16 | chmod 0755 "${RUN_PTEST_FILE}" | ||
| 17 | |||
| 18 | # Install additional files required by tests | ||
| 19 | if [ -d "${S}/tests/files" ] ; then | ||
| 20 | install -d "${D}/${TEST_FILES_PATH}" | ||
| 21 | install -m 0644 "${S}/tests/files"/* "${D}/${TEST_FILES_PATH}" | ||
| 22 | fi | ||
| 23 | } | ||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0004-meson-Add-option-for-installed-tests.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0004-meson-Add-option-for-installed-tests.patch deleted file mode 100644 index bf5e57249c..0000000000 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0004-meson-Add-option-for-installed-tests.patch +++ /dev/null | |||
| @@ -1,257 +0,0 @@ | |||
| 1 | From cf8077a7e3ab0ae236ebde79b7fc0b02eac658de Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Carlos Rafael Giani <crg7475@mailbox.org> | ||
| 3 | Date: Fri, 25 Oct 2019 00:06:26 +0200 | ||
| 4 | Subject: [PATCH 3/3] meson: Add option for installed tests | ||
| 5 | |||
| 6 | This adds an option for producing installed versions of the unit tests. | ||
| 7 | These versions don't need meson to run (only a small shell script). This | ||
| 8 | makes it easier to run cross compiled tests on a target machine. | ||
| 9 | |||
| 10 | Upstream-Status: Pending | ||
| 11 | |||
| 12 | Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org> | ||
| 13 | --- | ||
| 14 | build-aux/gen-installed-test-desc.py | 18 ++++++ | ||
| 15 | build-aux/gen-installed-test-shscript.py | 25 ++++++++ | ||
| 16 | meson_options.txt | 2 + | ||
| 17 | tests/check/meson.build | 46 +++++++++++++- | ||
| 18 | tests/files/testfile | 80 ++++++++++++++++++++++++ | ||
| 19 | 5 files changed, 170 insertions(+), 1 deletion(-) | ||
| 20 | create mode 100644 build-aux/gen-installed-test-desc.py | ||
| 21 | create mode 100644 build-aux/gen-installed-test-shscript.py | ||
| 22 | create mode 100644 tests/files/testfile | ||
| 23 | |||
| 24 | diff --git a/build-aux/gen-installed-test-desc.py b/build-aux/gen-installed-test-desc.py | ||
| 25 | new file mode 100644 | ||
| 26 | index 000000000..69e8a0faf | ||
| 27 | --- /dev/null | ||
| 28 | +++ b/build-aux/gen-installed-test-desc.py | ||
| 29 | @@ -0,0 +1,18 @@ | ||
| 30 | +import sys | ||
| 31 | +import os | ||
| 32 | +import argparse | ||
| 33 | + | ||
| 34 | +def write_template(filename, data): | ||
| 35 | + with open(filename, 'w') as f: | ||
| 36 | + f.write(data) | ||
| 37 | + | ||
| 38 | +def build_template(testdir, testname): | ||
| 39 | + return "[Test]\nType=session\nExec={}\n".format(os.path.join(testdir, testname)) | ||
| 40 | + | ||
| 41 | +argparser = argparse.ArgumentParser(description='Generate installed-test data.') | ||
| 42 | +argparser.add_argument('--test-execdir', metavar='dir', required=True, help='Installed test directory') | ||
| 43 | +argparser.add_argument('--testname', metavar='name', required=True, help='Installed test name') | ||
| 44 | +argparser.add_argument('--output', metavar='file', required=True, help='Output file') | ||
| 45 | +args = argparser.parse_args() | ||
| 46 | + | ||
| 47 | +write_template(args.output, build_template(args.test_execdir, args.testname)) | ||
| 48 | diff --git a/build-aux/gen-installed-test-shscript.py b/build-aux/gen-installed-test-shscript.py | ||
| 49 | new file mode 100644 | ||
| 50 | index 000000000..5da86fb37 | ||
| 51 | --- /dev/null | ||
| 52 | +++ b/build-aux/gen-installed-test-shscript.py | ||
| 53 | @@ -0,0 +1,25 @@ | ||
| 54 | +import sys | ||
| 55 | +import os | ||
| 56 | +import argparse | ||
| 57 | + | ||
| 58 | +def write_template(filename, data): | ||
| 59 | + with open(filename, 'w') as f: | ||
| 60 | + f.write(data) | ||
| 61 | + | ||
| 62 | +def build_template(testdir, testname): | ||
| 63 | + return ''.join([ | ||
| 64 | + "#!/usr/bin/env sh\n", | ||
| 65 | + "export GST_STATE_IGNORE_ELEMENTS=''\n", | ||
| 66 | + "export CK_DEFAULT_TIMEOUT=20\n", | ||
| 67 | + "export GST_PLUGIN_LOADING_WHITELIST='gstreamer'\n", | ||
| 68 | + "{}\n".format(os.path.join(testdir, testname)), | ||
| 69 | + ]) | ||
| 70 | + | ||
| 71 | +argparser = argparse.ArgumentParser(description='Generate installed-test data.') | ||
| 72 | +argparser.add_argument('--test-execdir', metavar='dir', required=True, help='Installed test directory') | ||
| 73 | +argparser.add_argument('--testname', metavar='name', required=True, help='Installed test name') | ||
| 74 | +argparser.add_argument('--output', metavar='file', required=True, help='Output file') | ||
| 75 | +args = argparser.parse_args() | ||
| 76 | + | ||
| 77 | +write_template(args.output, build_template(args.test_execdir, args.testname)) | ||
| 78 | +os.chmod(args.output, 0o755) | ||
| 79 | diff --git a/meson_options.txt b/meson_options.txt | ||
| 80 | index 72c3997e2..346c423d4 100644 | ||
| 81 | --- a/meson_options.txt | ||
| 82 | +++ b/meson_options.txt | ||
| 83 | @@ -15,6 +15,8 @@ option('poisoning', type : 'boolean', value : false, description : 'Enable poiso | ||
| 84 | option('memory-alignment', type: 'combo', | ||
| 85 | choices : ['1', '2', '4', '8', '16', '32', '64', '128', '256', '512', '1024', '2048', '4096', '8192', 'malloc', 'pagesize'], | ||
| 86 | value: 'malloc') | ||
| 87 | +option('installed-tests', type : 'boolean', value : false, description : 'enable installed tests') | ||
| 88 | +option('test-files-path', type : 'string', description : 'Path where to find test files') | ||
| 89 | |||
| 90 | # Feature options | ||
| 91 | option('check', type : 'feature', value : 'auto', description : 'Build unit test libraries') | ||
| 92 | diff --git a/tests/check/meson.build b/tests/check/meson.build | ||
| 93 | index a617cf159..e629131c5 100644 | ||
| 94 | --- a/tests/check/meson.build | ||
| 95 | +++ b/tests/check/meson.build | ||
| 96 | @@ -120,11 +120,17 @@ if add_languages('cpp', native: false, required: false) | ||
| 97 | ] | ||
| 98 | endif | ||
| 99 | |||
| 100 | +test_files_path = get_option('test-files-path') | ||
| 101 | +if test_files_path == '' | ||
| 102 | + test_files_path = meson.current_source_dir() + '/../files' | ||
| 103 | +endif | ||
| 104 | +message('Using path "@0@" as the path to read test files from'.format(test_files_path)) | ||
| 105 | + | ||
| 106 | test_defines = [ | ||
| 107 | '-UG_DISABLE_ASSERT', | ||
| 108 | '-UG_DISABLE_CAST_CHECKS', | ||
| 109 | '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_STATE_IGNORE_ELEMENTS"', | ||
| 110 | - '-DTESTFILE="' + meson.current_source_dir() + '/meson.build"', | ||
| 111 | + '-DTESTFILE="@0@"'.format(test_files_path + '/testfile'), | ||
| 112 | '-DGST_DISABLE_DEPRECATED', | ||
| 113 | ] | ||
| 114 | |||
| 115 | @@ -138,6 +144,14 @@ endif | ||
| 116 | glib_deps = [gio_dep, gobject_dep, gmodule_dep, glib_dep] | ||
| 117 | gst_deps = [gst_dep, gst_base_dep, gst_check_dep, gst_net_dep, gst_controller_dep] | ||
| 118 | |||
| 119 | +installed_tests_datadir = join_paths(prefix, get_option('datadir'), 'installed-tests', 'gstreamer-1.0') | ||
| 120 | +installed_tests_execdir = join_paths(prefix, libexecdir, 'installed-tests', 'gstreamer-1.0') | ||
| 121 | +installed_tests_enabled = get_option('installed-tests') | ||
| 122 | + | ||
| 123 | +python = import('python').find_installation() | ||
| 124 | +gen_installed_test_desc = files('../../build-aux/gen-installed-test-desc.py') | ||
| 125 | +gen_installed_test_shscript = files('../../build-aux/gen-installed-test-shscript.py') | ||
| 126 | + | ||
| 127 | foreach t : core_tests | ||
| 128 | fname = t[0] | ||
| 129 | test_name = fname.split('.')[0].underscorify() | ||
| 130 | @@ -151,8 +165,38 @@ foreach t : core_tests | ||
| 131 | include_directories : [configinc], | ||
| 132 | link_with : link_with_libs, | ||
| 133 | dependencies : test_deps + glib_deps + gst_deps, | ||
| 134 | + install_dir: installed_tests_execdir, | ||
| 135 | + install: installed_tests_enabled | ||
| 136 | ) | ||
| 137 | |||
| 138 | + if installed_tests_enabled | ||
| 139 | + installed_test_shscript = test_name + '.sh' | ||
| 140 | + shscript = custom_target (test_name + '_shscript', | ||
| 141 | + output: installed_test_shscript, | ||
| 142 | + command: [ | ||
| 143 | + python, | ||
| 144 | + gen_installed_test_shscript, | ||
| 145 | + '--test-execdir=@0@'.format(installed_tests_execdir), | ||
| 146 | + '--testname=@0@'.format(test_name), | ||
| 147 | + '--output=@0@'.format(join_paths('@OUTDIR@', installed_test_shscript)), | ||
| 148 | + ], | ||
| 149 | + install: true, | ||
| 150 | + install_dir: installed_tests_execdir) | ||
| 151 | + | ||
| 152 | + installed_test_desc = test_name + '.test' | ||
| 153 | + data = custom_target(test_name + '_desc', | ||
| 154 | + output: installed_test_desc, | ||
| 155 | + command: [ | ||
| 156 | + python, | ||
| 157 | + gen_installed_test_desc, | ||
| 158 | + '--test-execdir=@0@'.format(installed_tests_execdir), | ||
| 159 | + '--testname=@0@'.format(installed_test_shscript), | ||
| 160 | + '--output=@0@'.format(join_paths('@OUTDIR@', installed_test_desc)), | ||
| 161 | + ], | ||
| 162 | + install: true, | ||
| 163 | + install_dir: installed_tests_datadir) | ||
| 164 | + endif | ||
| 165 | + | ||
| 166 | env = environment() | ||
| 167 | env.set('GST_PLUGIN_PATH_1_0', meson.build_root()) | ||
| 168 | env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '') | ||
| 169 | diff --git a/tests/files/testfile b/tests/files/testfile | ||
| 170 | new file mode 100644 | ||
| 171 | index 000000000..89954e0e2 | ||
| 172 | --- /dev/null | ||
| 173 | +++ b/tests/files/testfile | ||
| 174 | @@ -0,0 +1,80 @@ | ||
| 175 | +................................................................................ | ||
| 176 | +................................................................................ | ||
| 177 | +................................................................................ | ||
| 178 | +................................................................................ | ||
| 179 | +................................................................................ | ||
| 180 | +................................................................................ | ||
| 181 | +................................................................................ | ||
| 182 | +................................................................................ | ||
| 183 | +................................................................................ | ||
| 184 | +................................................................................ | ||
| 185 | +................................................................................ | ||
| 186 | +................................................................................ | ||
| 187 | +................................................................................ | ||
| 188 | +................................................................................ | ||
| 189 | +................................................................................ | ||
| 190 | +................................................................................ | ||
| 191 | +................................................................................ | ||
| 192 | +................................................................................ | ||
| 193 | +................................................................................ | ||
| 194 | +................................................................................ | ||
| 195 | +................................................................................ | ||
| 196 | +................................................................................ | ||
| 197 | +................................................................................ | ||
| 198 | +................................................................................ | ||
| 199 | +................................................................................ | ||
| 200 | +................................................................................ | ||
| 201 | +................................................................................ | ||
| 202 | +................................................................................ | ||
| 203 | +................................................................................ | ||
| 204 | +................................................................................ | ||
| 205 | +................................................................................ | ||
| 206 | +................................................................................ | ||
| 207 | +................................................................................ | ||
| 208 | +................................................................................ | ||
| 209 | +................................................................................ | ||
| 210 | +................................................................................ | ||
| 211 | +................................................................................ | ||
| 212 | +................................................................................ | ||
| 213 | +................................................................................ | ||
| 214 | +................................................................................ | ||
| 215 | +................................................................................ | ||
| 216 | +................................................................................ | ||
| 217 | +................................................................................ | ||
| 218 | +................................................................................ | ||
| 219 | +................................................................................ | ||
| 220 | +................................................................................ | ||
| 221 | +................................................................................ | ||
| 222 | +................................................................................ | ||
| 223 | +................................................................................ | ||
| 224 | +................................................................................ | ||
| 225 | +................................................................................ | ||
| 226 | +................................................................................ | ||
| 227 | +................................................................................ | ||
| 228 | +................................................................................ | ||
| 229 | +................................................................................ | ||
| 230 | +................................................................................ | ||
| 231 | +................................................................................ | ||
| 232 | +................................................................................ | ||
| 233 | +................................................................................ | ||
| 234 | +................................................................................ | ||
| 235 | +................................................................................ | ||
| 236 | +................................................................................ | ||
| 237 | +................................................................................ | ||
| 238 | +................................................................................ | ||
| 239 | +................................................................................ | ||
| 240 | +................................................................................ | ||
| 241 | +................................................................................ | ||
| 242 | +................................................................................ | ||
| 243 | +................................................................................ | ||
| 244 | +................................................................................ | ||
| 245 | +................................................................................ | ||
| 246 | +................................................................................ | ||
| 247 | +................................................................................ | ||
| 248 | +................................................................................ | ||
| 249 | +................................................................................ | ||
| 250 | +................................................................................ | ||
| 251 | +................................................................................ | ||
| 252 | +................................................................................ | ||
| 253 | +................................................................................ | ||
| 254 | +................................................................................ | ||
| 255 | -- | ||
| 256 | 2.29.2 | ||
| 257 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0004-tests-respect-the-idententaion-used-in-meson.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0004-tests-respect-the-idententaion-used-in-meson.patch new file mode 100644 index 0000000000..6f571a12d8 --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0004-tests-respect-the-idententaion-used-in-meson.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | From 122e5ac3dd16a461b6ae595605490c8f5d1c3a9d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jose Quaresma <quaresma.jose@gmail.com> | ||
| 3 | Date: Sun, 11 Apr 2021 19:48:13 +0100 | ||
| 4 | Subject: [PATCH 1/4] tests: respect the idententaion used in meson | ||
| 5 | |||
| 6 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/789] | ||
| 7 | |||
| 8 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
| 9 | --- | ||
| 10 | tests/check/meson.build | 10 +++++----- | ||
| 11 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/tests/check/meson.build b/tests/check/meson.build | ||
| 14 | index a617cf159..b2636714b 100644 | ||
| 15 | --- a/tests/check/meson.build | ||
| 16 | +++ b/tests/check/meson.build | ||
| 17 | @@ -146,11 +146,11 @@ foreach t : core_tests | ||
| 18 | |||
| 19 | if not skip_test | ||
| 20 | exe = executable(test_name, fname, | ||
| 21 | - c_args : gst_c_args + test_defines, | ||
| 22 | - cpp_args : gst_c_args + test_defines, | ||
| 23 | - include_directories : [configinc], | ||
| 24 | - link_with : link_with_libs, | ||
| 25 | - dependencies : test_deps + glib_deps + gst_deps, | ||
| 26 | + c_args : gst_c_args + test_defines, | ||
| 27 | + cpp_args : gst_c_args + test_defines, | ||
| 28 | + include_directories : [configinc], | ||
| 29 | + link_with : link_with_libs, | ||
| 30 | + dependencies : test_deps + glib_deps + gst_deps, | ||
| 31 | ) | ||
| 32 | |||
| 33 | env = environment() | ||
| 34 | -- | ||
| 35 | 2.31.1 | ||
| 36 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-tests-add-support-for-install-the-tests.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-tests-add-support-for-install-the-tests.patch new file mode 100644 index 0000000000..b77fb5797f --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-tests-add-support-for-install-the-tests.patch | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | From c9e93c7a3e4d2773abef4f5e1464af24f36700b3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jose Quaresma <quaresma.jose@gmail.com> | ||
| 3 | Date: Sun, 11 Apr 2021 19:48:13 +0100 | ||
| 4 | Subject: [PATCH 2/4] tests: add support for install the tests | ||
| 5 | |||
| 6 | This will provide to run the tests using the gnome-desktop-testing [1] | ||
| 7 | |||
| 8 | [1] https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/789] | ||
| 11 | |||
| 12 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
| 13 | --- | ||
| 14 | meson.build | 5 +++++ | ||
| 15 | meson_options.txt | 1 + | ||
| 16 | template.test.in | 3 +++ | ||
| 17 | tests/check/meson.build | 22 +++++++++++++++++++++- | ||
| 18 | 4 files changed, 30 insertions(+), 1 deletion(-) | ||
| 19 | create mode 100644 template.test.in | ||
| 20 | |||
| 21 | diff --git a/meson.build b/meson.build | ||
| 22 | index c4e8774f5..1abf4eb26 100644 | ||
| 23 | --- a/meson.build | ||
| 24 | +++ b/meson.build | ||
| 25 | @@ -562,6 +562,11 @@ if bashcomp_dep.found() | ||
| 26 | endif | ||
| 27 | endif | ||
| 28 | |||
| 29 | +installed_tests_metadir = join_paths(datadir, 'installed-tests', meson.project_name()) | ||
| 30 | +installed_tests_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name()) | ||
| 31 | +installed_tests_enabled = get_option('installed-tests') | ||
| 32 | +installed_tests_template = files('template.test.in') | ||
| 33 | + | ||
| 34 | plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0') | ||
| 35 | |||
| 36 | pkgconfig = import('pkgconfig') | ||
| 37 | diff --git a/meson_options.txt b/meson_options.txt | ||
| 38 | index c8cee3762..b5da40eaa 100644 | ||
| 39 | --- a/meson_options.txt | ||
| 40 | +++ b/meson_options.txt | ||
| 41 | @@ -15,6 +15,7 @@ option('poisoning', type : 'boolean', value : false, description : 'Enable poiso | ||
| 42 | option('memory-alignment', type: 'combo', | ||
| 43 | choices : ['1', '2', '4', '8', '16', '32', '64', '128', '256', '512', '1024', '2048', '4096', '8192', 'malloc', 'pagesize'], | ||
| 44 | value: 'malloc') | ||
| 45 | +option('installed-tests', type : 'boolean', value : false, description : 'Enable installed tests') | ||
| 46 | |||
| 47 | # Feature options | ||
| 48 | option('check', type : 'feature', value : 'auto', description : 'Build unit test libraries') | ||
| 49 | diff --git a/template.test.in b/template.test.in | ||
| 50 | new file mode 100644 | ||
| 51 | index 000000000..f701627f8 | ||
| 52 | --- /dev/null | ||
| 53 | +++ b/template.test.in | ||
| 54 | @@ -0,0 +1,3 @@ | ||
| 55 | +[Test] | ||
| 56 | +Type=session | ||
| 57 | +Exec=@installed_tests_dir@/@program@ | ||
| 58 | diff --git a/tests/check/meson.build b/tests/check/meson.build | ||
| 59 | index b2636714b..a697a7b06 100644 | ||
| 60 | --- a/tests/check/meson.build | ||
| 61 | +++ b/tests/check/meson.build | ||
| 62 | @@ -124,10 +124,16 @@ test_defines = [ | ||
| 63 | '-UG_DISABLE_ASSERT', | ||
| 64 | '-UG_DISABLE_CAST_CHECKS', | ||
| 65 | '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_STATE_IGNORE_ELEMENTS"', | ||
| 66 | - '-DTESTFILE="' + meson.current_source_dir() + '/meson.build"', | ||
| 67 | '-DGST_DISABLE_DEPRECATED', | ||
| 68 | ] | ||
| 69 | |||
| 70 | +testfile = meson.current_source_dir() + '/meson.build' | ||
| 71 | +if installed_tests_enabled | ||
| 72 | + install_data(testfile, install_dir : installed_tests_metadir, rename : 'testfile') | ||
| 73 | + testfile = installed_tests_metadir + '/testfile' | ||
| 74 | +endif | ||
| 75 | +test_defines += '-DTESTFILE="@0@"'.format(testfile) | ||
| 76 | + | ||
| 77 | # sanity checking | ||
| 78 | if get_option('check').disabled() | ||
| 79 | if get_option('tests').enabled() | ||
| 80 | @@ -151,6 +157,8 @@ foreach t : core_tests | ||
| 81 | include_directories : [configinc], | ||
| 82 | link_with : link_with_libs, | ||
| 83 | dependencies : test_deps + glib_deps + gst_deps, | ||
| 84 | + install_dir: installed_tests_execdir, | ||
| 85 | + install: installed_tests_enabled, | ||
| 86 | ) | ||
| 87 | |||
| 88 | env = environment() | ||
| 89 | @@ -162,6 +170,18 @@ foreach t : core_tests | ||
| 90 | env.set('GST_PLUGIN_SCANNER_1_0', gst_scanner_dir + '/gst-plugin-scanner') | ||
| 91 | env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer') | ||
| 92 | |||
| 93 | + if installed_tests_enabled | ||
| 94 | + test_conf = configuration_data() | ||
| 95 | + test_conf.set('installed_tests_dir', join_paths(prefix, installed_tests_execdir)) | ||
| 96 | + test_conf.set('program', test_name) | ||
| 97 | + configure_file( | ||
| 98 | + input: installed_tests_template, | ||
| 99 | + output: test_name + '.test', | ||
| 100 | + install_dir: installed_tests_metadir, | ||
| 101 | + configuration: test_conf | ||
| 102 | + ) | ||
| 103 | + endif | ||
| 104 | + | ||
| 105 | test(test_name, exe, env: env, timeout : 3 * 60) | ||
| 106 | endif | ||
| 107 | endforeach | ||
| 108 | -- | ||
| 109 | 2.31.1 | ||
| 110 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0006-tests-use-a-dictionaries-for-environment.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0006-tests-use-a-dictionaries-for-environment.patch new file mode 100644 index 0000000000..46813cec3d --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0006-tests-use-a-dictionaries-for-environment.patch | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | From e82dedec1803922656e92285fc1bb75b2cdc0aad Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jose Quaresma <quaresma.jose@gmail.com> | ||
| 3 | Date: Sat, 24 Apr 2021 10:34:47 +0100 | ||
| 4 | Subject: [PATCH 3/4] tests: use a dictionaries for environment | ||
| 5 | |||
| 6 | meson environment() can't be passed to configure_file and it is needed for installed_tests, | ||
| 7 | use a dictionary as this is simplest solution to install the environment. | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/789] | ||
| 10 | |||
| 11 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
| 12 | --- | ||
| 13 | tests/check/meson.build | 19 +++++++++++-------- | ||
| 14 | 1 file changed, 11 insertions(+), 8 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/tests/check/meson.build b/tests/check/meson.build | ||
| 17 | index a697a7b06..f64524904 100644 | ||
| 18 | --- a/tests/check/meson.build | ||
| 19 | +++ b/tests/check/meson.build | ||
| 20 | @@ -161,14 +161,17 @@ foreach t : core_tests | ||
| 21 | install: installed_tests_enabled, | ||
| 22 | ) | ||
| 23 | |||
| 24 | - env = environment() | ||
| 25 | - env.set('GST_PLUGIN_PATH_1_0', meson.build_root()) | ||
| 26 | - env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '') | ||
| 27 | - env.set('GST_STATE_IGNORE_ELEMENTS', '') | ||
| 28 | - env.set('CK_DEFAULT_TIMEOUT', '20') | ||
| 29 | - env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name)) | ||
| 30 | - env.set('GST_PLUGIN_SCANNER_1_0', gst_scanner_dir + '/gst-plugin-scanner') | ||
| 31 | - env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer') | ||
| 32 | + # environment() can't be passed to configure_file and it is needed for installed_tests | ||
| 33 | + # use a dictionary as this is simplest solution to install the environment | ||
| 34 | + env = { | ||
| 35 | + 'GST_PLUGIN_PATH_1_0': meson.build_root(), | ||
| 36 | + 'GST_PLUGIN_SYSTEM_PATH_1_0': '', | ||
| 37 | + 'GST_STATE_IGNORE_ELEMENTS': '', | ||
| 38 | + 'CK_DEFAULT_TIMEOUT': '20', | ||
| 39 | + 'GST_REGISTRY': '@0@/@1@.registry'.format(meson.current_build_dir(), test_name), | ||
| 40 | + 'GST_PLUGIN_SCANNER_1_0': gst_scanner_dir + '/gst-plugin-scanner', | ||
| 41 | + 'GST_PLUGIN_LOADING_WHITELIST': 'gstreamer', | ||
| 42 | + } | ||
| 43 | |||
| 44 | if installed_tests_enabled | ||
| 45 | test_conf = configuration_data() | ||
| 46 | -- | ||
| 47 | 2.31.1 | ||
| 48 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0007-tests-install-the-environment-for-installed_tests.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0007-tests-install-the-environment-for-installed_tests.patch new file mode 100644 index 0000000000..eabe7bcbe1 --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0007-tests-install-the-environment-for-installed_tests.patch | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | From 57d2965e979f886e03eecd7e351bf01812053971 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jose Quaresma <quaresma.jose@gmail.com> | ||
| 3 | Date: Sun, 2 May 2021 01:58:01 +0100 | ||
| 4 | Subject: [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 | |||
| 10 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/789] | ||
| 11 | |||
| 12 | Signed-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 | |||
| 18 | diff --git a/template.test.in b/template.test.in | ||
| 19 | index 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@' | ||
| 27 | diff --git a/tests/check/meson.build b/tests/check/meson.build | ||
| 28 | index 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 | -- | ||
| 57 | 2.31.1 | ||
| 58 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/run-ptest b/meta/recipes-multimedia/gstreamer/gstreamer1.0/run-ptest new file mode 100755 index 0000000000..0cfa955f03 --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0/run-ptest | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | #!/usr/bin/env sh | ||
| 2 | gnome-desktop-testing-runner gstreamer | ||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.4.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.4.bb index b275a3430b..8f135b3839 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.4.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.4.bb | |||
| @@ -8,7 +8,7 @@ LICENSE = "LGPLv2+" | |||
| 8 | 8 | ||
| 9 | DEPENDS = "glib-2.0 glib-2.0-native libxml2 bison-native flex-native" | 9 | DEPENDS = "glib-2.0 glib-2.0-native libxml2 bison-native flex-native" |
| 10 | 10 | ||
| 11 | inherit meson pkgconfig gettext upstream-version-is-even gobject-introspection | 11 | inherit meson pkgconfig gettext upstream-version-is-even gobject-introspection ptest-gnome |
| 12 | 12 | ||
| 13 | LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \ | 13 | LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \ |
| 14 | file://gst/gst.h;beginline=1;endline=21;md5=e059138481205ee2c6fc1c079c016d0d" | 14 | file://gst/gst.h;beginline=1;endline=21;md5=e059138481205ee2c6fc1c079c016d0d" |
| @@ -16,10 +16,14 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \ | |||
| 16 | S = "${WORKDIR}/gstreamer-${PV}" | 16 | S = "${WORKDIR}/gstreamer-${PV}" |
| 17 | 17 | ||
| 18 | SRC_URI = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.xz \ | 18 | SRC_URI = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.xz \ |
| 19 | file://run-ptest \ | ||
| 19 | file://0001-gst-gstpluginloader.c-when-env-var-is-set-do-not-fal.patch \ | 20 | file://0001-gst-gstpluginloader.c-when-env-var-is-set-do-not-fal.patch \ |
| 20 | file://0002-Remove-unused-valgrind-detection.patch \ | 21 | file://0002-Remove-unused-valgrind-detection.patch \ |
| 21 | file://0003-tests-seek-Don-t-use-too-strict-timeout-for-validati.patch \ | 22 | file://0003-tests-seek-Don-t-use-too-strict-timeout-for-validati.patch \ |
| 22 | file://0004-meson-Add-option-for-installed-tests.patch \ | 23 | file://0004-tests-respect-the-idententaion-used-in-meson.patch \ |
| 24 | file://0005-tests-add-support-for-install-the-tests.patch \ | ||
| 25 | file://0006-tests-use-a-dictionaries-for-environment.patch \ | ||
| 26 | file://0007-tests-install-the-environment-for-installed_tests.patch \ | ||
| 23 | " | 27 | " |
| 24 | SRC_URI[sha256sum] = "9aeec99b38e310817012aa2d1d76573b787af47f8a725a65b833880a094dfbc5" | 28 | SRC_URI[sha256sum] = "9aeec99b38e310817012aa2d1d76573b787af47f8a725a65b833880a094dfbc5" |
| 25 | 29 | ||
| @@ -68,4 +72,4 @@ FILES_${PN}-dbg += "${datadir}/gdb ${datadir}/gstreamer-1.0/gdb" | |||
| 68 | 72 | ||
| 69 | CVE_PRODUCT = "gstreamer" | 73 | CVE_PRODUCT = "gstreamer" |
| 70 | 74 | ||
| 71 | require gstreamer1.0-ptest.inc | 75 | PTEST_BUILD_HOST_FILES = "" |
