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',
60 'test-compare-operator.c',
65 'test-coredump-util.c',
66 'test-cpu-set-util.c',
69 'test-data-fd-util.c',
72 'test-device-nodes.c',
80 'test-ether-addr-util.c',
84 'test-extract-word.c',
88 'test-firewall-util.c',
89 'test-format-table.c',
99 'test-hostname-setup.c',
100 'test-hostname-util.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',
109 'test-journal-importer.c',
111 'test-limits-util.c',
113 'test-local-addresses.c',
114 'test-locale-util.c',
120 'test-memory-util.c',
122 'test-memstream-util.c',
125 'test-mountpoint-util.c',
126 'test-net-naming-scheme.c',
127 'test-nulstr-util.c',
129 'test-ordered-set.c',
131 'test-parse-argument.c',
132 'test-parse-helpers.c',
133 'test-path-lookup.c',
135 'test-percent-util.c',
136 'test-pretty-print.c',
138 'test-proc-cmdline.c',
139 'test-procfs-util.c',
143 'test-recurse-dir.c',
144 'test-replace-var.c',
145 'test-rlimit-util.c',
149 'test-secure-bits.c',
155 'test-signal-util.c',
157 'test-sleep-config.c',
158 'test-socket-netlink.c',
159 'test-socket-util.c',
162 'test-static-destruct.c',
164 'test-string-util.c',
165 'test-strip-tab-ansi.c',
168 'test-sysctl-util.c',
169 'test-terminal-util.c',
170 'test-tmpfile-util.c',
172 'test-uid-alloc-range.c',
185 ############################################################
187 common_test_dependencies = [
198 'sources' : files('test-acl-util.c'),
199 'conditions' : ['HAVE_ACL'],
202 'sources' : files('test-af-list.c') +
203 generated_gperf_headers,
206 'sources' : files('test-arphrd-util.c') +
207 generated_gperf_headers,
210 'sources' : files('test-ask-password-api.c'),
214 'sources' : files('test-async.c'),
218 'sources' : files('test-boot-timestamps.c'),
219 'conditions' : ['ENABLE_EFI'],
222 'sources' : files('test-btrfs.c'),
226 'sources' : files('test-btrfs-physical-offset.c'),
230 'sources' : files('test-cap-list.c') +
231 generated_gperf_headers,
232 'dependencies' : libcap,
235 'sources' : files('test-capability.c'),
236 'dependencies' : libcap,
239 'sources' : files('test-chase-manual.c'),
243 'sources' : files('test-compress-benchmark.c'),
251 'sources' : files('test-compress.c'),
258 'sources' : files('test-cryptolib.c'),
259 'dependencies' : lib_openssl_or_gcrypt,
260 'conditions' : ['HAVE_OPENSSL_OR_GCRYPT'],
263 'sources' : files('test-dlopen-so.c'),
264 'dependencies' : libp11kit_cflags
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,
276 'sources' : files('test-errno-list.c') +
277 generated_gperf_headers,
280 'sources' : files('test-fd-util.c'),
281 'dependencies' : libseccomp,
286 'test-hashmap-plain.c',
288 test_hashmap_ordered_c,
293 'sources' : files('test-ip-protocol-list.c') +
294 shared_generated_gperf_headers,
297 'sources' : files('test-ipcrm.c'),
301 'sources' : files('test-json.c'),
302 'dependencies' : libm,
305 'sources' : files('test-libcrypt-util.c'),
306 'dependencies' : libcrypt,
310 'sources' : files('test-libmount.c'),
317 'sources' : files('test-loopback.c'),
318 'dependencies' : common_test_dependencies,
321 'sources' : files('test-math-util.c'),
322 'dependencies' : libm,
325 'sources' : files('test-mempress.c'),
326 'dependencies' : threads,
329 'sources' : files('test-mount-util.c'),
330 'dependencies' : libmount,
333 'sources' : files('test-netlink-manual.c'),
334 'dependencies' : libkmod,
335 'conditions' : ['HAVE_KMOD'],
339 'sources' : files('test-nft-set.c'),
343 'sources' : files('test-nscd-flush.c'),
344 'conditions' : ['ENABLE_NSCD'],
352 'dependencies' : libdl,
353 'conditions' : ['ENABLE_NSS'],
361 'dependencies' : libdl,
362 'conditions' : ['ENABLE_NSS'],
365 'sources' : files('test-openssl.c'),
366 'dependencies' : libopenssl,
367 'conditions' : ['HAVE_OPENSSL'],
370 'sources' : files('test-parse-util.c'),
371 'dependencies' : libm,
374 'sources' : files('test-process-util.c'),
375 'dependencies' : threads,
378 'sources' : files('test-qrcode-util.c'),
379 'dependencies' : libdl,
382 'sources' : files('test-random-util.c'),
383 'dependencies' : libm,
387 'sources' : files('test-sbat.c'),
388 'conditions' : ['ENABLE_BOOTLOADER'],
389 'c_args' : '-I@0@'.format(efi_config_h_dir),
392 'sources' : files('test-seccomp.c'),
393 'dependencies' : libseccomp,
394 'conditions' : ['HAVE_SECCOMP'],
397 'sources' : files('test-set-disable-mempool.c'),
398 'dependencies' : threads,
401 'sources' : files('test-sizeof.c'),
402 'link_with' : libbasic,
405 'sources' : files('test-time-util.c'),
409 'sources' : files('test-tpm2.c'),
410 'dependencies' : libopenssl,
414 'sources' : files('test-utmp.c'),
415 'conditions' : ['ENABLE_UTMP'],
418 'sources' : files('test-varlink.c'),
419 'dependencies' : threads,
422 'sources' : files('test-varlink-idl.c'),
423 'dependencies' : threads,
426 'sources' : files('test-watchdog.c'),
432 'name' : 'test-libsystemd-sym',
433 'sources' : test_libsystemd_sym_c,
434 'link_with' : libsystemd,
435 'suite' : 'libsystemd',
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',
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,
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',
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,
469 core_test_template + {
470 'sources' : files('test-bpf-firewall.c'),
471 'dependencies' : common_test_dependencies,
473 core_test_template + {
474 'sources' : files('test-bpf-foreign-programs.c'),
476 core_test_template + {
477 'sources' : files('test-bpf-lsm.c'),
478 'dependencies' : common_test_dependencies,
480 core_test_template + {
481 'sources' : files('test-cgroup-cpu.c'),
483 core_test_template + {
484 'sources' : files('test-cgroup-mask.c'),
485 'dependencies' : common_test_dependencies,
487 core_test_template + {
488 'sources' : files('test-cgroup-unit-default.c'),
490 core_test_template + {
491 'sources' : files('test-chown-rec.c'),
493 core_test_template + {
494 'sources' : files('test-core-unit.c'),
495 'dependencies' : common_test_dependencies,
497 core_test_template + {
498 'sources' : files('test-emergency-action.c'),
500 core_test_template + {
501 'sources' : files('test-engine.c'),
502 'dependencies' : common_test_dependencies,
504 core_test_template + {
505 'sources' : files('test-execute.c'),
506 'dependencies' : common_test_dependencies,
509 core_test_template + {
510 'sources' : files('test-install.c'),
513 core_test_template + {
514 'sources' : files('test-job-type.c'),
515 'dependencies' : common_test_dependencies,
517 core_test_template + {
518 'sources' : files('test-load-fragment.c'),
519 'dependencies' : common_test_dependencies,
521 core_test_template + {
522 'sources' : files('test-loop-block.c'),
523 'dependencies' : [threads, libblkid],
526 core_test_template + {
527 'sources' : files('test-manager.c'),
529 core_test_template + {
530 'sources' : files('test-namespace.c'),
536 core_test_template + {
537 'sources' : files('test-ns.c'),
538 'dependencies' : common_test_dependencies,
541 core_test_template + {
542 'sources' : files('test-path.c'),
543 'dependencies' : common_test_dependencies,
546 core_test_template + {
547 'sources' : files('test-sched-prio.c'),
548 'dependencies' : common_test_dependencies,
550 core_test_template + {
551 'sources' : files('test-socket-bind.c'),
552 'dependencies' : libdl,
553 'conditions' : ['BPF_FRAMEWORK'],
555 core_test_template + {
556 'sources' : files('test-tables.c'),
558 core_test_template + {
559 'sources' : files('test-unit-name.c'),
560 'dependencies' : common_test_dependencies,
562 core_test_template + {
563 'sources' : files('test-unit-serialize.c'),
564 'dependencies' : common_test_dependencies,
566 core_test_template + {
567 'sources' : files('test-watch-pid.c'),
568 'dependencies' : common_test_dependencies,
571 # Tests from other directories that have link_with deps that were not defined earlier
573 'sources' : files('../libsystemd/sd-bus/test-bus-error.c'),
580 'sources' : files('../libsystemd/sd-device/test-sd-device-thread.c'),
585 'dependencies' : threads,
588 'sources' : files('../libudev/test-udev-device-thread.c'),
593 'dependencies' : threads,
596 'sources' : files('../libudev/test-libudev.c'),