]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | # SPDX-License-Identifier: LGPL-2.1-or-later |
3a726fcd | 2 | |
a18c7865 | 3 | if install_tests |
2f809d29 ZJS |
4 | foreach subdir : [ |
5 | 'auxv', | |
6 | 'journal-data', | |
9a4f925b | 7 | 'knot-data', |
27add528 | 8 | 'test-journals', |
2f809d29 ZJS |
9 | 'units', |
10 | 'test-execute', | |
11 | 'test-fstab-generator', | |
12 | 'test-path', | |
13 | 'test-path-util', | |
14 | 'test-umount', | |
3ceb96e0 | 15 | 'test-network', |
2f809d29 ZJS |
16 | 'test-network-generator-conversion', |
17 | 'testsuite-03.units', | |
18 | 'testsuite-04.units', | |
19 | 'testsuite-06.units', | |
a8faac7d | 20 | 'testsuite-07.units', |
2f809d29 | 21 | 'testsuite-16.units', |
8412cdf4 | 22 | 'testsuite-23.units', |
2f809d29 ZJS |
23 | 'testsuite-30.units', |
24 | 'testsuite-52.units', | |
25 | 'testsuite-63.units', | |
26 | 'testsuite-80.units', | |
27 | ] | |
ea07a6d4 DDM |
28 | # install_subdir() before meson 1.3.0 does not handle symlinks correctly (it follows them |
29 | # instead of copying the symlink) so we use rsync instead. | |
30 | if meson.version().version_compare('<1.3.0') | |
31 | if not rsync.found() | |
32 | error('rsync is required to install the integration test data') | |
33 | endif | |
34 | ||
35 | rsync_r = rsync.full_path() + ' -rlpt --exclude .gitattributes --exclude 25-default.link -- "@0@" "${DESTDIR:-}@1@"' | |
cc2a0d85 DDM |
36 | meson.add_install_script(sh, '-c', |
37 | rsync_r.format(meson.current_source_dir() / subdir, testdata_dir)) | |
38 | else | |
39 | install_subdir(subdir, | |
ea07a6d4 DDM |
40 | exclude_files : ['.gitattributes', '25-default.link'], |
41 | install_dir : testdata_dir, | |
42 | follow_symlinks : false) | |
cc2a0d85 | 43 | endif |
2f809d29 | 44 | endforeach |
80769cb6 | 45 | |
ea07a6d4 DDM |
46 | # test-network/conf/25-default.link is a local symlink that becomes dangling when installed, so we |
47 | # exclude it and create the correct symlink here. | |
48 | meson.add_install_script(sh, '-c', ln_s.format(networkdir / '99-default.link', | |
49 | testdata_dir / 'test-network/conf/25-default.link')) | |
50 | ||
be0cc2ce FB |
51 | install_data(kbd_model_map, |
52 | install_dir : testdata_dir + '/test-keymap-util') | |
53 | ||
e8509329 | 54 | if conf.get('HAVE_ZSTD') == 1 and efi_arch != '' |
db7f5ab6 JJ |
55 | install_subdir('test-bcd', |
56 | exclude_files : '.gitattributes', | |
57 | install_dir : testdata_dir) | |
58 | endif | |
a18c7865 ZJS |
59 | if conf.get('ENABLE_RESOLVE') == 1 |
60 | install_subdir('test-resolve', | |
082c6761 | 61 | exclude_files : '.gitattributes', |
a18c7865 ZJS |
62 | install_dir : testdata_dir) |
63 | endif | |
c8475239 | 64 | |
c18cc7f7 FB |
65 | # The unit tests implemented as shell scripts expect to find testdata/ |
66 | # in the directory where they are stored. | |
9289e093 YW |
67 | meson.add_install_script(sh, '-c', ln_s.format(testdata_dir, |
68 | unittestsdir / 'testdata')) | |
4ff3f251 ZJS |
69 | endif |
70 | ||
e5cc6d10 YW |
71 | ############################################################ |
72 | ||
73 | if conf.get('ENABLE_SYSUSERS') == 1 | |
74 | test_sysusers_sh = configure_file( | |
75 | input : 'test-sysusers.sh.in', | |
76 | output : 'test-sysusers.sh', | |
77 | configuration : conf) | |
78 | ||
79 | if want_tests != 'false' | |
80 | exe = executables_by_name.get('systemd-sysusers') | |
81 | test('test-sysusers', | |
82 | test_sysusers_sh, | |
83 | # https://github.com/mesonbuild/meson/issues/2681 | |
84 | args : exe.full_path(), | |
dc4a0055 YW |
85 | depends : exe, |
86 | suite : 'sysusers') | |
e5cc6d10 YW |
87 | |
88 | if have_standalone_binaries | |
89 | exe = executables_by_name.get('systemd-sysusers.standalone') | |
90 | test('test-sysusers.standalone', | |
91 | test_sysusers_sh, | |
92 | # https://github.com/mesonbuild/meson/issues/2681 | |
93 | args : exe.full_path(), | |
dc4a0055 YW |
94 | depends : exe, |
95 | suite : 'sysusers') | |
e5cc6d10 YW |
96 | endif |
97 | endif | |
98 | ||
99 | if install_tests | |
100 | install_data(test_sysusers_sh, | |
101 | install_dir : unittestsdir) | |
102 | install_subdir('test-sysusers', | |
103 | exclude_files : '.gitattributes', | |
104 | install_dir : testdata_dir) | |
105 | endif | |
106 | endif | |
0703d2f6 YW |
107 | |
108 | ############################################################ | |
109 | ||
e5cc6d10 YW |
110 | if want_tests != 'false' and conf.get('ENABLE_HWDB') == 1 |
111 | hwdb_test_sh = find_program('hwdb-test.sh') | |
112 | exe = executables_by_name.get('systemd-hwdb') | |
113 | test('hwdb-test', | |
114 | hwdb_test_sh, | |
115 | suite : 'dist', | |
116 | args : exe.full_path(), | |
117 | depends : exe, | |
118 | timeout : 90) | |
119 | endif | |
120 | ||
121 | ############################################################ | |
122 | ||
123 | if want_tests != 'false' | |
124 | test_systemctl_enable_sh = find_program('test-systemctl-enable.sh') | |
125 | systemctl = executables_by_name.get('systemctl') | |
126 | systemd_id128 = executables_by_name.get('systemd-id128') | |
127 | test('test-systemctl-enable', | |
128 | test_systemctl_enable_sh, | |
129 | # https://github.com/mesonbuild/meson/issues/2681 | |
130 | args : [systemctl.full_path(), | |
131 | systemd_id128.full_path()], | |
dc4a0055 YW |
132 | depends : [systemctl, systemd_id128], |
133 | suite : 'systemctl') | |
e5cc6d10 YW |
134 | endif |
135 | ||
136 | ############################################################ | |
137 | ||
138 | if want_tests != 'false' and conf.get('HAVE_SYSV_COMPAT') == 1 | |
139 | sysv_generator_test_py = find_program('sysv-generator-test.py') | |
140 | exe = executables_by_name.get('systemd-sysv-generator') | |
141 | test('sysv-generator-test', | |
142 | sysv_generator_test_py, | |
dc4a0055 YW |
143 | depends : exe, |
144 | suite : 'sysv') | |
e5cc6d10 YW |
145 | endif |
146 | ||
147 | ############################################################ | |
148 | ||
dedb925e | 149 | if want_tests != 'false' and conf.get('HAVE_BLKID') == 1 |
e5cc6d10 YW |
150 | test_bootctl_json_sh = find_program('test-bootctl-json.sh') |
151 | exe = executables_by_name.get('bootctl') | |
152 | test('test-bootctl-json', | |
153 | test_bootctl_json_sh, | |
154 | args : exe.full_path(), | |
dc4a0055 YW |
155 | depends : exe, |
156 | suite : 'boot') | |
e5cc6d10 YW |
157 | endif |
158 | ||
159 | ############################################################ | |
160 | ||
161 | if want_tests != 'false' and conf.get('ENABLE_TMPFILES') == 1 | |
162 | test_systemd_tmpfiles_py = find_program('test-systemd-tmpfiles.py') | |
163 | exe = executables_by_name.get('systemd-tmpfiles') | |
164 | test('test-systemd-tmpfiles', | |
165 | test_systemd_tmpfiles_py, | |
166 | args : exe.full_path(), | |
dc4a0055 YW |
167 | depends : exe, |
168 | suite : 'tmpfiles') | |
e5cc6d10 YW |
169 | |
170 | if have_standalone_binaries | |
171 | exe = executables_by_name.get('systemd-tmpfiles.standalone') | |
172 | test('test-systemd-tmpfiles.standalone', | |
173 | test_systemd_tmpfiles_py, | |
174 | args : exe.full_path(), | |
dc4a0055 YW |
175 | depends : exe, |
176 | suite : 'tmpfiles') | |
e5cc6d10 | 177 | endif |
bd7e6aa7 ZJS |
178 | endif |
179 | ||
180 | ############################################################ | |
181 | ||
4e8295f4 | 182 | test_compare_versions_sh = files('test-compare-versions.sh') |
e5cc6d10 YW |
183 | if want_tests != 'false' |
184 | exe = executables_by_name.get('systemd-analyze') | |
185 | test('test-compare-versions', | |
186 | test_compare_versions_sh, | |
187 | args : exe.full_path(), | |
dc4a0055 YW |
188 | depends : exe, |
189 | suite : 'test') | |
e5cc6d10 | 190 | endif |
4e8295f4 ZJS |
191 | if install_tests |
192 | install_data(test_compare_versions_sh, | |
26c2b302 | 193 | install_dir : unittestsdir) |
4e8295f4 ZJS |
194 | endif |
195 | ||
196 | ############################################################ | |
197 | ||
6b97bf22 | 198 | rule_syntax_check_py = find_program('rule-syntax-check.py') |
938be089 ZJS |
199 | if want_tests != 'false' |
200 | test('rule-syntax-check', | |
201 | rule_syntax_check_py, | |
02e0f430 | 202 | suite : 'dist', |
938be089 | 203 | args : all_rules) |
e5cc6d10 YW |
204 | |
205 | exe = executables_by_name.get('udevadm') | |
206 | test('udev-rules-check', | |
207 | exe, | |
dc4a0055 | 208 | suite : 'udev', |
e5cc6d10 | 209 | args : ['verify', '--resolve-names=never', all_rules]) |
938be089 | 210 | endif |
6b97bf22 ZJS |
211 | |
212 | ############################################################ | |
213 | ||
3762f8e3 ZJS |
214 | if install_tests |
215 | install_data('run-unit-tests.py', | |
216 | install_mode : 'rwxr-xr-x', | |
217 | install_dir : testsdir) | |
e5cc6d10 YW |
218 | endif |
219 | ||
220 | ############################################################ | |
14055702 | 221 | |
e5cc6d10 YW |
222 | test_fstab_generator_sh = find_program('test-fstab-generator.sh') |
223 | if want_tests != 'false' | |
224 | exe = executables_by_name.get('systemd-fstab-generator') | |
225 | test('test-fstab-generator', | |
226 | test_fstab_generator_sh, | |
227 | # https://github.com/mesonbuild/meson/issues/2681 | |
228 | args : exe.full_path(), | |
229 | env : test_env, | |
dc4a0055 YW |
230 | depends : exe, |
231 | suite : 'fstab') | |
e5cc6d10 YW |
232 | endif |
233 | if install_tests | |
8cc8a073 YW |
234 | install_data('test-fstab-generator.sh', |
235 | install_mode : 'rwxr-xr-x', | |
26c2b302 | 236 | install_dir : unittestsdir) |
e5cc6d10 YW |
237 | endif |
238 | ||
239 | ############################################################ | |
8cc8a073 | 240 | |
e5cc6d10 YW |
241 | test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh') |
242 | if want_tests != 'false' | |
243 | exe = executables_by_name.get('systemd-network-generator') | |
244 | test('test-network-generator-conversion', | |
245 | test_network_generator_conversion_sh, | |
246 | # https://github.com/mesonbuild/meson/issues/2681 | |
247 | args : exe.full_path(), | |
dc4a0055 YW |
248 | depends : exe, |
249 | suite : 'network') | |
e5cc6d10 YW |
250 | endif |
251 | if install_tests | |
b322e683 YW |
252 | install_data('test-network-generator-conversion.sh', |
253 | install_mode : 'rwxr-xr-x', | |
26c2b302 | 254 | install_dir : unittestsdir) |
3762f8e3 ZJS |
255 | endif |
256 | ||
257 | ############################################################ | |
258 | ||
0454cf05 ZJS |
259 | sys_script_py = files('sys-script.py') |
260 | test_udev_py = files('test-udev.py') | |
130c87b1 YW |
261 | if want_tests != 'false' |
262 | exe = executables_by_name.get('test-udev-rule-runner') | |
263 | test('test-udev', | |
264 | test_udev_py, | |
265 | args : ['-v'], | |
266 | env : ['UDEV_RULE_RUNNER=' + exe.full_path()], | |
267 | depends : exe, | |
dc4a0055 YW |
268 | timeout : 180, |
269 | suite : 'udev') | |
130c87b1 | 270 | endif |
0454cf05 ZJS |
271 | if install_tests |
272 | install_data( | |
273 | sys_script_py, | |
274 | test_udev_py, | |
275 | install_dir : unittestsdir) | |
f2c02d23 ZJS |
276 | endif |
277 | ||
2b7b142e ZJS |
278 | ############################################################ |
279 | ||
55c09511 FS |
280 | rpm = find_program('rpm', required : false) |
281 | rpmspec = find_program('rpmspec', required : false) | |
282 | test_rpm_macros = find_program('test-rpm-macros.sh') | |
283 | ||
284 | if rpm.found() and rpmspec.found() | |
285 | if want_tests != 'false' | |
286 | test('test-rpm-macros', | |
287 | test_rpm_macros, | |
02e0f430 | 288 | suite : 'dist', |
55c09511 FS |
289 | args : [project_build_root]) |
290 | endif | |
291 | else | |
292 | message('Skipping test-rpm-macros since rpm and/or rpmspec are not available') | |
293 | endif | |
294 | ||
295 | ############################################################ | |
296 | ||
12b4cffd | 297 | if want_tests != 'false' and conf.get('HAVE_DMI') == 1 |
4dd465cb | 298 | udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh') |
adedcd39 | 299 | exe = executables_by_name.get('dmi_memory_id') |
2b7b142e | 300 | |
edd84b8e | 301 | if git.found() and fs.is_dir(project_source_root / '.git') |
2b7b142e | 302 | out = run_command( |
0f4c4f38 ZJS |
303 | env, '-u', 'GIT_WORK_TREE', |
304 | git, '--git-dir=@0@/.git'.format(project_source_root), | |
68a06b3c JJ |
305 | 'ls-files', ':/test/dmidecode-dumps/*.bin', |
306 | check: true) | |
2b7b142e ZJS |
307 | else |
308 | out = run_command( | |
ac3eda34 | 309 | sh, '-c', 'cd "$1"; echo test/dmidecode-dumps/*.bin', '_', project_source_root, |
68a06b3c | 310 | check: true) |
2b7b142e ZJS |
311 | endif |
312 | ||
313 | foreach p : out.stdout().split() | |
fce9abb2 | 314 | source = project_source_root / p |
739a62bb | 315 | test('dmidecode_' + fs.stem(p), |
2b7b142e | 316 | udev_dmi_memory_id_test, |
dc4a0055 | 317 | suite : 'udev', |
adedcd39 | 318 | args : [exe.full_path(), |
0b5f1bd4 | 319 | source, |
e93ada98 | 320 | source + '.txt'], |
adedcd39 | 321 | depends : exe) |
2b7b142e | 322 | endforeach |
4dd465cb BN |
323 | endif |
324 | ||
e5cc6d10 YW |
325 | ############################################################ |
326 | ||
327 | if want_tests != 'false' and conf.get('ENABLE_KERNEL_INSTALL') == 1 | |
328 | kernel_install = executables_by_name.get('kernel-install') | |
329 | args = [kernel_install.full_path(), loaderentry_install.full_path(), uki_copy_install] | |
330 | deps = [kernel_install, loaderentry_install] | |
331 | if want_ukify and boot_stubs.length() > 0 | |
332 | args += [ukify.full_path(), ukify_install.full_path(), boot_stubs[0]] | |
333 | deps += [ukify, ukify_install, boot_stubs[0]] | |
334 | endif | |
335 | ||
336 | test('test-kernel-install', | |
337 | test_kernel_install_sh, | |
338 | env : test_env, | |
339 | args : args, | |
dc4a0055 YW |
340 | depends : deps, |
341 | suite : 'kernel-install') | |
e5cc6d10 | 342 | endif |
945b722f RM |
343 | |
344 | ############################################################ | |
345 | ||
cf5e1b5d DDM |
346 | integration_test_wrapper = find_program('integration-test-wrapper.py') |
347 | integration_tests = { | |
348 | '01': 'TEST-01-BASIC', | |
349 | '02': 'TEST-02-UNITTESTS', | |
66fb77a8 | 350 | '03': 'TEST-03-JOBS', |
77962e12 | 351 | '04': 'TEST-04-JOURNAL', |
66fb77a8 | 352 | '05': 'TEST-05-RLIMITS', |
ab9d6025 | 353 | '06': 'TEST-06-SELINUX', |
77962e12 | 354 | '07': 'TEST-07-PID1', |
4b1edf5c | 355 | # '08': 'TEST-08-INITRD', |
f2018d06 RM |
356 | '09': 'TEST-09-REBOOT', |
357 | '13': 'TEST-13-NSPAWN', | |
358 | '15': 'TEST-15-DROPIN', | |
66fb77a8 | 359 | '16': 'TEST-16-EXTEND-TIMEOUT', |
3beefac9 | 360 | '17': 'TEST-17-UDEV', |
f2018d06 | 361 | '18': 'TEST-18-FAILUREACTION', |
66fb77a8 | 362 | '19': 'TEST-19-CGROUP', |
77962e12 | 363 | '21': 'TEST-21-DFUZZER', |
f2018d06 | 364 | '22': 'TEST-22-TMPFILES', |
77962e12 | 365 | '23': 'TEST-23-UNIT-FILE', |
4b1edf5c | 366 | # '24': 'TEST-24-CRYPTSETUP', |
66fb77a8 RM |
367 | '25': 'TEST-25-IMPORT', |
368 | '26': 'TEST-26-SYSTEMCTL', | |
c77dad70 | 369 | '29': 'TEST-29-PORTABLE', |
66fb77a8 | 370 | '30': 'TEST-30-ONCLOCKCHANGE', |
77962e12 | 371 | '31': 'TEST-31-DEVICE-ENUMERATION', |
66fb77a8 RM |
372 | '32': 'TEST-32-OOMPOLICY', |
373 | '34': 'TEST-34-DYNAMICUSERMIGRATE', | |
f2018d06 | 374 | '35': 'TEST-35-LOGIN', |
66fb77a8 RM |
375 | '36': 'TEST-36-NUMAPOLICY', |
376 | '38': 'TEST-38-FREEZER', | |
c77dad70 | 377 | '43': 'TEST-43-PRIVATEUSER-UNPRIV', |
66fb77a8 RM |
378 | '44': 'TEST-44-LOG-NAMESPACE', |
379 | '45': 'TEST-45-TIMEDATE', | |
77962e12 | 380 | '46': 'TEST-46-HOMED', |
c77dad70 | 381 | '50': 'TEST-50-DISSECT', |
77962e12 DDM |
382 | '52': 'TEST-52-HONORFIRSTSHUTDOWN', |
383 | '53': 'TEST-53-ISSUE-16347', | |
4b1edf5c | 384 | # '54': 'TEST-54-CREDS', |
77962e12 DDM |
385 | '55': 'TEST-55-OOMD', |
386 | '58': 'TEST-58-REPART', | |
66fb77a8 RM |
387 | '59': 'TEST-59-RELOADING-RESTART', |
388 | '60': 'TEST-60-MOUNT-RATELIMIT', | |
389 | '62': 'TEST-62-RESTRICT-IFACES', | |
390 | '63': 'TEST-63-PATH', | |
e3ab65cf | 391 | # '64': 'TEST-64-UDEV-STORAGE', |
f2018d06 | 392 | '65': 'TEST-65-ANALYZE', |
66fb77a8 RM |
393 | '66': 'TEST-66-DEVICE-ISOLATION', |
394 | '67': 'TEST-67-INTEGRITY', | |
395 | '68': 'TEST-68-PROPAGATE-EXIT-STATUS', | |
15faee53 | 396 | # '69': 'TEST-69-SHUTDOWN', |
f2018d06 RM |
397 | '70': 'TEST-70-TPM2', |
398 | '71': 'TEST-71-HOSTNAME', | |
66fb77a8 | 399 | '72': 'TEST-72-SYSUPDATE', |
77962e12 DDM |
400 | '73': 'TEST-73-LOCALE', |
401 | '74': 'TEST-74-AUX-UTILS', | |
402 | '75': 'TEST-75-RESOLVED', | |
66fb77a8 RM |
403 | '76': 'TEST-76-SYSCTL', |
404 | '78': 'TEST-78-SIGQUEUE', | |
405 | '79': 'TEST-79-MEMPRESS', | |
406 | '80': 'TEST-80-NOTIFYACCESS', | |
407 | '81': 'TEST-81-GENERATORS', | |
4b1edf5c | 408 | # '82': 'TEST-82-SOFTREBOOT', |
f2018d06 | 409 | '83': 'TEST-83-BTRFS', |
66fb77a8 | 410 | '84': 'TEST-84-STORAGETM', |
cf5e1b5d DDM |
411 | } |
412 | foreach test_number, dirname : integration_tests | |
413 | test_params = { | |
414 | 'mkosi_args' : [], | |
51273281 | 415 | 'timeout' : 1800, |
bdade5f5 | 416 | 'storage' : 'volatile', |
ae25df53 | 417 | 'priority' : 0, |
1f2c9bda | 418 | 'firmware' : 'linux', |
945b722f | 419 | } |
b85e5496 | 420 | |
cf5e1b5d DDM |
421 | # TODO: This fs.exists call isn't included in rebuild logic |
422 | # so if you add a new meson.build in a subdir | |
423 | # you need to touch another build file to get it to reparse. | |
424 | if fs.exists(dirname / 'meson.build') | |
425 | subdir(dirname) | |
426 | endif | |
427 | ||
428 | args = [ | |
429 | '--meson-source-dir', meson.project_source_root(), | |
430 | '--meson-build-dir', meson.project_build_root(), | |
431 | '--test-name', dirname, | |
432 | '--test-number', test_number, | |
9a69900a | 433 | '--storage', test_params['storage'], |
1f2c9bda | 434 | '--firmware', test_params['firmware'], |
cf5e1b5d DDM |
435 | '--', |
436 | ] + test_params['mkosi_args'] | |
437 | ||
38db5eff DDM |
438 | integration_test_env = {} |
439 | ||
440 | if want_integration_tests | |
441 | integration_test_env = {'SYSTEMD_INTEGRATION_TESTS': '1'} | |
442 | endif | |
443 | ||
cf5e1b5d DDM |
444 | # We don't explicitly depend on the "mkosi" target because that means the image is rebuilt |
445 | # on every "ninja -C build". Instead, the mkosi target has to be rebuilt manually before | |
446 | # running the integration tests with mkosi. | |
447 | test(dirname, | |
bdade5f5 | 448 | integration_test_wrapper, |
38db5eff | 449 | env : integration_test_env, |
bdade5f5 DDM |
450 | args : args, |
451 | timeout : test_params['timeout'], | |
ae25df53 | 452 | priority : test_params['priority'], |
bdade5f5 | 453 | suite : 'integration-tests') |
cf5e1b5d | 454 | endforeach |