]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/meson.build
network/nexthop: check if nexthop is really configured without ID
[thirdparty/systemd.git] / src / test / meson.build
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2
3 awkscript = 'test-hashmap-ordered.awk'
4 test_hashmap_ordered_c = custom_target(
5 'test-hashmap-ordered.c',
6 input : [awkscript, 'test-hashmap-plain.c'],
7 output : 'test-hashmap-ordered.c',
8 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
9 capture : true,
10 build_by_default : want_tests != 'false')
11
12 path = run_command(sh, '-c', 'echo "$PATH"', check: true).stdout().strip()
13 test_env = environment()
14 test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
15 test_env.set('PATH', project_build_root + ':' + path)
16 test_env.set('PROJECT_BUILD_ROOT', project_build_root)
17
18 if efi_addon != ''
19 test_env.set('EFI_ADDON', efi_addon)
20 endif
21
22 ############################################################
23
24 generate_sym_test_py = find_program('generate-sym-test.py')
25
26 test_libsystemd_sym_c = custom_target(
27 'test-libsystemd-sym.c',
28 input : [libsystemd_sym_path] + systemd_headers + libsystemd_sources,
29 output : 'test-libsystemd-sym.c',
30 command : [generate_sym_test_py, libsystemd_sym_path, libsystemd_dir_path] + systemd_headers,
31 capture : true,
32 build_by_default : want_tests != 'false')
33
34 test_libudev_sym_c = custom_target(
35 'test-libudev-sym.c',
36 input : [libudev_sym_path, libudev_h_path] + libudev_sources,
37 output : 'test-libudev-sym.c',
38 command : [generate_sym_test_py, libudev_sym_path, libudev_dir_path, libudev_h_path],
39 capture : true,
40 build_by_default : want_tests != 'false')
41
42 ############################################################
43
44 simple_tests += files(
45 'test-alloc-util.c',
46 'test-architecture.c',
47 'test-argv-util.c',
48 'test-barrier.c',
49 'test-bitfield.c',
50 'test-bitmap.c',
51 'test-blockdev-util.c',
52 'test-bootspec.c',
53 'test-bus-util.c',
54 'test-calendarspec.c',
55 'test-cgroup-setup.c',
56 'test-cgroup-util.c',
57 'test-cgroup.c',
58 'test-chase.c',
59 'test-clock.c',
60 'test-compare-operator.c',
61 'test-condition.c',
62 'test-conf-files.c',
63 'test-conf-parser.c',
64 'test-copy.c',
65 'test-coredump-util.c',
66 'test-cpu-set-util.c',
67 'test-creds.c',
68 'test-daemon.c',
69 'test-data-fd-util.c',
70 'test-date.c',
71 'test-dev-setup.c',
72 'test-device-nodes.c',
73 'test-devnum-util.c',
74 'test-dns-domain.c',
75 'test-ellipsize.c',
76 'test-env-file.c',
77 'test-env-util.c',
78 'test-errno-util.c',
79 'test-escape.c',
80 'test-ether-addr-util.c',
81 'test-exec-util.c',
82 'test-execve.c',
83 'test-exit-status.c',
84 'test-extract-word.c',
85 'test-fdset.c',
86 'test-fiemap.c',
87 'test-fileio.c',
88 'test-firewall-util.c',
89 'test-format-table.c',
90 'test-format-util.c',
91 'test-fs-util.c',
92 'test-fstab-util.c',
93 'test-glob-util.c',
94 'test-gpt.c',
95 'test-gunicode.c',
96 'test-hash-funcs.c',
97 'test-hexdecoct.c',
98 'test-hmac.c',
99 'test-hostname-setup.c',
100 'test-hostname-util.c',
101 'test-id128.c',
102 'test-image-policy.c',
103 'test-import-util.c',
104 'test-in-addr-prefix-util.c',
105 'test-in-addr-util.c',
106 'test-install-file.c',
107 'test-install-root.c',
108 'test-io-util.c',
109 'test-journal-importer.c',
110 'test-kbd-util.c',
111 'test-limits-util.c',
112 'test-list.c',
113 'test-local-addresses.c',
114 'test-locale-util.c',
115 'test-lock-util.c',
116 'test-log.c',
117 'test-logarithm.c',
118 'test-macro.c',
119 'test-memfd-util.c',
120 'test-memory-util.c',
121 'test-mempool.c',
122 'test-memstream-util.c',
123 'test-mkdir.c',
124 'test-modhex.c',
125 'test-mountpoint-util.c',
126 'test-net-naming-scheme.c',
127 'test-nulstr-util.c',
128 'test-open-file.c',
129 'test-ordered-set.c',
130 'test-os-util.c',
131 'test-parse-argument.c',
132 'test-parse-helpers.c',
133 'test-path-lookup.c',
134 'test-path-util.c',
135 'test-percent-util.c',
136 'test-pretty-print.c',
137 'test-prioq.c',
138 'test-proc-cmdline.c',
139 'test-procfs-util.c',
140 'test-psi-util.c',
141 'test-ratelimit.c',
142 'test-raw-clone.c',
143 'test-recurse-dir.c',
144 'test-replace-var.c',
145 'test-rlimit-util.c',
146 'test-rm-rf.c',
147 'test-sd-hwdb.c',
148 'test-sd-path.c',
149 'test-secure-bits.c',
150 'test-selinux.c',
151 'test-serialize.c',
152 'test-set.c',
153 'test-sha256.c',
154 'test-sigbus.c',
155 'test-signal-util.c',
156 'test-siphash24.c',
157 'test-sleep-config.c',
158 'test-socket-netlink.c',
159 'test-socket-util.c',
160 'test-specifier.c',
161 'test-stat-util.c',
162 'test-static-destruct.c',
163 'test-strbuf.c',
164 'test-string-util.c',
165 'test-strip-tab-ansi.c',
166 'test-strv.c',
167 'test-strxcpyx.c',
168 'test-sysctl-util.c',
169 'test-terminal-util.c',
170 'test-tmpfile-util.c',
171 'test-udev-util.c',
172 'test-uid-alloc-range.c',
173 'test-uid-range.c',
174 'test-umask-util.c',
175 'test-unaligned.c',
176 'test-unit-file.c',
177 'test-user-util.c',
178 'test-utf8.c',
179 'test-verbs.c',
180 'test-web-util.c',
181 'test-xattr-util.c',
182 'test-xml.c',
183 )
184
185 ############################################################
186
187 common_test_dependencies = [
188 libblkid,
189 libmount,
190 librt,
191 libseccomp,
192 libselinux,
193 threads,
194 ]
195
196 executables += [
197 test_template + {
198 'sources' : files('test-acl-util.c'),
199 'conditions' : ['HAVE_ACL'],
200 },
201 test_template + {
202 'sources' : files('test-af-list.c') +
203 generated_gperf_headers,
204 },
205 test_template + {
206 'sources' : files('test-arphrd-util.c') +
207 generated_gperf_headers,
208 },
209 test_template + {
210 'sources' : files('test-ask-password-api.c'),
211 'type' : 'manual',
212 },
213 test_template + {
214 'sources' : files('test-async.c'),
215 'timeout' : 120,
216 },
217 test_template + {
218 'sources' : files('test-boot-timestamps.c'),
219 'conditions' : ['ENABLE_EFI'],
220 },
221 test_template + {
222 'sources' : files('test-btrfs.c'),
223 'type' : 'manual',
224 },
225 test_template + {
226 'sources' : files('test-btrfs-physical-offset.c'),
227 'type' : 'manual',
228 },
229 test_template + {
230 'sources' : files('test-cap-list.c') +
231 generated_gperf_headers,
232 'dependencies' : libcap,
233 },
234 test_template + {
235 'sources' : files('test-capability.c'),
236 'dependencies' : libcap,
237 },
238 test_template + {
239 'sources' : files('test-chase-manual.c'),
240 'type' : 'manual',
241 },
242 test_template + {
243 'sources' : files('test-compress-benchmark.c'),
244 'link_with' : [
245 libbasic_compress,
246 libshared,
247 ],
248 'timeout' : 90,
249 },
250 test_template + {
251 'sources' : files('test-compress.c'),
252 'link_with' : [
253 libbasic_compress,
254 libshared,
255 ],
256 },
257 test_template + {
258 'sources' : files('test-cryptolib.c'),
259 'dependencies' : lib_openssl_or_gcrypt,
260 'conditions' : ['HAVE_OPENSSL_OR_GCRYPT'],
261 },
262 test_template + {
263 'sources' : files('test-dlopen-so.c'),
264 'dependencies' : libp11kit_cflags
265 },
266 test_template + {
267 # only static linking apart from libdl, to make sure that the
268 # module is linked to all libraries that it uses.
269 'sources' : files('test-dlopen.c'),
270 'link_with' : libbasic,
271 'dependencies' : libdl,
272 'install' : false,
273 'type' : 'manual',
274 },
275 test_template + {
276 'sources' : files('test-errno-list.c') +
277 generated_gperf_headers,
278 },
279 test_template + {
280 'sources' : files('test-fd-util.c'),
281 'dependencies' : libseccomp,
282 },
283 test_template + {
284 'sources' : files(
285 'test-hashmap.c',
286 'test-hashmap-plain.c',
287 ) + [
288 test_hashmap_ordered_c,
289 ],
290 'timeout' : 180,
291 },
292 test_template + {
293 'sources' : files('test-ip-protocol-list.c') +
294 shared_generated_gperf_headers,
295 },
296 test_template + {
297 'sources' : files('test-ipcrm.c'),
298 'type' : 'unsafe',
299 },
300 test_template + {
301 'sources' : files('test-json.c'),
302 'dependencies' : libm,
303 },
304 test_template + {
305 'sources' : files('test-libcrypt-util.c'),
306 'dependencies' : libcrypt,
307 'timeout' : 120,
308 },
309 test_template + {
310 'sources' : files('test-libmount.c'),
311 'dependencies' : [
312 libmount,
313 threads,
314 ],
315 },
316 test_template + {
317 'sources' : files('test-loopback.c'),
318 'dependencies' : common_test_dependencies,
319 },
320 test_template + {
321 'sources' : files('test-math-util.c'),
322 'dependencies' : libm,
323 },
324 test_template + {
325 'sources' : files('test-mempress.c'),
326 'dependencies' : threads,
327 },
328 test_template + {
329 'sources' : files('test-mount-util.c'),
330 'dependencies' : libmount,
331 },
332 test_template + {
333 'sources' : files('test-netlink-manual.c'),
334 'dependencies' : libkmod,
335 'conditions' : ['HAVE_KMOD'],
336 'type' : 'manual',
337 },
338 test_template + {
339 'sources' : files('test-nft-set.c'),
340 'type' : 'manual',
341 },
342 test_template + {
343 'sources' : files('test-nscd-flush.c'),
344 'conditions' : ['ENABLE_NSCD'],
345 'type' : 'manual',
346 },
347 test_template + {
348 'sources' : files(
349 'test-nss-hosts.c',
350 'nss-test-util.c',
351 ),
352 'dependencies' : libdl,
353 'conditions' : ['ENABLE_NSS'],
354 'timeout' : 120,
355 },
356 test_template + {
357 'sources' : files(
358 'test-nss-users.c',
359 'nss-test-util.c',
360 ),
361 'dependencies' : libdl,
362 'conditions' : ['ENABLE_NSS'],
363 },
364 test_template + {
365 'sources' : files('test-openssl.c'),
366 'dependencies' : libopenssl,
367 'conditions' : ['HAVE_OPENSSL'],
368 },
369 test_template + {
370 'sources' : files('test-parse-util.c'),
371 'dependencies' : libm,
372 },
373 test_template + {
374 'sources' : files('test-process-util.c'),
375 'dependencies' : threads,
376 },
377 test_template + {
378 'sources' : files('test-qrcode-util.c'),
379 'dependencies' : libdl,
380 },
381 test_template + {
382 'sources' : files('test-random-util.c'),
383 'dependencies' : libm,
384 'timeout' : 120,
385 },
386 test_template + {
387 'sources' : files('test-sbat.c'),
388 'conditions' : ['ENABLE_BOOTLOADER'],
389 'c_args' : '-I@0@'.format(efi_config_h_dir),
390 },
391 test_template + {
392 'sources' : files('test-seccomp.c'),
393 'dependencies' : libseccomp,
394 'conditions' : ['HAVE_SECCOMP'],
395 },
396 test_template + {
397 'sources' : files('test-set-disable-mempool.c'),
398 'dependencies' : threads,
399 },
400 test_template + {
401 'sources' : files('test-sizeof.c'),
402 'link_with' : libbasic,
403 },
404 test_template + {
405 'sources' : files('test-time-util.c'),
406 'timeout' : 120,
407 },
408 test_template + {
409 'sources' : files('test-tpm2.c'),
410 'dependencies' : libopenssl,
411 'timeout' : 120,
412 },
413 test_template + {
414 'sources' : files('test-utmp.c'),
415 'conditions' : ['ENABLE_UTMP'],
416 },
417 test_template + {
418 'sources' : files('test-varlink.c'),
419 'dependencies' : threads,
420 },
421 test_template + {
422 'sources' : files('test-varlink-idl.c'),
423 'dependencies' : threads,
424 },
425 test_template + {
426 'sources' : files('test-watchdog.c'),
427 'type' : 'unsafe',
428 },
429
430 # Symbol tests
431 test_template + {
432 'name' : 'test-libsystemd-sym',
433 'sources' : test_libsystemd_sym_c,
434 'link_with' : libsystemd,
435 'suite' : 'libsystemd',
436 },
437 test_template + {
438 'name' : 'test-libsystemd-static-sym',
439 'sources' : test_libsystemd_sym_c,
440 'link_with' : install_libsystemd_static,
441 'build_by_default' : want_tests != 'false' and static_libsystemd != 'false',
442 'install' : install_tests and static_libsystemd != 'false',
443 'suite' : 'libsystemd',
444 },
445 test_template + {
446 'name' : 'test-libudev-sym',
447 'sources' : test_libudev_sym_c,
448 'include_directories' : libudev_includes,
449 'c_args' : ['-Wno-deprecated-declarations'] + test_cflags,
450 'link_with' : libudev,
451 'suite' : 'libudev',
452 },
453 test_template + {
454 'name' : 'test-libudev-static-sym',
455 'sources' : test_libudev_sym_c,
456 'include_directories' : libudev_includes,
457 'c_args' : ['-Wno-deprecated-declarations'] + test_cflags,
458 'link_with' : install_libudev_static,
459 'build_by_default' : want_tests != 'false' and static_libudev != 'false',
460 'install' : install_tests and static_libudev != 'false',
461 'suite' : 'libudev',
462 },
463
464 # Tests that link to libcore, i.e. tests for pid1 code.
465 core_test_template + {
466 'sources' : files('test-bpf-devices.c'),
467 'dependencies' : common_test_dependencies,
468 },
469 core_test_template + {
470 'sources' : files('test-bpf-firewall.c'),
471 'dependencies' : common_test_dependencies,
472 },
473 core_test_template + {
474 'sources' : files('test-bpf-foreign-programs.c'),
475 },
476 core_test_template + {
477 'sources' : files('test-bpf-lsm.c'),
478 'dependencies' : common_test_dependencies,
479 },
480 core_test_template + {
481 'sources' : files('test-cgroup-cpu.c'),
482 },
483 core_test_template + {
484 'sources' : files('test-cgroup-mask.c'),
485 'dependencies' : common_test_dependencies,
486 },
487 core_test_template + {
488 'sources' : files('test-cgroup-unit-default.c'),
489 },
490 core_test_template + {
491 'sources' : files('test-chown-rec.c'),
492 },
493 core_test_template + {
494 'sources' : files('test-core-unit.c'),
495 'dependencies' : common_test_dependencies,
496 },
497 core_test_template + {
498 'sources' : files('test-emergency-action.c'),
499 },
500 core_test_template + {
501 'sources' : files('test-engine.c'),
502 'dependencies' : common_test_dependencies,
503 },
504 core_test_template + {
505 'sources' : files('test-execute.c'),
506 'dependencies' : common_test_dependencies,
507 'timeout' : 360,
508 },
509 core_test_template + {
510 'sources' : files('test-install.c'),
511 'type' : 'manual',
512 },
513 core_test_template + {
514 'sources' : files('test-job-type.c'),
515 'dependencies' : common_test_dependencies,
516 },
517 core_test_template + {
518 'sources' : files('test-load-fragment.c'),
519 'dependencies' : common_test_dependencies,
520 },
521 core_test_template + {
522 'sources' : files('test-loop-block.c'),
523 'dependencies' : [threads, libblkid],
524 'parallel' : false,
525 },
526 core_test_template + {
527 'sources' : files('test-manager.c'),
528 },
529 core_test_template + {
530 'sources' : files('test-namespace.c'),
531 'dependencies' : [
532 libblkid,
533 threads,
534 ],
535 },
536 core_test_template + {
537 'sources' : files('test-ns.c'),
538 'dependencies' : common_test_dependencies,
539 'type' : 'manual',
540 },
541 core_test_template + {
542 'sources' : files('test-path.c'),
543 'dependencies' : common_test_dependencies,
544 'timeout' : 120,
545 },
546 core_test_template + {
547 'sources' : files('test-sched-prio.c'),
548 'dependencies' : common_test_dependencies,
549 },
550 core_test_template + {
551 'sources' : files('test-socket-bind.c'),
552 'dependencies' : libdl,
553 'conditions' : ['BPF_FRAMEWORK'],
554 },
555 core_test_template + {
556 'sources' : files('test-tables.c'),
557 },
558 core_test_template + {
559 'sources' : files('test-unit-name.c'),
560 'dependencies' : common_test_dependencies,
561 },
562 core_test_template + {
563 'sources' : files('test-unit-serialize.c'),
564 'dependencies' : common_test_dependencies,
565 },
566 core_test_template + {
567 'sources' : files('test-watch-pid.c'),
568 'dependencies' : common_test_dependencies,
569 },
570
571 # Tests from other directories that have link_with deps that were not defined earlier
572 test_template + {
573 'sources' : files('../libsystemd/sd-bus/test-bus-error.c'),
574 'link_with' : [
575 libshared_static,
576 libsystemd_static,
577 ],
578 },
579 test_template + {
580 'sources' : files('../libsystemd/sd-device/test-sd-device-thread.c'),
581 'link_with' : [
582 libbasic,
583 libsystemd,
584 ],
585 'dependencies' : threads,
586 },
587 test_template + {
588 'sources' : files('../libudev/test-udev-device-thread.c'),
589 'link_with' : [
590 libbasic,
591 libudev,
592 ],
593 'dependencies' : threads,
594 },
595 test_template + {
596 'sources' : files('../libudev/test-libudev.c'),
597 'link_with' : [
598 libshared,
599 libudev_basic,
600 ],
601 },
602 ]