Systemd/src/test/meson.build

1199 lines
25 KiB
Meson
Raw Normal View History

# SPDX-License-Identifier: LGPL-2.1-or-later
awkscript = 'test-hashmap-ordered.awk'
test_hashmap_ordered_c = custom_target(
'test-hashmap-ordered.c',
input : [awkscript, 'test-hashmap-plain.c'],
output : 'test-hashmap-ordered.c',
command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true,
build_by_default : want_tests != 'false')
test_include_dir = include_directories('.')
path = run_command('sh', ['-c', 'echo "$PATH"']).stdout().strip()
test_env = environment()
test_env.set('SYSTEMD_KBD_MODEL_MAP', kbd_model_map)
test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
test_env.set('PATH', '@0@:@1@'.format(meson.build_root(), path))
############################################################
generate_sym_test_py = find_program('generate-sym-test.py')
test_libsystemd_sym_c = custom_target(
'test-libsystemd-sym.c',
input : [libsystemd_sym_path] + systemd_headers,
output : 'test-libsystemd-sym.c',
command : [generate_sym_test_py, libsystemd_sym_path] + systemd_headers,
capture : true,
build_by_default : want_tests != 'false')
test_libudev_sym_c = custom_target(
'test-libudev-sym.c',
input : [libudev_sym_path, libudev_h_path],
output : 'test-libudev-sym.c',
command : [generate_sym_test_py, '@INPUT0@', '@INPUT1@'],
capture : true,
build_by_default : want_tests != 'false')
test_dlopen_c = files('test-dlopen.c')
############################################################
test_systemd_tmpfiles_py = find_program('test-systemd-tmpfiles.py')
############################################################
tests += [
[['src/test/test-device-nodes.c'],
[],
[]],
[['src/test/test-engine.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid]],
[['src/test/test-emergency-action.c'],
[libcore,
libshared],
[]],
[['src/test/test-chown-rec.c'],
[libcore,
libshared],
[]],
[['src/test/test-dlopen-so.c'],
[libshared],
[]],
[['src/test/test-job-type.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid]],
[['src/test/test-ns.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid],
'', 'manual'],
[['src/test/test-loopback.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid]],
[['src/test/test-hostname.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid],
'', 'unsafe'],
[['src/test/test-dns-domain.c'],
[libcore,
libshared],
[]],
[['src/test/test-boot-timestamps.c'],
[],
[],
'ENABLE_EFI'],
[['src/test/test-unit-file.c'],
[],
[]],
[['src/test/test-unit-name.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid]],
[['src/test/test-load-fragment.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid]],
[['src/test/test-serialize.c'],
[],
[]],
[['src/test/test-utf8.c'],
[],
[]],
[['src/test/test-dev-setup.c'],
[],
[]],
[['src/test/test-capability.c'],
[],
[libcap]],
[['src/test/test-async.c'],
[],
[],
'', 'timeout=120'],
[['src/test/test-locale-util.c'],
[],
[]],
[['src/test/test-copy.c'],
[],
[]],
2018-12-03 13:37:18 +01:00
[['src/test/test-static-destruct.c'],
[],
[]],
[['src/test/test-sigbus.c'],
[],
[]],
[['src/test/test-condition.c'],
[],
[]],
[['src/test/test-fdset.c'],
[],
[]],
[['src/test/test-fstab-util.c'],
[],
[]],
[['src/test/test-random-util.c'],
[],
[]],
[['src/test/test-format-table.c'],
[],
[]],
2019-06-19 02:52:45 +02:00
[['src/test/test-format-util.c'],
[],
[]],
[['src/test/test-ratelimit.c'],
[],
[]],
[['src/test/test-util.c'],
[],
[]],
2018-07-04 15:42:04 +02:00
[['src/test/test-json.c'],
[],
[]],
test-libmount: let's see how libmount parses stuff With libmount-2.33.1-3.fc30.x86_64 I get: /* test_libmount_unescaping_one escaped space + utf8 */ from '729 38 0:59 / /tmp/\342\200\236zupa\\040z\304\231bowa\342\200\235 rw,relatime shared:395 - tmpfs die\\040Br\303\274he rw,seclabel' source: 'die Brühe' source: 'die Br\303\274he' source: 'die Brühe' expected: 'die Brühe' target: '/tmp/„zupa zębowa”' target: '/tmp/\342\200\236zupa z\304\231bowa\342\200\235' target: '/tmp/„zupa zębowa”' expected: '/tmp/„zupa zębowa”' /* test_libmount_unescaping_one escaped newline */ from '729 38 0:59 / /tmp/x\\012y rw,relatime shared:395 - tmpfs newline rw,seclabel' source: 'newline' source: 'newline' source: 'newline' expected: 'newline' target: '/tmp/x y' target: '/tmp/x\ny' target: '/tmp/x y' expected: '/tmp/x y' /* test_libmount_unescaping_one empty source */ from '760 38 0:60 / /tmp/emptysource rw,relatime shared:410 - tmpfs rw,seclabel' source: '' source: '' source: '' expected: '' target: '/tmp/emptysource' target: '/tmp/emptysource' target: '/tmp/emptysource' expected: '/tmp/emptysource' /* test_libmount_unescaping_one foo\rbar */ from '790 38 0:61 / /tmp/foo\rbar rw,relatime shared:425 - tmpfs tmpfs rw,seclabel' source: 'tmpfs' source: 'tmpfs' source: 'tmpfs' expected: 'tmpfs' target: '/tmp/foo' target: '/tmp/foo' target: '/tmp/foo' expected: 'n/a' With https://github.com/karelzak/util-linux/issues/780 fixed, we get /* test_libmount_unescaping_one foo\rbar */ from '790 38 0:61 / /tmp/foo\rbar rw,relatime shared:425 - tmpfs tmpfs rw,seclabel' source: 'tmpfs' source: 'tmpfs' source: 'tmpfs' expected: 'tmpfs' target: '/tmp/foo bar' target: '/tmp/foo\rbar' target: '/tmp/foo bar' expected: '/tmp/foo bar'
2019-04-05 09:43:12 +02:00
[['src/test/test-libmount.c'],
[],
[threads,
libmount]],
[['src/test/test-mount-util.c'],
[],
[]],
Split out part of mount-util.c into mountpoint-util.c The idea is that anything which is related to actually manipulating mounts is in mount-util.c, but functions for mountpoint introspection are moved to the new file. Anything which requires libmount must be in mount-util.c. This was supposed to be a preparation for further changes, with no functional difference, but it results in a significant change in linkage: $ ldd build/libnss_*.so.2 (before) build/libnss_myhostname.so.2: linux-vdso.so.1 (0x00007fff77bf5000) librt.so.1 => /lib64/librt.so.1 (0x00007f4bbb7b2000) libmount.so.1 => /lib64/libmount.so.1 (0x00007f4bbb755000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4bbb734000) libc.so.6 => /lib64/libc.so.6 (0x00007f4bbb56e000) /lib64/ld-linux-x86-64.so.2 (0x00007f4bbb8c1000) libblkid.so.1 => /lib64/libblkid.so.1 (0x00007f4bbb51b000) libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f4bbb512000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f4bbb4e3000) libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f4bbb45e000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f4bbb458000) build/libnss_mymachines.so.2: linux-vdso.so.1 (0x00007ffc19cc0000) librt.so.1 => /lib64/librt.so.1 (0x00007fdecb74b000) libcap.so.2 => /lib64/libcap.so.2 (0x00007fdecb744000) libmount.so.1 => /lib64/libmount.so.1 (0x00007fdecb6e7000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdecb6c6000) libc.so.6 => /lib64/libc.so.6 (0x00007fdecb500000) /lib64/ld-linux-x86-64.so.2 (0x00007fdecb8a9000) libblkid.so.1 => /lib64/libblkid.so.1 (0x00007fdecb4ad000) libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fdecb4a2000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fdecb475000) libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fdecb3f0000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fdecb3ea000) build/libnss_resolve.so.2: linux-vdso.so.1 (0x00007ffe8ef8e000) librt.so.1 => /lib64/librt.so.1 (0x00007fcf314bd000) libcap.so.2 => /lib64/libcap.so.2 (0x00007fcf314b6000) libmount.so.1 => /lib64/libmount.so.1 (0x00007fcf31459000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcf31438000) libc.so.6 => /lib64/libc.so.6 (0x00007fcf31272000) /lib64/ld-linux-x86-64.so.2 (0x00007fcf31615000) libblkid.so.1 => /lib64/libblkid.so.1 (0x00007fcf3121f000) libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fcf31214000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fcf311e7000) libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fcf31162000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fcf3115c000) build/libnss_systemd.so.2: linux-vdso.so.1 (0x00007ffda6d17000) librt.so.1 => /lib64/librt.so.1 (0x00007f610b83c000) libcap.so.2 => /lib64/libcap.so.2 (0x00007f610b835000) libmount.so.1 => /lib64/libmount.so.1 (0x00007f610b7d8000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f610b7b7000) libc.so.6 => /lib64/libc.so.6 (0x00007f610b5f1000) /lib64/ld-linux-x86-64.so.2 (0x00007f610b995000) libblkid.so.1 => /lib64/libblkid.so.1 (0x00007f610b59e000) libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f610b593000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f610b566000) libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f610b4e1000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f610b4db000) (after) build/libnss_myhostname.so.2: linux-vdso.so.1 (0x00007fff0b5e2000) librt.so.1 => /lib64/librt.so.1 (0x00007fde0c328000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fde0c307000) libc.so.6 => /lib64/libc.so.6 (0x00007fde0c141000) /lib64/ld-linux-x86-64.so.2 (0x00007fde0c435000) build/libnss_mymachines.so.2: linux-vdso.so.1 (0x00007ffdc30a7000) librt.so.1 => /lib64/librt.so.1 (0x00007f06ecabb000) libcap.so.2 => /lib64/libcap.so.2 (0x00007f06ecab4000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f06eca93000) libc.so.6 => /lib64/libc.so.6 (0x00007f06ec8cd000) /lib64/ld-linux-x86-64.so.2 (0x00007f06ecc15000) build/libnss_resolve.so.2: linux-vdso.so.1 (0x00007ffe95747000) librt.so.1 => /lib64/librt.so.1 (0x00007fa56a80f000) libcap.so.2 => /lib64/libcap.so.2 (0x00007fa56a808000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa56a7e7000) libc.so.6 => /lib64/libc.so.6 (0x00007fa56a621000) /lib64/ld-linux-x86-64.so.2 (0x00007fa56a964000) build/libnss_systemd.so.2: linux-vdso.so.1 (0x00007ffe67b51000) librt.so.1 => /lib64/librt.so.1 (0x00007ffb32113000) libcap.so.2 => /lib64/libcap.so.2 (0x00007ffb3210c000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffb320eb000) libc.so.6 => /lib64/libc.so.6 (0x00007ffb31f25000) /lib64/ld-linux-x86-64.so.2 (0x00007ffb3226a000) I don't quite understand what is going on here, but let's not be too picky.
2018-11-29 10:24:39 +01:00
[['src/test/test-mountpoint-util.c'],
[],
[]],
[['src/test/test-exec-util.c'],
[],
[]],
[['src/test/test-hexdecoct.c'],
[],
[]],
[['src/test/test-alloc-util.c'],
[],
[]],
[['src/test/test-xattr-util.c'],
[],
[]],
[['src/test/test-io-util.c'],
[],
[]],
[['src/test/test-glob-util.c'],
[],
[]],
[['src/test/test-fs-util.c'],
[],
[]],
2019-04-30 09:53:09 +02:00
[['src/test/test-umask-util.c'],
[],
[]],
[['src/test/test-proc-cmdline.c'],
[],
[]],
[['src/test/test-fd-util.c'],
[],
[]],
[['src/test/test-web-util.c'],
[],
[]],
[['src/test/test-cpu-set-util.c'],
[],
[]],
[['src/test/test-stat-util.c'],
[],
[]],
[['src/test/test-os-util.c'],
[],
[]],
shared/libcrypt-util: use libcrypt_ra() This lets the libc/xcrypt allocate as much storage area as it needs. Should fix #16965: testsuite-46.sh[74]: ==74==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f3e972e1080 at pc 0x7f3e9be8deed bp 0x7ffce4f28530 sp 0x7ffce4f27ce0 testsuite-46.sh[74]: WRITE of size 131232 at 0x7f3e972e1080 thread T0 testsuite-46.sh[74]: #0 0x7f3e9be8deec (/usr/lib/clang/10.0.1/lib/linux/libclang_rt.asan-x86_64.so+0x9feec) testsuite-46.sh[74]: #1 0x559cd05a6412 in user_record_make_hashed_password /systemd-meson-build/../build/src/home/user-record-util.c:818:21 testsuite-46.sh[74]: #2 0x559cd058fb03 in create_home /systemd-meson-build/../build/src/home/homectl.c:1112:29 testsuite-46.sh[74]: #3 0x7f3e9b5b3058 in dispatch_verb /systemd-meson-build/../build/src/shared/verbs.c:103:24 testsuite-46.sh[74]: #4 0x559cd058c101 in run /systemd-meson-build/../build/src/home/homectl.c:3325:16 testsuite-46.sh[74]: #5 0x559cd058c00a in main /systemd-meson-build/../build/src/home/homectl.c:3328:1 testsuite-46.sh[74]: #6 0x7f3e9a88b151 in __libc_start_main (/usr/lib/libc.so.6+0x28151) testsuite-46.sh[74]: #7 0x559cd0583e7d in _start (/usr/bin/homectl+0x24e7d) testsuite-46.sh[74]: Address 0x7f3e972e1080 is located in stack of thread T0 at offset 32896 in frame testsuite-46.sh[74]: #0 0x559cd05a60df in user_record_make_hashed_password /systemd-meson-build/../build/src/home/user-record-util.c:789 testsuite-46.sh[74]: This frame has 6 object(s): testsuite-46.sh[74]: [32, 40) 'priv' (line 790) testsuite-46.sh[74]: [64, 72) 'np' (line 791) testsuite-46.sh[74]: [96, 104) 'salt' (line 809) testsuite-46.sh[74]: [128, 32896) 'cd' (line 810) testsuite-46.sh[74]: [33152, 33168) '.compoundliteral' <== Memory access at offset 32896 partially underflows this variable testsuite-46.sh[74]: [33184, 33192) 'new_array' (line 832) <== Memory access at offset 32896 partially underflows this variable testsuite-46.sh[74]: HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork testsuite-46.sh[74]: (longjmp and C++ exceptions *are* supported) testsuite-46.sh[74]: SUMMARY: AddressSanitizer: stack-buffer-overflow (/usr/lib/clang/10.0.1/lib/linux/libclang_rt.asan-x86_64.so+0x9feec) It seems 'struct crypt_data' is 32896 bytes, but libclang_rt wants more, at least 33168?
2020-09-08 15:13:44 +02:00
[['src/test/test-libcrypt-util.c'],
[],
[],
'', 'timeout=120'],
shared/libcrypt-util: use libcrypt_ra() This lets the libc/xcrypt allocate as much storage area as it needs. Should fix #16965: testsuite-46.sh[74]: ==74==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f3e972e1080 at pc 0x7f3e9be8deed bp 0x7ffce4f28530 sp 0x7ffce4f27ce0 testsuite-46.sh[74]: WRITE of size 131232 at 0x7f3e972e1080 thread T0 testsuite-46.sh[74]: #0 0x7f3e9be8deec (/usr/lib/clang/10.0.1/lib/linux/libclang_rt.asan-x86_64.so+0x9feec) testsuite-46.sh[74]: #1 0x559cd05a6412 in user_record_make_hashed_password /systemd-meson-build/../build/src/home/user-record-util.c:818:21 testsuite-46.sh[74]: #2 0x559cd058fb03 in create_home /systemd-meson-build/../build/src/home/homectl.c:1112:29 testsuite-46.sh[74]: #3 0x7f3e9b5b3058 in dispatch_verb /systemd-meson-build/../build/src/shared/verbs.c:103:24 testsuite-46.sh[74]: #4 0x559cd058c101 in run /systemd-meson-build/../build/src/home/homectl.c:3325:16 testsuite-46.sh[74]: #5 0x559cd058c00a in main /systemd-meson-build/../build/src/home/homectl.c:3328:1 testsuite-46.sh[74]: #6 0x7f3e9a88b151 in __libc_start_main (/usr/lib/libc.so.6+0x28151) testsuite-46.sh[74]: #7 0x559cd0583e7d in _start (/usr/bin/homectl+0x24e7d) testsuite-46.sh[74]: Address 0x7f3e972e1080 is located in stack of thread T0 at offset 32896 in frame testsuite-46.sh[74]: #0 0x559cd05a60df in user_record_make_hashed_password /systemd-meson-build/../build/src/home/user-record-util.c:789 testsuite-46.sh[74]: This frame has 6 object(s): testsuite-46.sh[74]: [32, 40) 'priv' (line 790) testsuite-46.sh[74]: [64, 72) 'np' (line 791) testsuite-46.sh[74]: [96, 104) 'salt' (line 809) testsuite-46.sh[74]: [128, 32896) 'cd' (line 810) testsuite-46.sh[74]: [33152, 33168) '.compoundliteral' <== Memory access at offset 32896 partially underflows this variable testsuite-46.sh[74]: [33184, 33192) 'new_array' (line 832) <== Memory access at offset 32896 partially underflows this variable testsuite-46.sh[74]: HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork testsuite-46.sh[74]: (longjmp and C++ exceptions *are* supported) testsuite-46.sh[74]: SUMMARY: AddressSanitizer: stack-buffer-overflow (/usr/lib/clang/10.0.1/lib/linux/libclang_rt.asan-x86_64.so+0x9feec) It seems 'struct crypt_data' is 32896 bytes, but libclang_rt wants more, at least 33168?
2020-09-08 15:13:44 +02:00
[['src/test/test-offline-passwd.c',
'src/shared/offline-passwd.c',
'src/shared/offline-passwd.h'],
[],
[]],
[['src/test/test-escape.c'],
[],
[]],
[['src/test/test-exit-status.c'],
[],
[]],
[['src/test/test-specifier.c'],
[],
[]],
[['src/test/test-string-util.c'],
[],
[]],
[['src/test/test-extract-word.c'],
[],
[]],
[['src/test/test-parse-util.c'],
[],
meson: Fix missing libseccomp dependencies The builds with HAVE_SECCOMP fail on missing include paths: FAILED: src/basic/libbasic.a.p/parse-util.c.o cc -Isrc/basic/libbasic.a.p -Isrc/basic -I../src/basic -Isrc/boot -I../src/boot -Isrc/home -I../src/home -Isrc/shared -I../src/shared -Isrc/systemd -I../src/systemd -Isrc/journal -I../src/journal -Isrc/journal-remote -I../src/journal-remote -Isrc/nspawn -I../src/nspawn -Isrc/resolve -I../src/resolve -Isrc/timesync -I../src/timesync -I../src/time-wait-sync -Isrc/login -I../src/login -Isrc/udev -I../src/udev -Isrc/libudev -I../src/libudev -Isrc/core -I../src/core -Isrc/shutdown -I../src/shutdown -I../src/xdg-autostart-generator -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/libsystemd-network -I../src/libsystemd-network -I. -I.. -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -g -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Wno-format-signedness -Werror=undef -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=format=2 -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wimplicit-fallthrough=5 -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Werror=overflow -Werror=shift-count-overflow -Werror=shift-overflow=2 -Wdate-time -Wnested-externs -Wno-maybe-uninitialized -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=shadow -include config.h -fPIC -pthread -fvisibility=default -MD -MQ src/basic/libbasic.a.p/parse-util.c.o -MF src/basic/libbasic.a.p/parse-util.c.o.d -o src/basic/libbasic.a.p/parse-util.c.o -c ../src/basic/parse-util.c In file included from ../src/basic/parse-util.c:20: ../src/shared/seccomp-util.h:4:10: fatal error: seccomp.h: No such file or directory 4 | #include <seccomp.h> | ^~~~~~~~~~~ compilation terminated. FAILED: test-parse-util.p/src_test_test-parse-util.c.o cc -Itest-parse-util.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/boot -I../src/boot -Isrc/home -I../src/home -Isrc/shared -I../src/shared -Isrc/systemd -I../src/systemd -Isrc/journal -I../src/journal -Isrc/journal-remote -I../src/journal-remote -Isrc/nspawn -I../src/nspawn -Isrc/resolve -I../src/resolve -Isrc/timesync -I../src/timesync -I../src/time-wait-sync -Isrc/login -I../src/login -Isrc/udev -I../src/udev -Isrc/libudev -I../src/libudev -Isrc/core -I../src/core -Isrc/shutdown -I../src/shutdown -I../src/xdg-autostart-generator -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/libsystemd-network -I../src/libsystemd-network -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -g -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Wno-format-signedness -Werror=undef -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=format=2 -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wimplicit-fallthrough=5 -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Werror=overflow -Werror=shift-count-overflow -Werror=shift-overflow=2 -Wdate-time -Wnested-externs -Wno-maybe-uninitialized -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=shadow -include config.h -MD -MQ test-parse-util.p/src_test_test-parse-util.c.o -MF test-parse-util.p/src_test_test-parse-util.c.o.d -o test-parse-util.p/src_test_test-parse-util.c.o -c ../src/test/test-parse-util.c In file included from ../src/test/test-parse-util.c:14: ../src/shared/seccomp-util.h:4:10: fatal error: seccomp.h: No such file or directory 4 | #include <seccomp.h> | ^~~~~~~~~~~ compilation terminated. Add the respective deps. Fixes: 005bfaf118 ("exec: Add kill action to system call filters")
2020-10-15 17:56:30 +02:00
[libseccomp]],
[['src/test/test-sysctl-util.c'],
[],
[]],
[['src/test/test-user-record.c'],
[],
[]],
[['src/test/test-user-util.c'],
[],
[]],
[['src/test/test-hostname-util.c'],
[],
[]],
[['src/test/test-process-util.c'],
[],
[]],
[['src/test/test-terminal-util.c'],
[],
[]],
[['src/test/test-path-lookup.c'],
[],
[]],
[['src/test/test-pretty-print.c'],
[],
[]],
[['src/test/test-uid-range.c'],
[],
[]],
[['src/test/test-cap-list.c',
generated_gperf_headers],
[],
[libcap]],
[['src/test/test-socket-util.c'],
[],
[]],
[['src/test/test-socket-netlink.c'],
[],
[]],
[['src/test/test-in-addr-util.c'],
[],
[]],
[['src/test/test-barrier.c'],
[],
[]],
[['src/test/test-tmpfiles.c'],
[],
[]],
[['src/test/test-namespace.c'],
[libcore,
libshared],
[threads,
libblkid]],
[['src/test/test-verbs.c'],
[],
[]],
[['src/test/test-install-root.c'],
[],
[]],
[['src/test/test-acl-util.c'],
[],
[],
'HAVE_ACL'],
[['src/test/test-seccomp.c'],
[],
[libseccomp],
'HAVE_SECCOMP'],
[['src/test/test-rlimit-util.c'],
[],
[]],
[['src/test/test-ask-password-api.c'],
[],
[],
'', 'manual'],
[['src/test/test-signal-util.c'],
[],
[]],
[['src/test/test-loop-block.c'],
[libcore,
libshared],
[threads,
libblkid],
'',
'',
[],
includes,
false],
[['src/test/test-selinux.c'],
[],
[]],
[['src/test/test-sizeof.c'],
[libbasic],
[]],
[['src/test/test-bpf-devices.c'],
2016-11-03 17:31:25 +01:00
[libcore,
libshared],
[libmount,
threads,
librt,
libseccomp,
libselinux,
libblkid]],
[['src/test/test-bpf-firewall.c'],
2016-11-03 17:31:25 +01:00
[libcore,
libshared],
[libmount,
threads,
librt,
libseccomp,
libselinux,
libblkid]],
[['src/test/test-watch-pid.c'],
core: rework how we track which PIDs to watch for a unit Previously, we'd maintain two hashmaps keyed by PIDs, pointing to Unit interested in SIGCHLD events for them. This scheme allowed a specific PID to be watched by exactly 0, 1 or 2 units. With this rework this is replaced by a single hashmap which is primarily keyed by the PID and points to a Unit interested in it. However, it optionally also keyed by the negated PID, in which case it points to a NULL terminated array of additional Unit objects also interested. This scheme means arbitrary numbers of Units may now watch the same PID. Runtime and memory behaviour should not be impact by this change, as for the common case (i.e. each PID only watched by a single unit) behaviour stays the same, but for the uncommon case (a PID watched by more than one unit) we only pay with a single additional memory allocation for the array. Why this all? Primarily, because allowing exactly two units to watch a specific PID is not sufficient for some niche cases, as processes can belong to more than one unit these days: 1. sd_notify() with MAINPID= can be used to attach a process from a different cgroup to multiple units. 2. Similar, the PIDFile= setting in unit files can be used for similar setups, 3. By creating a scope unit a main process of a service may join a different unit, too. 4. On cgroupsv1 we frequently end up watching all processes remaining in a scope, and if a process opens lots of scopes one after the other it might thus end up being watch by many of them. This patch hence removes the 2-unit-per-PID limit. It also makes a couple of other changes, some of them quite relevant: - manager_get_unit_by_pid() (and the bus call wrapping it) when there's ambiguity will prefer returning the Unit the process belongs to based on cgroup membership, and only check the watch-pids hashmap if that fails. This change in logic is probably more in line with what people expect and makes things more stable as each process can belong to exactly one cgroup only. - Every SIGCHLD event is now dispatched to all units interested in its PID. Previously, there was some magic conditionalization: the SIGCHLD would only be dispatched to the unit if it was only interested in a single PID only, or the PID belonged to the control or main PID or we didn't dispatch a signle SIGCHLD to the unit in the current event loop iteration yet. These rules were quite arbitrary and also redundant as the the per-unit handlers would filter the PIDs anyway a second time. With this change we'll hence relax the rules: all we do now is dispatch every SIGCHLD event exactly once to each unit interested in it, and it's up to the unit to then use or ignore this. We use a generation counter in the unit to ensure that we only invoke the unit handler once for each event, protecting us from confusion if a unit is both associated with a specific PID through cgroup membership and through the "watch_pids" logic. It also protects us from being confused if the "watch_pids" hashmap is altered while we are dispatching to it (which is a very likely case). - sd_notify() message dispatching has been reworked to be very similar to SIGCHLD handling now. A generation counter is used for dispatching as well. This also adds a new test that validates that "watch_pid" registration and unregstration works correctly.
2018-01-12 13:41:05 +01:00
[libcore,
libshared],
[libmount,
threads,
librt,
libseccomp,
libselinux,
libblkid]],
[['src/test/test-hashmap.c',
'src/test/test-hashmap-plain.c',
test_hashmap_ordered_c],
[],
[],
'', 'timeout=90'],
[['src/test/test-set.c'],
[libbasic],
[]],
[['src/test/test-ordered-set.c'],
[],
[]],
[['src/test/test-set-disable-mempool.c'],
[],
[threads]],
[['src/test/test-bitmap.c'],
[],
[]],
[['src/test/test-xml.c'],
[],
[]],
[['src/test/test-list.c'],
[],
[]],
[['src/test/test-procfs-util.c'],
[],
[]],
[['src/test/test-unaligned.c'],
[],
[]],
[['src/test/test-tables.c',
'src/shared/test-tables.h',
'src/journal/journald-server.c',
'src/journal/journald-server.h'],
[libcore,
libjournal_core,
2020-12-14 12:41:32 +01:00
libudevd_core,
libshared],
[threads,
libseccomp,
libmount,
libxz,
liblz4,
libblkid],
2020-12-14 12:41:32 +01:00
'', '', [], libudevd_core_includes],
[['src/test/test-prioq.c'],
[],
[]],
[['src/test/test-fileio.c'],
[],
[]],
[['src/test/test-time-util.c'],
[],
[]],
[['src/test/test-clock.c'],
[],
[]],
[['src/test/test-architecture.c'],
[],
[]],
[['src/test/test-log.c'],
[],
[]],
[['src/test/test-ipcrm.c'],
[],
[],
'', 'unsafe'],
[['src/test/test-btrfs.c'],
[],
[],
'', 'manual'],
[['src/test/test-firewall-util.c'],
2017-04-26 22:14:23 +02:00
[libshared],
[],
'HAVE_LIBIPTC'],
[['src/test/test-netlink-manual.c'],
[],
[libkmod],
'HAVE_KMOD', 'manual'],
[['src/test/test-ellipsize.c'],
[],
[]],
[['src/test/test-date.c'],
[],
[]],
[['src/test/test-sleep.c'],
[],
[]],
[['src/test/test-replace-var.c'],
[],
[]],
[['src/test/test-calendarspec.c'],
[],
[]],
[['src/test/test-strip-tab-ansi.c'],
[],
[]],
[['src/test/test-coredump-util.c'],
[],
[]],
[['src/test/test-daemon.c'],
[],
[]],
[['src/test/test-cgroup.c'],
[],
2020-03-10 11:22:11 +01:00
[]],
[['src/test/test-cgroup-cpu.c'],
[libcore,
libshared],
[]],
[['src/test/test-cgroup-unit-default.c'],
cgroup: Implement default propagation of MemoryLow with DefaultMemoryLow In cgroup v2 we have protection tunables -- currently MemoryLow and MemoryMin (there will be more in future for other resources, too). The design of these protection tunables requires not only intermediate cgroups to propagate protections, but also the units at the leaf of that resource's operation to accept it (by setting MemoryLow or MemoryMin). This makes sense from an low-level API design perspective, but it's a good idea to also have a higher-level abstraction that can, by default, propagate these resources to children recursively. In this patch, this happens by having descendants set memory.low to N if their ancestor has DefaultMemoryLow=N -- assuming they don't set a separate MemoryLow value. Any affected unit can opt out of this propagation by manually setting `MemoryLow` to some value in its unit configuration. A unit can also stop further propagation by setting `DefaultMemoryLow=` with no argument. This removes further propagation in the subtree, but has no effect on the unit itself (for that, use `MemoryLow=0`). Our use case in production is simplifying the configuration of machines which heavily rely on memory protection tunables, but currently require tweaking a huge number of unit files to make that a reality. This directive makes that significantly less fragile, and decreases the risk of misconfiguration. After this patch is merged, I will implement DefaultMemoryMin= using the same principles.
2019-03-28 13:50:50 +01:00
[libcore,
libshared],
[]],
[['src/test/test-cgroup-mask.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid]],
2019-04-11 18:47:10 +02:00
[['src/test/test-varlink.c'],
[],
[threads]],
[['src/test/test-cgroup-util.c'],
[],
[]],
[['src/test/test-cgroup-setup.c'],
[],
[]],
[['src/test/test-env-file.c'],
[],
[]],
[['src/test/test-env-util.c'],
[],
[]],
[['src/test/test-strbuf.c'],
[],
[]],
[['src/test/test-strv.c'],
[],
[]],
[['src/test/test-path-util.c'],
[],
[]],
[['src/test/test-rm-rf.c'],
[],
[]],
[['src/test/test-chase-symlinks.c'],
[],
[],
'', 'manual'],
[['src/test/test-path.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid],
'', 'timeout=120'],
[['src/test/test-execute.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid],
'', 'timeout=360'],
[['src/test/test-siphash24.c'],
[],
[]],
[['src/test/test-strxcpyx.c'],
[],
[]],
[['src/test/test-install.c'],
[libcore,
libshared],
[],
'', 'manual'],
[['src/test/test-watchdog.c'],
[],
[]],
[['src/test/test-sched-prio.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid]],
[['src/test/test-conf-files.c'],
[],
[]],
[['src/test/test-conf-parser.c'],
[],
[]],
[['src/test/test-af-list.c',
generated_gperf_headers],
[],
[]],
[['src/test/test-arphrd-list.c',
generated_gperf_headers],
[],
[]],
[['src/test/test-ip-protocol-list.c',
shared_generated_gperf_headers],
[],
[]],
[['src/test/test-journal-importer.c'],
[],
[]],
[['src/test/test-libudev.c'],
2020-12-14 12:41:32 +01:00
[libshared,
libudev_static],
[],
'', '', [], libudev_includes],
[['src/test/test-udev.c'],
2020-12-14 12:41:32 +01:00
[libudevd_core,
libshared],
[threads,
librt,
libblkid,
libkmod,
libacl,
libselinux],
'', 'manual', '-DLOG_REALM=LOG_REALM_UDEV'],
2020-10-20 18:38:44 +02:00
[['src/test/test-udev-util.c'],
[],
[]],
[['src/test/test-id128.c'],
[],
[]],
[['src/test/test-hash.c'],
[],
[]],
[['src/test/test-gcrypt-util.c'],
[],
[],
'HAVE_GCRYPT'],
[['src/test/test-nss.c'],
[],
[libdl],
'ENABLE_NSS', 'manual'],
[['src/test/test-umount.c',
'src/shutdown/umount.c',
'src/shutdown/umount.h'],
[libcore_shared,
libshared],
[libmount]],
[['src/test/test-bus-util.c'],
[],
[]],
[['src/test/test-sd-hwdb.c'],
[],
[]],
[['src/test/test-sd-path.c'],
[],
[]],
[['src/test/test-local-addresses.c'],
[],
[]],
[['src/test/test-psi-util.c'],
[],
[]],
[['src/test/test-qrcode-util.c'],
[libshared],
[libdl]],
]
if conf.get('ENABLE_NSCD') == 1
tests += [
[['src/test/test-nscd-flush.c'],
[libcore,
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid],
'', 'manual']]
endif
############################################################
# define some tests here, because the link_with deps were not defined earlier
tests += [
[['src/journal/test-journal.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-journal-send.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-journal-syslog.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4,
libselinux]],
[['src/journal/test-journal-match.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-journal-enum.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4],
'', 'timeout=360'],
[['src/journal/test-journal-stream.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-journal-flush.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-journal-init.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-journal-config.c'],
[libjournal_core,
libshared],
[libxz,
liblz4,
libselinux]],
[['src/journal/test-journal-verify.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-journal-interleaving.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-mmap-cache.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-catalog.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4]],
[['src/journal/test-compress.c'],
[libjournal_core,
libshared],
[liblz4,
libzstd,
libxz]],
[['src/journal/test-compress-benchmark.c'],
[libjournal_core,
libshared],
[liblz4,
libzstd,
libxz],
'', 'timeout=90'],
[['src/journal/test-audit-type.c'],
[libjournal_core,
libshared],
[liblz4,
libxz]],
]
############################################################
tests += [
[['src/libsystemd/sd-bus/test-bus-address.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-marshal.c'],
[],
[threads,
libglib,
libgobject,
libgio,
libdbus]],
[['src/libsystemd/sd-bus/test-bus-signature.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-queue-ref-cycle.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-watch-bind.c'],
[],
[threads], '', 'timeout=120'],
[['src/libsystemd/sd-bus/test-bus-chat.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-cleanup.c'],
[],
[threads,
libseccomp]],
[['src/libsystemd/sd-bus/test-bus-error.c'],
[libshared_static,
libsystemd_static],
[]],
[['src/libsystemd/sd-bus/test-bus-track.c'],
[],
[libseccomp]],
[['src/libsystemd/sd-bus/test-bus-server.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-objects.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-vtable.c',
'src/libsystemd/sd-bus/test-vtable-data.h'],
[],
[]],
[['src/libsystemd/sd-bus/test-bus-gvariant.c'],
[],
[libglib,
libgobject,
libgio]],
[['src/libsystemd/sd-bus/test-bus-creds.c'],
[],
[]],
[['src/libsystemd/sd-bus/test-bus-match.c'],
[],
[]],
[['src/libsystemd/sd-bus/test-bus-benchmark.c'],
[],
[threads],
'', 'manual'],
[['src/libsystemd/sd-bus/test-bus-introspect.c',
'src/libsystemd/sd-bus/test-vtable-data.h'],
[],
[]],
[['src/libsystemd/sd-event/test-event.c'],
[],
[]],
[['src/libsystemd/sd-netlink/test-netlink.c'],
[],
[]],
[['src/libsystemd/sd-resolve/test-resolve.c'],
[],
[threads],
'', 'timeout=120'],
[['src/libsystemd/sd-login/test-login.c'],
[],
[]],
2018-09-28 13:52:48 +02:00
[['src/libsystemd/sd-device/test-sd-device.c'],
[],
[]],
[['src/libsystemd/sd-device/test-sd-device-thread.c'],
[libbasic,
libshared_static,
libsystemd],
[threads]],
[['src/libsystemd/sd-device/test-udev-device-thread.c'],
[libbasic,
libshared_static,
libudev],
2020-12-14 12:41:32 +01:00
[threads],
'', '', [], libudev_includes],
2018-10-19 04:58:25 +02:00
[['src/libsystemd/sd-device/test-sd-device-monitor.c'],
[],
[]],
]
if cxx_cmd != ''
tests += [
[['src/libsystemd/sd-bus/test-bus-vtable-cc.cc'],
[],
[]]
]
endif
############################################################
tests += [
[['src/libsystemd-network/test-dhcp-option.c',
'src/libsystemd-network/dhcp-protocol.h',
'src/libsystemd-network/dhcp-internal.h'],
[libshared,
libsystemd_network],
[]],
[['src/libsystemd-network/test-sd-dhcp-lease.c',
'src/libsystemd-network/dhcp-lease-internal.h'],
[libshared,
libsystemd_network],
[]],
[['src/libsystemd-network/test-dhcp-client.c',
'src/libsystemd-network/dhcp-protocol.h',
'src/libsystemd-network/dhcp-internal.h',
'src/systemd/sd-dhcp-client.h'],
[libshared,
libsystemd_network],
[]],
[['src/libsystemd-network/test-dhcp-server.c'],
[libshared,
libsystemd_network],
[]],
[['src/libsystemd-network/test-ipv4ll.c',
'src/libsystemd-network/arp-util.h',
'src/systemd/sd-ipv4ll.h'],
[libshared,
libsystemd_network],
[]],
[['src/libsystemd-network/test-ipv4ll-manual.c',
'src/systemd/sd-ipv4ll.h'],
[libshared,
libsystemd_network],
[],
'', 'manual'],
[['src/libsystemd-network/test-acd.c',
'src/systemd/sd-ipv4acd.h'],
[libshared,
libsystemd_network],
[],
'', 'manual'],
[['src/libsystemd-network/test-ndisc-rs.c',
'src/libsystemd-network/dhcp-identifier.h',
'src/libsystemd-network/dhcp-identifier.c',
'src/libsystemd-network/icmp6-util.h',
'src/systemd/sd-dhcp6-client.h',
'src/systemd/sd-ndisc.h'],
[libshared,
libsystemd_network],
[]],
2017-05-11 15:19:21 +02:00
[['src/libsystemd-network/test-ndisc-ra.c',
'src/libsystemd-network/icmp6-util.h',
'src/systemd/sd-ndisc.h'],
[libshared,
libsystemd_network],
[]],
[['src/libsystemd-network/test-dhcp6-client.c',
'src/libsystemd-network/dhcp-identifier.h',
'src/libsystemd-network/dhcp-identifier.c',
'src/libsystemd-network/dhcp6-internal.h',
'src/systemd/sd-dhcp6-client.h'],
[libshared,
libsystemd_network],
[]],
[['src/libsystemd-network/test-lldp.c'],
[libshared,
libsystemd_network],
[]],
]
############################################################
tests += [
[['src/login/test-login-shared.c'],
[],
[]],
[['src/analyze/test-verify.c', 'src/analyze/analyze-verify.c', 'src/analyze/analyze-verify.h'],
[libcore, libshared],
[]],
[['src/login/test-inhibit.c'],
[],
[],
'', 'manual'],
[['src/login/test-login-tables.c'],
[liblogind_core,
libshared],
[threads]],
]
############################################################
tests += [
[['src/test/test-xdg-autostart.c',
'src/xdg-autostart-generator/xdg-autostart-service.c',
'src/xdg-autostart-generator/xdg-autostart-service.h',],
[],
[]],
]