1 # SPDX-License-Identifier: LGPL-2.1-or-later
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@'],
10 build_by_default : want_tests != 'false')
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)
19 test_env.set('EFI_ADDON', efi_addon)
22 ############################################################
24 generate_sym_test_py = find_program('generate-sym-test.py')
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,
32 build_by_default : want_tests != 'false')
34 test_libudev_sym_c = custom_target(
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],
40 build_by_default : want_tests != 'false')
42 ############################################################
44 simple_tests += files(
46 'test-architecture.c',
51 'test-blockdev-util.c',
54 'test-calendarspec.c',
55 'test-cgroup-setup.c',
61 'test-compare-operator.c',
66 'test-coredump-util.c',
67 'test-cpu-set-util.c',
70 'test-data-fd-util.c',
73 'test-device-nodes.c',
81 'test-ether-addr-util.c',
85 'test-extract-word.c',
89 'test-firewall-util.c',
90 'test-format-table.c',
100 'test-hostname-setup.c',
101 'test-hostname-util.c',
103 'test-image-policy.c',
104 'test-import-util.c',
105 'test-in-addr-prefix-util.c',
106 'test-in-addr-util.c',
107 'test-install-file.c',
108 'test-install-root.c',
111 'test-journal-importer.c',
113 'test-limits-util.c',
115 'test-local-addresses.c',
116 'test-locale-util.c',
122 'test-memory-util.c',
124 'test-memstream-util.c',
127 'test-mountpoint-util.c',
128 'test-net-naming-scheme.c',
129 'test-nulstr-util.c',
131 'test-ordered-set.c',
133 'test-parse-argument.c',
134 'test-parse-helpers.c',
135 'test-path-lookup.c',
137 'test-percent-util.c',
139 'test-pretty-print.c',
141 'test-proc-cmdline.c',
142 'test-procfs-util.c',
146 'test-recurse-dir.c',
147 'test-replace-var.c',
148 'test-rlimit-util.c',
152 'test-secure-bits.c',
158 'test-signal-util.c',
160 'test-sleep-config.c',
161 'test-socket-netlink.c',
162 'test-socket-util.c',
165 'test-static-destruct.c',
167 'test-string-util.c',
168 'test-strip-tab-ansi.c',
171 'test-sysctl-util.c',
172 'test-terminal-util.c',
173 'test-tmpfile-util.c',
175 'test-uid-classification.c',
189 ############################################################
191 common_test_dependencies = [
202 'sources' : files('test-acl-util.c'),
203 'conditions' : ['HAVE_ACL'],
206 'sources' : files('test-af-list.c') +
207 generated_gperf_headers,
210 'sources' : files('test-arphrd-util.c') +
211 generated_gperf_headers,
214 'sources' : files('test-ask-password-api.c'),
218 'sources' : files('test-async.c'),
222 'sources' : files('test-boot-timestamps.c'),
223 'conditions' : ['ENABLE_EFI'],
226 'sources' : files('test-btrfs.c'),
230 'sources' : files('test-btrfs-physical-offset.c'),
234 'sources' : files('test-cap-list.c') +
235 generated_gperf_headers,
236 'dependencies' : libcap,
239 'sources' : files('test-capability.c'),
240 'dependencies' : libcap,
243 'sources' : files('test-chase-manual.c'),
247 'sources' : files('test-compress-benchmark.c'),
255 'sources' : files('test-compress.c'),
262 'sources' : files('test-cryptolib.c'),
263 'dependencies' : lib_openssl_or_gcrypt,
264 'conditions' : ['HAVE_OPENSSL_OR_GCRYPT'],
267 'sources' : files('test-dlopen-so.c'),
268 'dependencies' : libp11kit_cflags
271 # only static linking apart from libdl, to make sure that the
272 # module is linked to all libraries that it uses.
273 'sources' : files('test-dlopen.c'),
274 'link_with' : libbasic,
275 'dependencies' : libdl,
280 'sources' : files('test-errno-list.c') +
281 generated_gperf_headers,
284 'sources' : files('test-fd-util.c'),
285 'dependencies' : libseccomp,
290 'test-hashmap-plain.c',
292 test_hashmap_ordered_c,
297 'sources' : files('test-ip-protocol-list.c') +
298 shared_generated_gperf_headers,
301 'sources' : files('test-ipcrm.c'),
305 'sources' : files('test-json.c'),
306 'dependencies' : libm,
309 'sources' : files('test-libcrypt-util.c'),
310 'dependencies' : libcrypt,
314 'sources' : files('test-libmount.c'),
321 'sources' : files('test-loopback.c'),
322 'dependencies' : common_test_dependencies,
325 'sources' : files('test-math-util.c'),
326 'dependencies' : libm,
329 'sources' : files('test-mempress.c'),
330 'dependencies' : threads,
333 'sources' : files('test-mount-util.c'),
334 'dependencies' : libmount,
337 'sources' : files('test-netlink-manual.c'),
338 'dependencies' : libkmod,
339 'conditions' : ['HAVE_KMOD'],
343 'sources' : files('test-nft-set.c'),
347 'sources' : files('test-nscd-flush.c'),
348 'conditions' : ['ENABLE_NSCD'],
356 'dependencies' : libdl,
357 'conditions' : ['ENABLE_NSS'],
365 'dependencies' : libdl,
366 'conditions' : ['ENABLE_NSS'],
369 'sources' : files('test-openssl.c'),
370 'dependencies' : libopenssl,
371 'conditions' : ['HAVE_OPENSSL'],
374 'sources' : files('test-parse-util.c'),
375 'dependencies' : libm,
378 'sources' : files('test-process-util.c'),
379 'dependencies' : threads,
382 'sources' : files('test-qrcode-util.c'),
383 'dependencies' : libdl,
386 'sources' : files('test-random-util.c'),
387 'dependencies' : libm,
391 'sources' : files('test-sbat.c'),
392 'conditions' : ['ENABLE_BOOTLOADER'],
393 'c_args' : '-I@0@'.format(efi_config_h_dir),
396 'sources' : files('test-seccomp.c'),
397 'dependencies' : libseccomp,
398 'conditions' : ['HAVE_SECCOMP'],
401 'sources' : files('test-set-disable-mempool.c'),
402 'dependencies' : threads,
405 'sources' : files('test-sizeof.c'),
406 'link_with' : libbasic,
409 'sources' : files('test-time-util.c'),
413 'sources' : files('test-tpm2.c'),
414 'dependencies' : libopenssl,
418 'sources' : files('test-utmp.c'),
419 'conditions' : ['ENABLE_UTMP'],
422 'sources' : files('test-varlink.c'),
423 'dependencies' : threads,
426 'sources' : files('test-varlink-idl.c'),
427 'dependencies' : threads,
430 'sources' : files('test-watchdog.c'),
436 'name' : 'test-libsystemd-sym',
437 'sources' : test_libsystemd_sym_c,
438 'link_with' : libsystemd,
439 'suite' : 'libsystemd',
442 'name' : 'test-libsystemd-static-sym',
443 'sources' : test_libsystemd_sym_c,
444 'link_with' : install_libsystemd_static,
445 'build_by_default' : want_tests != 'false' and static_libsystemd != 'false',
446 'install' : install_tests and static_libsystemd != 'false',
447 'suite' : 'libsystemd',
450 'name' : 'test-libudev-sym',
451 'sources' : test_libudev_sym_c,
452 'include_directories' : libudev_includes,
453 'c_args' : ['-Wno-deprecated-declarations'] + test_cflags,
454 'link_with' : libudev,
458 'name' : 'test-libudev-static-sym',
459 'sources' : test_libudev_sym_c,
460 'include_directories' : libudev_includes,
461 'c_args' : ['-Wno-deprecated-declarations'] + test_cflags,
462 'link_with' : install_libudev_static,
463 'build_by_default' : want_tests != 'false' and static_libudev != 'false',
464 'install' : install_tests and static_libudev != 'false',
468 # Tests that link to libcore, i.e. tests for pid1 code.
469 core_test_template + {
470 'sources' : files('test-bpf-devices.c'),
471 'dependencies' : common_test_dependencies,
473 core_test_template + {
474 'sources' : files('test-bpf-firewall.c'),
475 'dependencies' : common_test_dependencies,
477 core_test_template + {
478 'sources' : files('test-bpf-foreign-programs.c'),
480 core_test_template + {
481 'sources' : files('test-bpf-restrict-fs.c'),
482 'dependencies' : common_test_dependencies,
484 core_test_template + {
485 'sources' : files('test-cgroup-cpu.c'),
487 core_test_template + {
488 'sources' : files('test-cgroup-mask.c'),
489 'dependencies' : common_test_dependencies,
491 core_test_template + {
492 'sources' : files('test-cgroup-unit-default.c'),
494 core_test_template + {
495 'sources' : files('test-chown-rec.c'),
497 core_test_template + {
498 'sources' : files('test-core-unit.c'),
499 'dependencies' : common_test_dependencies,
501 core_test_template + {
502 'sources' : files('test-emergency-action.c'),
504 core_test_template + {
505 'sources' : files('test-engine.c'),
506 'dependencies' : common_test_dependencies,
508 core_test_template + {
509 'sources' : files('test-execute.c'),
510 'dependencies' : common_test_dependencies,
513 core_test_template + {
514 'sources' : files('test-install.c'),
517 core_test_template + {
518 'sources' : files('test-job-type.c'),
519 'dependencies' : common_test_dependencies,
521 core_test_template + {
522 'sources' : files('test-load-fragment.c'),
523 'dependencies' : common_test_dependencies,
525 core_test_template + {
526 'sources' : files('test-loop-block.c'),
527 'dependencies' : [threads, libblkid],
530 core_test_template + {
531 'sources' : files('test-manager.c'),
533 core_test_template + {
534 'sources' : files('test-namespace.c'),
540 core_test_template + {
541 'sources' : files('test-ns.c'),
542 'dependencies' : common_test_dependencies,
545 core_test_template + {
546 'sources' : files('test-path.c'),
547 'dependencies' : common_test_dependencies,
550 core_test_template + {
551 'sources' : files('test-sched-prio.c'),
552 'dependencies' : common_test_dependencies,
554 core_test_template + {
555 'sources' : files('test-socket-bind.c'),
556 'dependencies' : libdl,
557 'conditions' : ['BPF_FRAMEWORK'],
559 core_test_template + {
560 'sources' : files('test-tables.c'),
562 core_test_template + {
563 'sources' : files('test-unit-name.c'),
564 'dependencies' : common_test_dependencies,
566 core_test_template + {
567 'sources' : files('test-unit-serialize.c'),
568 'dependencies' : common_test_dependencies,
570 core_test_template + {
571 'sources' : files('test-watch-pid.c'),
572 'dependencies' : common_test_dependencies,
575 # Tests from other directories that have link_with deps that were not defined earlier
577 'sources' : files('../libsystemd/sd-bus/test-bus-error.c'),
584 'sources' : files('../libsystemd/sd-device/test-sd-device-thread.c'),
589 'dependencies' : threads,
592 'sources' : files('../libudev/test-udev-device-thread.c'),
597 'dependencies' : threads,
600 'sources' : files('../libudev/test-libudev.c'),
607 'sources' : files('test-aux-scope.c'),