Files
systemd/src/test/meson.build

678 lines
22 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(
input : [awkscript, 'test-hashmap-plain.c'],
output : 'test-hashmap-ordered.c',
command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true,
build_by_default : want_tests != 'false')
generated_sources += test_hashmap_ordered_c
path = run_command(sh, '-c', 'echo "$PATH"', check: true).stdout().strip()
test_env = {
'PATH' : meson.project_build_root() + ':' + path,
'PROJECT_BUILD_ROOT' : meson.project_build_root(),
'SYSTEMD_DEFAULT_LOCALE' : get_option('default-locale'),
'SYSTEMD_SLOW_TESTS' : want_slow_tests ? '1' : '0',
'PYTHONDONTWRITEBYTECODE' : '1',
'SYSTEMD_LIBC' : get_option('libc'),
}
if conf.get('ENABLE_LOCALED') == 1
test_env += {'SYSTEMD_LANGUAGE_FALLBACK_MAP' : language_fallback_map}
endif
############################################################
generate_sym_test_py = files('generate-sym-test.py')
test_libsystemd_sym_c = custom_target(
input : [libsystemd_sym_path,
systemd_headers,
libsystemd_sources],
output : 'test-libsystemd-sym.c',
command : [generate_sym_test_py,
libsystemd_sym_path,
libsystemd_dir_path,
systemd_headers],
capture : true,
build_by_default : want_tests != 'false')
test_libudev_sym_c = custom_target(
input : [libudev_sym_path,
libudev_h_path,
libudev_sources],
output : 'test-libudev-sym.c',
command : [generate_sym_test_py,
libudev_sym_path,
libudev_dir_path,
libudev_h_path],
capture : true,
build_by_default : want_tests != 'false')
generated_sources += [test_libsystemd_sym_c, test_libudev_sym_c]
############################################################
simple_tests += files(
'test-alloc-util.c',
'test-architecture.c',
'test-argv-util.c',
'test-audit-util.c',
'test-barrier.c',
'test-binfmt-util.c',
'test-bitfield.c',
'test-bitmap.c',
'test-blockdev-util.c',
'test-bootspec.c',
basic: add "build path" logic We have a number of components these days that are split into multiple binaries, i.e. a primary one, and a worker callout usually. These binaries are closely related, they typically speak a protocol that is internal, and not safe to mix and match. Examples for this: - homed and its worker binary homework - userdbd and its worker binary userwork - import and the various pull/import/export handlers - sysupdate the same - the service manager and the executor binary Running any of these daemons directly from the meson build tree is messy, since the implementations will typically invoke the installed callout binaries, not the ones from the build tree. This is very annoying, and not obvious at first. Now, we could always invoke relevant binaries from $(dirname /proc/self/exe) first, before using the OS installed ones. But that's typically not what is desired, because this means in the installed case (i.e. the usual one) we'll look for these callout binaries at a place they typically will not be found (because these callouts generally are located in libexecdir, not bindir when installed). Hence, let's try to do things a bit smarter, and follow what build systems such as meson have already been doing to make sure dynamic library discovery works correctly when binaries are run from a build directory: let's start looking at rpath/runpath in the main binary that is executed: if there's an rpath/runpath set, then we'll look for the callout binaries next to the main binary, otherwise we won't. This should generally be the right thing to do as meson strips the rpath during installation, and thus we'll look for the callouts in the build dir if in build dir mode, and in the OS otherwise.
2024-02-20 11:30:27 +01:00
'test-build-path.c',
'test-bus-unit-util.c',
'test-bus-util.c',
'test-calendarspec.c',
'test-capability-list.c',
'test-capability-util.c',
'test-cgroup-setup.c',
'test-cgroup-util.c',
'test-chase.c',
2024-11-06 23:06:32 +03:00
'test-chid.c',
'test-clock.c',
'test-color-util.c',
2023-03-19 16:11:15 +00:00
'test-compare-operator.c',
'test-condition.c',
'test-conf-files.c',
'test-conf-parser.c',
'test-copy.c',
'test-coredump-util.c',
'test-cpu-set-util.c',
'test-creds.c',
'test-daemon.c',
'test-data-fd-util.c',
'test-date.c',
'test-dev-setup.c',
'test-device-nodes.c',
'test-devnum-util.c',
'test-dirent-util.c',
'test-dns-domain.c',
'test-ellipsize.c',
'test-env-file.c',
'test-env-util.c',
'test-errno-util.c',
'test-escape.c',
'test-ether-addr-util.c',
'test-exec-util.c',
'test-execve.c',
'test-exit-status.c',
'test-extract-word.c',
'test-fdset.c',
'test-fiemap.c',
'test-fileio.c',
'test-firewall-util.c',
'test-format-table.c',
'test-format-util.c',
'test-fs-util.c',
'test-fstab-util.c',
'test-glob-util.c',
'test-gpt.c',
'test-gunicode.c',
'test-hash-funcs.c',
'test-hexdecoct.c',
'test-hmac.c',
'test-hostname-setup.c',
'test-hostname-util.c',
'test-id128.c',
'test-image-filter.c',
'test-image-policy.c',
'test-import-util.c',
'test-in-addr-prefix-util.c',
'test-in-addr-util.c',
'test-install-file.c',
'test-install-root.c',
'test-io-util.c',
'test-iovec-util.c',
'test-journal-importer.c',
'test-kbd-util.c',
2024-03-13 16:47:28 +01:00
'test-label.c',
'test-limits-util.c',
'test-list.c',
'test-local-addresses.c',
'test-locale-util.c',
2023-03-09 12:59:09 +01:00
'test-lock-util.c',
'test-log.c',
'test-logarithm.c',
2024-03-08 17:11:14 +05:30
'test-login-util.c',
'test-macro.c',
'test-memfd-util.c',
'test-memory-util.c',
'test-mempool.c',
'test-memstream-util.c',
'test-mkdir.c',
'test-modhex.c',
'test-mountpoint-util.c',
'test-net-naming-scheme.c',
'test-notify-recv.c',
2025-03-11 06:06:40 +01:00
'test-nsresource.c',
'test-nulstr-util.c',
'test-open-file.c',
'test-ordered-set.c',
'test-os-util.c',
'test-osc-context.c',
'test-parse-argument.c',
'test-parse-helpers.c',
'test-path-lookup.c',
'test-path-util.c',
'test-percent-util.c',
2024-01-23 19:23:37 +09:00
'test-pidref.c',
'test-pretty-print.c',
'test-prioq.c',
'test-proc-cmdline.c',
'test-procfs-util.c',
'test-psi-util.c',
'test-ratelimit.c',
'test-raw-clone.c',
'test-recovery-key.c',
'test-recurse-dir.c',
'test-replace-var.c',
'test-rlimit-util.c',
'test-rm-rf.c',
'test-sd-hwdb.c',
'test-sd-path.c',
'test-secure-bits.c',
'test-serialize.c',
'test-set.c',
2024-10-11 16:30:43 +03:00
'test-sha1.c',
'test-sha256.c',
'test-sigbus.c',
'test-signal-util.c',
'test-siphash24.c',
'test-sleep-config.c',
'test-socket-netlink.c',
'test-socket-util.c',
'test-specifier.c',
'test-stat-util.c',
'test-static-destruct.c',
'test-strbuf.c',
'test-string-util.c',
'test-strip-tab-ansi.c',
'test-strv.c',
'test-strxcpyx.c',
'test-sysctl-util.c',
'test-terminal-util.c',
'test-tests.c',
'test-tmpfile-util.c',
'test-udev-util.c',
'test-uid-classification.c',
'test-uid-range.c',
'test-umask-util.c',
'test-unaligned.c',
'test-unit-file.c',
'test-user-record.c',
'test-user-util.c',
'test-utf8.c',
'test-verbs.c',
'test-vpick.c',
'test-web-util.c',
'test-xattr-util.c',
'test-xml.c',
)
############################################################
common_test_dependencies = [
2025-09-24 22:36:30 +02:00
libmount_cflags,
librt,
libseccomp_cflags,
2025-09-08 18:31:49 +02:00
libselinux_cflags,
threads,
]
executables += [
test_template + {
'sources' : files('test-acl-util.c'),
'conditions' : ['HAVE_ACL'],
},
test_template + {
'sources' : files('test-af-list.c') +
generated_gperf_headers,
},
test_template + {
2025-05-01 14:39:58 +02:00
'sources' : files('test-arphrd-util.c')
},
test_template + {
'sources' : files('test-ask-password-api.c'),
'type' : 'manual',
},
test_template + {
'sources' : files('test-async.c'),
'timeout' : 120,
},
test_template + {
'sources' : files('test-boot-timestamps.c'),
'conditions' : ['ENABLE_EFI'],
},
test_template + {
'sources' : files('test-btrfs.c'),
'type' : 'manual',
},
test_template + {
'sources' : files('test-btrfs-physical-offset.c'),
'type' : 'manual',
},
test_template + {
'sources' : files('test-chase-manual.c'),
'type' : 'manual',
},
test_template + {
'sources' : files('test-compress-benchmark.c'),
'link_with' : [libshared],
'timeout' : 90,
},
test_template + {
'sources' : files('test-compress.c'),
'link_with' : [libshared],
},
test_template + {
'sources' : files('test-coredump-stacktrace.c'),
'type' : 'manual',
# This test intentionally crashes with SIGSEGV by dereferencing a NULL pointer
# to generate a coredump with a predictable stack trace. To prevent sanitizers
# from catching the error first let's disable them explicitly, and also always
# build with minimal optimizations to make the stack trace predictable no matter
# what we build the rest of systemd with
'override_options' : ['b_sanitize=none', 'strip=false', 'debug=true'],
'c_args' : ['-fno-sanitize=all', '-fno-optimize-sibling-calls', '-O1'],
},
test_template + {
'sources' : files('test-cryptolib.c'),
'dependencies' : libopenssl,
'conditions' : ['HAVE_OPENSSL'],
},
test_template + {
'sources' : files('test-display-quota.c'),
'type' : 'manual',
},
test_template + {
'sources' : files('test-dlopen-so.c'),
libkmod: turn into dlopen() dependency As it turns out libkmod has quite a bunch of deps, including various compressing libs and similar. By turning this into a dlopen() dependency, we can make our depchain during install time quite a bit smaller. In particular as inside of containers kmod doesn't help anyway as CAP_SYS_MODULE is not available anyway. While we are at it, also share the code that sets up logging/kmod context. After: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libz.so.1 => /lib64/libz.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 liblzma.so.5 => /lib64/liblzma.so.5 libzstd.so.1 => /lib64/libzstd.so.1 libc.so.6 => /lib64/libc.so.6 Before: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libkmod.so.2 => /lib64/libkmod.so.2 libzstd.so.1 => /lib64/libzstd.so.1 liblzma.so.5 => /lib64/liblzma.so.5 libz.so.1 => /lib64/libz.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libgcc_s.so.1 => /lib64/libgcc_s.so.1 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 libc.so.6 => /lib64/libc.so.6
2024-01-30 14:50:35 +01:00
'dependencies' : [
2025-09-08 19:17:40 +02:00
libblkid_cflags,
libkmod: turn into dlopen() dependency As it turns out libkmod has quite a bunch of deps, including various compressing libs and similar. By turning this into a dlopen() dependency, we can make our depchain during install time quite a bit smaller. In particular as inside of containers kmod doesn't help anyway as CAP_SYS_MODULE is not available anyway. While we are at it, also share the code that sets up logging/kmod context. After: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libz.so.1 => /lib64/libz.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 liblzma.so.5 => /lib64/liblzma.so.5 libzstd.so.1 => /lib64/libzstd.so.1 libc.so.6 => /lib64/libc.so.6 Before: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libkmod.so.2 => /lib64/libkmod.so.2 libzstd.so.1 => /lib64/libzstd.so.1 liblzma.so.5 => /lib64/liblzma.so.5 libz.so.1 => /lib64/libz.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libgcc_s.so.1 => /lib64/libgcc_s.so.1 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 libc.so.6 => /lib64/libc.so.6
2024-01-30 14:50:35 +01:00
libkmod_cflags,
2025-09-24 22:36:30 +02:00
libmount_cflags,
2025-09-08 19:17:40 +02:00
libp11kit_cflags,
libseccomp_cflags,
libkmod: turn into dlopen() dependency As it turns out libkmod has quite a bunch of deps, including various compressing libs and similar. By turning this into a dlopen() dependency, we can make our depchain during install time quite a bit smaller. In particular as inside of containers kmod doesn't help anyway as CAP_SYS_MODULE is not available anyway. While we are at it, also share the code that sets up logging/kmod context. After: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libz.so.1 => /lib64/libz.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 liblzma.so.5 => /lib64/liblzma.so.5 libzstd.so.1 => /lib64/libzstd.so.1 libc.so.6 => /lib64/libc.so.6 Before: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libkmod.so.2 => /lib64/libkmod.so.2 libzstd.so.1 => /lib64/libzstd.so.1 liblzma.so.5 => /lib64/liblzma.so.5 libz.so.1 => /lib64/libz.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libgcc_s.so.1 => /lib64/libgcc_s.so.1 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 libc.so.6 => /lib64/libc.so.6
2024-01-30 14:50:35 +01:00
],
},
test_template + {
# only static linking apart from libdl, to make sure that the
# module is linked to all libraries that it uses.
'sources' : files('test-dlopen.c'),
'link_with' : [
libc_wrapper_static,
libbasic_static,
],
'dependencies' : libdl,
'install' : false,
'type' : 'manual',
},
test_template + {
'sources' : files('test-errno-list.c') +
generated_gperf_headers,
},
test_template + {
'sources' : files('test-fd-util.c'),
'dependencies' : libseccomp_cflags,
},
test_template + {
'sources' : files(
'test-hashmap.c',
'test-hashmap-plain.c',
) + [
test_hashmap_ordered_c,
],
'timeout' : 180,
},
test_template + {
2025-05-01 14:39:58 +02:00
'sources' : files('test-ip-protocol-list.c'),
},
test_template + {
'sources' : files('test-ipcrm.c'),
'type' : 'unsafe',
},
test_template + {
'sources' : files('test-json.c'),
'dependencies' : libm,
},
test_template + {
'sources' : files('test-libcrypt-util.c'),
'dependencies' : libcrypt,
'timeout' : 120,
},
test_template + {
'sources' : files('test-libmount.c'),
'dependencies' : [
2025-09-24 22:36:30 +02:00
libmount_cflags,
threads,
],
},
test_template + {
'sources' : files('test-loopback.c'),
'dependencies' : common_test_dependencies,
},
test_template + {
'sources' : files('test-math-util.c'),
'dependencies' : libm,
},
test_template + {
'sources' : files('test-mempress.c'),
'dependencies' : threads,
},
test_template + {
2023-05-16 15:41:48 +02:00
'sources' : files('test-mount-util.c'),
2025-09-24 22:36:30 +02:00
'dependencies' : libmount_cflags,
2023-05-16 15:41:48 +02:00
},
test_template + {
'sources' : files('test-netlink-manual.c'),
libkmod: turn into dlopen() dependency As it turns out libkmod has quite a bunch of deps, including various compressing libs and similar. By turning this into a dlopen() dependency, we can make our depchain during install time quite a bit smaller. In particular as inside of containers kmod doesn't help anyway as CAP_SYS_MODULE is not available anyway. While we are at it, also share the code that sets up logging/kmod context. After: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libz.so.1 => /lib64/libz.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 liblzma.so.5 => /lib64/liblzma.so.5 libzstd.so.1 => /lib64/libzstd.so.1 libc.so.6 => /lib64/libc.so.6 Before: $ lddtree ./build/systemd systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2) libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so libaudit.so.1 => /lib64/libaudit.so.1 libcap-ng.so.0 => /lib64/libcap-ng.so.0 ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 libkmod.so.2 => /lib64/libkmod.so.2 libzstd.so.1 => /lib64/libzstd.so.1 liblzma.so.5 => /lib64/liblzma.so.5 libz.so.1 => /lib64/libz.so.1 libcrypto.so.3 => /lib64/libcrypto.so.3 libgcc_s.so.1 => /lib64/libgcc_s.so.1 libm.so.6 => /lib64/libm.so.6 libmount.so.1 => /lib64/libmount.so.1 libblkid.so.1 => /lib64/libblkid.so.1 libseccomp.so.2 => /lib64/libseccomp.so.2 libselinux.so.1 => /lib64/libselinux.so.1 libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so libacl.so.1 => /lib64/libacl.so.1 libattr.so.1 => /lib64/libattr.so.1 libcap.so.2 => /lib64/libcap.so.2 libcrypt.so.2 => /lib64/libcrypt.so.2 libgcrypt.so.20 => /lib64/libgcrypt.so.20 libgpg-error.so.0 => /lib64/libgpg-error.so.0 liblz4.so.1 => /lib64/liblz4.so.1 libpam.so.0 => /lib64/libpam.so.0 libeconf.so.0 => /lib64/libeconf.so.0 libc.so.6 => /lib64/libc.so.6
2024-01-30 14:50:35 +01:00
'dependencies' : libkmod_cflags,
'conditions' : ['HAVE_KMOD'],
'type' : 'manual',
},
network: firewall integration with NFT sets New directive `NFTSet=` provides a method for integrating network configuration into firewall rules with NFT sets. The benefit of using this setting is that static network configuration or dynamically obtained network addresses can be used in firewall rules with the indirection of NFT set types. For example, access could be granted for hosts in the local subnetwork only. Firewall rules using IP address of an interface are also instantly updated when the network configuration changes, for example via DHCP. This option expects a whitespace separated list of NFT set definitions. Each definition consists of a colon-separated tuple of source type (one of "address", "prefix", or "ifindex"), NFT address family (one of "arp", "bridge", "inet", "ip", "ip6", or "netdev"), table name and set name. The names of tables and sets must conform to lexical restrictions of NFT table names. The type of the element used in the NFT filter must match the type implied by the directive ("address", "prefix" or "ifindex") and address type (IPv4 or IPv6) as shown type implied by the directive ("address", "prefix" or "ifindex") and address type (IPv4 or IPv6) must also match the set definition. When an interface is configured with IP addresses, the addresses, subnetwork masks or interface index will be appended to the NFT sets. The information will be removed when the interface is deconfigured. systemd-networkd only inserts elements to (or removes from) the sets, so the related NFT rules, tables and sets must be prepared elsewhere in advance. Failures to manage the sets will be ignored. /etc/systemd/network/eth.network ``` [DHCPv4] ... NFTSet=prefix:netdev:filter:eth_ipv4_prefix ``` Example NFT rules: ``` table netdev filter { set eth_ipv4_prefix { type ipv4_addr flags interval } chain eth_ingress { type filter hook ingress device "eth0" priority filter; policy drop; ip saddr != @eth_ipv4_prefix drop accept } } ``` ``` $ sudo nft list set netdev filter eth_ipv4_prefix table netdev filter { set eth_ipv4_prefix { type ipv4_addr flags interval elements = { 10.0.0.0/24 } } } ```
2023-08-09 23:07:21 +03:00
test_template + {
'sources' : files('test-nft-set.c'),
'type' : 'manual',
},
test_template + {
'sources' : files(
'test-nss-hosts.c',
'nss-test-util.c',
),
'extract' : files('nss-test-util.c'),
'dependencies' : [
libdl,
libseccomp_cflags,
],
'conditions' : ['ENABLE_NSS'],
'timeout' : 120,
},
test_template + {
'sources' : files('test-nss-users.c'),
'objects' : ['test-nss-hosts'],
'dependencies' : libdl,
'conditions' : ['ENABLE_NSS'],
},
test_template + {
'sources' : files('test-openssl.c'),
'dependencies' : libopenssl,
'conditions' : ['HAVE_OPENSSL'],
},
test_template + {
'sources' : files('test-parse-util.c'),
'dependencies' : libm,
},
test_template + {
'sources' : files('test-shift-uid.c'),
'type' : 'manual',
},
test_template + {
'sources' : files('test-process-util.c'),
'dependencies' : threads,
},
test_template + {
'sources' : files('test-progress-bar.c'),
},
test_template + {
'sources' : files('test-qrcode-util.c'),
'dependencies' : libdl,
},
test_template + {
'sources' : files('test-random-util.c'),
'dependencies' : libm,
'timeout' : 120,
},
test_template + {
'sources' : files('test-reread-partition-table.c'),
},
test_template + {
'sources' : files('test-reread-partition-table-manual.c'),
'type' : 'manual',
},
test_template + {
'sources' : files('test-sbat.c'),
'conditions' : ['ENABLE_BOOTLOADER'],
'c_args' : f'-I@efi_config_h_dir@',
},
test_template + {
'sources' : files('test-seccomp.c'),
'dependencies' : libseccomp_cflags,
'conditions' : ['HAVE_SECCOMP'],
},
test_template + {
'sources' : files('test-selinux.c'),
2025-09-08 18:31:49 +02:00
'dependencies' : libselinux_cflags,
},
test_template + {
'sources' : files('test-set-disable-mempool.c'),
'dependencies' : threads,
},
test_template + {
'sources' : files('test-sizeof.c'),
'link_with' : [
libc_wrapper_static,
libbasic_static,
],
},
test_template + {
'sources' : files('test-time-util.c'),
'timeout' : 120,
},
test_template + {
'sources' : files('test-tpm2.c'),
'dependencies' : libopenssl,
'timeout' : 120,
},
test_template + {
'sources' : files('test-utmp.c'),
'conditions' : ['ENABLE_UTMP'],
},
test_template + {
'sources' : files('test-varlink.c'),
'dependencies' : threads,
},
test_template + {
'sources' : files('test-varlink-idl.c'),
'dependencies' : threads,
},
test_template + {
'sources' : files('test-watchdog.c'),
'type' : 'unsafe',
},
# Symbol tests
test_template + {
'name' : 'test-libsystemd-sym',
'sources' : test_libsystemd_sym_c,
'link_with' : libsystemd,
'suite' : 'libsystemd',
},
test_template + {
'name' : 'test-libudev-sym',
'sources' : test_libudev_sym_c,
'include_directories' : libudev_includes,
'c_args' : ['-Wno-deprecated-declarations'] + test_cflags,
'link_with' : libudev,
'suite' : 'libudev',
},
# Tests that link to libcore, i.e. tests for pid1 code.
core_test_template + {
'sources' : files('test-bpf-devices.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-bpf-firewall.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-bpf-foreign-programs.c'),
},
core_test_template + {
'sources' : files('test-bpf-restrict-fs.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-bpf-token.c'),
'dependencies' : common_test_dependencies + libbpf,
'conditions' : ['BPF_FRAMEWORK'],
'type' : 'manual',
},
core_test_template + {
'sources' : files('test-cgroup-cpu.c'),
},
core_test_template + {
'sources' : files('test-cgroup-mask.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-cgroup-unit-default.c'),
},
core_test_template + {
'sources' : files('test-chown-rec.c'),
},
core_test_template + {
'sources' : files('test-core-unit.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-emergency-action.c'),
},
core_test_template + {
'sources' : files('test-engine.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-execute.c'),
'dependencies' : common_test_dependencies,
'timeout' : 360,
},
core_test_template + {
'sources' : files('test-install.c'),
'type' : 'manual',
},
core_test_template + {
'sources' : files('test-job-type.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-load-fragment.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-loop-block.c'),
'dependencies' : [threads],
'parallel' : false,
},
core_test_template + {
'sources' : files('test-taint.c'),
},
core_test_template + {
'sources' : files('test-namespace.c'),
'dependencies' : [
threads,
],
},
core_test_template + {
'sources' : files('test-ns.c'),
'dependencies' : common_test_dependencies,
'type' : 'manual',
},
core_test_template + {
'sources' : files('test-path.c'),
'dependencies' : common_test_dependencies,
'timeout' : 120,
},
core_test_template + {
'sources' : files('test-sched-prio.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-socket-bind.c'),
'dependencies' : libdl,
'conditions' : ['BPF_FRAMEWORK'],
},
core_test_template + {
'sources' : files('test-tables.c'),
},
core_test_template + {
'sources' : files('test-unit-name.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-unit-serialize.c'),
'dependencies' : common_test_dependencies,
},
core_test_template + {
'sources' : files('test-watch-pid.c'),
'dependencies' : common_test_dependencies,
},
# Tests from other directories that have link_with deps that were not defined earlier
test_template + {
'sources' : files('../libsystemd/sd-bus/test-bus-error.c'),
'link_with' : [
libshared_static,
libsystemd_static,
],
},
test_template + {
'sources' : files('../libsystemd/sd-device/test-sd-device-thread.c'),
'link_with' : [
libc_wrapper_static,
libbasic_static,
libsystemd,
],
'dependencies' : threads,
},
test_template + {
'sources' : files('../libudev/test-udev-device-thread.c'),
'link_with' : [
libc_wrapper_static,
libbasic_static,
libudev,
],
'dependencies' : threads,
},
test_template + {
'sources' : files('../libudev/test-libudev.c'),
'link_with' : [
libshared,
libudev_basic,
],
},
]
if static_libsystemd != 'false'
executables += [
test_template + {
'name' : 'test-libsystemd-static-sym',
'sources' : test_libsystemd_sym_c,
'link_with' : install_libsystemd_static,
'build_by_default' : want_tests != 'false',
'install' : install_tests,
'suite' : 'libsystemd',
},
]
endif
if static_libudev != 'false'
executables += [
test_template + {
'name' : 'test-libudev-static-sym',
'sources' : test_libudev_sym_c,
'include_directories' : libudev_includes,
'c_args' : ['-Wno-deprecated-declarations'] + test_cflags,
'link_with' : install_libudev_static,
'build_by_default' : want_tests != 'false',
'install' : install_tests,
'suite' : 'libudev',
},
]
endif