diff options
Diffstat (limited to 'meta/recipes-multimedia/gstreamer/gstreamer1.0/0003-meson-Add-option-for-installed-tests.patch')
-rw-r--r-- | meta/recipes-multimedia/gstreamer/gstreamer1.0/0003-meson-Add-option-for-installed-tests.patch | 257 |
1 files changed, 0 insertions, 257 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0003-meson-Add-option-for-installed-tests.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0003-meson-Add-option-for-installed-tests.patch deleted file mode 100644 index bf5e57249c..0000000000 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0003-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 | |||