Commit graph

5288 commits

Author SHA1 Message Date
Ivan Shapovalov 3e7a029c28 analyze: capability: add support for decoding capability masks
This adds support in `systemd-analyze capability` for decoding
capability masks (sets), e.g.:

```console
$ systemd-analyze capability --mask 0000000000003c00
NAME                 NUMBER
cap_net_bind_service     10
cap_net_broadcast        11
cap_net_admin            12
cap_net_raw              13
```

This is intended as a convenience tool for pretty-printing capability
values as found in e.g. `/proc/$PID/status`.
2024-07-24 17:25:47 +02:00
Gregor Herburger 1aa74ad048 test: systemd-networkd-tests: add fdb learned tests
Add a test for the new bridge netlink attributes IFLA_BR_FDB_N_LEARNED and
IFLA_BR_FDB_MAX_LEARNED.

Signed-off-by: Gregor Herburger <gregor.herburger@ew.tq-group.com>
2024-07-22 10:27:56 +02:00
Mike Yuan 60b218e36e test-execute: ExecStop= and friends should not get credentials
See #32583
2024-07-21 19:10:58 +01:00
Luca Boccassi 7b5c38a91d test: override blocking localed policy in TEST-73-LOCALE
On Debian and derivatives writing calls to localed are blocked as other
tools are used to change settings, override that policy for the tests
2024-07-21 16:30:57 +01:00
Daan De Meyer d279ec4a50 mkosi: Streamline running the integration tests without building systemd
Let's document in detail how to build the integration test image and run
the integration tests without building systemd. To streamline the process,
we stop automatically using binaries from build/ when invoking mkosi directly
and don't automatically use a tools tree anymore if systemd on the host is too
old. Instead, we document these options in HACKING.md and change the mkosi meson
target to automatically use the current build directory as an extra binary search
path for mkosi.
2024-07-18 11:39:07 +02:00
Daan De Meyer 473747b8cf
Merge pull request #33752 from DaanDeMeyer/lsm
Two mkosi improvements
2024-07-17 20:15:17 +02:00
Daan De Meyer f5c44df929 mkosi: Remove enforcing=0 from default kernel command line
We already have selinux=0 in the default kernel command line so
enforcing=0 is redundant. Instead, pass in enforcing=0 when we
enable selinux in TEST-06-SELINUX.
2024-07-17 18:56:02 +02:00
Luca Boccassi 09edabe96a id128: add 'var-partition-uuid' verb
Some checks are pending
CIFuzz / Fuzzing (x86_64, undefined) (push) Waiting to run
CIFuzz / Fuzzing (x86_64, memory) (push) Waiting to run
CIFuzz / Fuzzing (x86_64, address) (push) Waiting to run
CIFuzz / Fuzzing (i386, address) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
Differential ShellCheck / lint (push) Waiting to run
mkosi / ci (-Og, ubuntu, 0, no, noble, ) (push) Waiting to run
mkosi / ci (-Og, opensuse, 0, no, tumbleweed, ) (push) Waiting to run
mkosi / ci (-Og, fedora, 1, yes, rawhide, address,undefined) (push) Waiting to run
mkosi / ci (-Og, fedora, 0, yes, 40, ) (push) Waiting to run
mkosi / ci (-Og, debian, 0, no, testing, ) (push) Waiting to run
mkosi / ci (-Og, centos, 0, yes, 9, ) (push) Waiting to run
mkosi / ci (-Og, centos, 0, yes, 10, ) (push) Waiting to run
mkosi / ci (-O2 -D_FORTIFY_SOURCE=3, arch, 0, no, rolling, ) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
As per DPS the UUID for /var/ should be keyed by the local machine-id,
which is non-trivial to do in a script. Enhance 'systemd-id128' to
take 'var-partition-uuid' as a verb, and if so perform the
calculation.
2024-07-17 18:05:40 +02:00
Daan De Meyer 923eeb38fb
Merge pull request #33695 from DaanDeMeyer/epel
mkosi: Add CI for CentOS Stream 10
2024-07-16 11:43:49 +02:00
Daan De Meyer 5ac0dc70ff TEST-13-NSPAWN: make sure we don't load libnss_systemd
Let's make sure we don't load libnss_systemd.so from bash as the
necessary environment variables aren't set to make that work when
we're running with sanitizers enabled.

We can't add a sanitizer wrapper for bash as the wrapper runs using
bash so you end up in a loop.
2024-07-16 09:42:17 +02:00
Daan De Meyer 985d5b4bc2 systemd-networkd-tests: Skip tests requiring dhcpd if it is not available
dhcpd is not available on CentOS Stream 10

See https://github.com/systemd/systemd/issues/33717
2024-07-15 16:17:33 +02:00
Daan De Meyer f65ec2e904 TEST-55-OOMD: Remove the opensuse user@ dropin
Required to make TEST-55-OOMD pass on OpenSUSE.
2024-07-15 16:17:33 +02:00
Daan De Meyer d97b48176b TEST-64-UDEV-STORAGE: Use max_ioqpairs instead of num_queues
Fixes a deprecation warning from qemu.
2024-07-15 16:17:33 +02:00
Daan De Meyer ff8c89aa5a test: do not attempt to set xattr on tmpfs
This is only possible since a recent kernel version, and fails otherwise,
like on CentOS 9
2024-07-15 16:17:33 +02:00
Mike Yuan 11b3775f51 core/unit: ignore dropins for masked units completely when checking need_reload
Follow-up for 19a44dfe45

If a drop-in is set from upper level, e.g. global unit_type.d/,
even if a unit is masked, its dropin_paths would still be partially
populated. However, unit_need_daemon_reload() would always
compare u->dropin_paths with empty strv in case of masked units,
resulting in it always returning true. Instead, let's ignore
dropins entirely here.

Fixes #33672
2024-07-12 15:59:36 +02:00
David Tardon 8b6de9e638 test: add a reproducer for #33672 2024-07-12 15:59:20 +02:00
Daan De Meyer 14fb6354f1
Merge pull request #33636 from DaanDeMeyer/ext4
Various integration test improvements
2024-07-10 21:33:23 +02:00
Daan De Meyer dedd712dd9 TEST-06-SELINUX: Various fixes
- Stop installing the policy in the initramfs as it's not really
supported anyway (https://github.com/fedora-selinux/selinux-policy/issues/2221)
- Stop relabeling on first boot and prefer to do it at image build time
- Disable mkosi relabeling by default but enable it in CI
- Build image as root in CI so the SELinux relabeling works properly
2024-07-10 18:52:29 +02:00
Daan De Meyer e842deeac6 test: Switch to ncat instead of nc
ncat is available in CentOS Stream 9 without having to enable EPEL.
2024-07-10 18:52:29 +02:00
Daan De Meyer 3e3a15c06e TEST-55-OOMD: Switch to stress-ng
stress-ng is available in OpenSUSE and in CentOS Stream without needing
EPEL so let's switch to it instead of stress.
2024-07-10 18:52:26 +02:00
Lennart Poettering 5b37c4cf86 mount-tool: show diskseq in --list output
Let's expose the diskseq a bit more prominently.
2024-07-10 09:35:31 +02:00
Lennart Poettering 66f4f49c8f mount-tool: add support for a --json= output mode
Let's add a JSON output mode, like we have it for so many of our tools.
2024-07-10 09:35:31 +02:00
Luca Boccassi aaa7b36bd1 test: install split-out sshd-session binary if present
Archlinux split out one ssh binary, install it in the legacy test
setup if present for the tests that need ssh
2024-07-09 21:29:08 +02:00
Daan De Meyer 20345a86b7 mkosi: Adapt configuration to take into account configuration rework
In https://github.com/systemd/mkosi/pull/2847, the '@' specifier is
removed, CLI arguments take priority over configuration files again
and the "main" image is defined at the top level instead of in
mkosi.images/. Additionally, not every setting from the top level
configuration is inherited by the images in mkosi.images/ anymore,
only settings which make sense to be inherited are inherited.

This commit gets rid of all the usages of '@', moves the "main" image
configuration from mkosi.images/system to the top level and gets rid
of various hacks we had in place to deal with quirks of the old
configuration parsing logic.

We also remove usages of Images= and --append as these options are
removed by the mentioned PR.
2024-07-09 08:07:09 +02:00
Daan De Meyer 14963ea90d test: Set priority for TEST-73-LOCALE
I don't know why yet, but TEST-73-LOCALE can take more than 10
minutes. Until we figure out why, let's give it a higher priority
so it doesn't bottleneck the test run.
2024-07-06 02:07:03 +02:00
Daan De Meyer 575f954b5d TEST-06-SELINUX: Disable RuntimeBuildSources=
Otherwise fixfiles will try to relabel it which could potentially
lead to disaster. We also change the recommendation in HACKING.md
to set the default so that TEST-06-SELINUX can override it.
2024-07-05 19:20:42 +02:00
Daan De Meyer b5eaa52d49 test: Add missing --no-rebuild to doc
Otherwise meson will try to rebuild all targets.
2024-07-05 16:17:40 +02:00
Luca Boccassi fc9938d6f8 sysusers: handle NSS errors gracefully
If the io.systemd.DynamicUser or io.systemd.Machine files exist,
but nothing is listening on them, the nss-systemd module returns
ECONNREFUSED and systemd-sysusers fails to creat the user/group.

This is problematic when ran by packaging scripts, as the package
assumes that after this has run, the user/group exist and can
be used. adduser does not fail in the same situation.

Change sysusers to print a loud warning but otherwise continue
when NSS returns an error.
2024-07-04 16:43:51 +02:00
Luca Boccassi 92d1fe3efa os-util: avoid matching on the wrong extension-release file
The previous commit tries to extract a substring from the
extension-release suffix, but that is not right, it's only the
images that need to be versioned and extracted, use the extension-release
suffix as-is. Otherwise if it happens to contain a prefix that
matches the wrong image, it will be taken into account.

Follow-up for 37543971af
2024-07-04 12:49:28 +02:00
Luca Boccassi 92d9d5ca70 test: skip TEST-69-SHUTDOWN on Debian
There is a regression in the login package, skip the test until
it is fixed. https://bugs.debian.org/1075733
2024-07-04 09:07:22 +02:00
Luca Boccassi 467c501667
Merge pull request #33577 from fbuihuu/testsuite-tweaks-for-v256-on-SUSE
Testsuite tweaks for v256 on suse
2024-07-02 23:35:33 +02:00
Franck Bui 252542ffc3 test: fix TEST-74-AUX-UTILS.ssh.sh on SUSE 2024-07-02 19:07:03 +02:00
Franck Bui 855bad331e test: preserve symlink in inst_recursive()
On SUSE this function is used to copy symlinks installed in *.wants/
directories.
2024-07-02 19:06:21 +02:00
Franck Bui 56a894e888 test: fix TEST-24-CRYPTSETUP on SUSE
/etc/systemd/journald.conf.d drop-in dir already exists on SUSE.
2024-07-02 19:05:07 +02:00
Franck Bui a09825ce9f test: install /etc/hosts
Needed for resolving the "localhost" hostname.
2024-07-02 19:03:49 +02:00
Daniel Rusek a9d472d6e4 test: split the resolved test suite into separate test cases
Although being far from ideal and the first two test cases have to be run
before the setup phase otherwise they will fail, it still makes the test
suite look much better and easier to read
2024-07-02 10:08:53 +02:00
Lennart Poettering a90682f981 storagetm: add --list-devices command 2024-07-01 16:39:40 +02:00
Lennart Poettering 3a37a13a02 repart: add --list-devices switch for listing candidate block devices 2024-07-01 16:39:40 +02:00
Lennart Poettering e742c99999 cryptenroll: add --list-devices switch that shows candidate block devices 2024-07-01 16:39:40 +02:00
Luca Boccassi 1c74db68e4
Merge pull request #33518 from DaanDeMeyer/aarch64
Various integration test fixes
2024-06-29 02:09:21 +02:00
Luca Boccassi 3f1764dcfc
Merge pull request #33517 from keszybz/a-few-unrelated-cleanups
A few unrelated cleanups
2024-06-28 19:06:31 +02:00
Daan De Meyer 436474dd43 TEST-54-CREDS: Use UEFI firmware if available
On aarch64, SMBIOS is only available when using UEFI, so let's make
sure that the creds test uses UEFI when available so that it can
read creds from SMBIOS when running in a virtual machine.
2024-06-28 16:23:27 +02:00
Daan De Meyer f392be9e77 TEST-18-FAILUREACTION: Set auto firmware
This test runs in nspawn by default but will still run in qemu when
tests are run unprivileged so make sure we use UEFI if available to
avoid hangs when using the linux firmware.
2024-06-28 16:23:25 +02:00
Daan De Meyer 3cf38516bb TEST-09-REBOOT: Set auto firmware
This test runs in nspawn by default but will still run in qemu when
tests are run unprivileged so make sure we use UEFI if available to
avoid hangs when using the linux firmware.
2024-06-28 16:21:39 +02:00
Daan De Meyer 7c04137a6f TEST-06-SELINUX: Explicitly pull in autorelabel.service 2024-06-28 15:50:35 +02:00
Daan De Meyer 98f2a332cb TEST-70-TPM2: Use UEFI firmware if available
On x86 this doesn't matter but on aarch64 we need to make sure UEFI
is used so that /sys/kernel/security/tpm0/binary_bios_measurements
is there which is required for TEST-70-TPM2.
2024-06-28 15:47:33 +02:00
Luca Boccassi a1a40297db core: deduplicate identical dm-verity ExtensionImages=
It turns out OverlayFS doesn't handle gracefully when the same source is
specified multiple times in lowerdir= and it fails with ELOOP:

Failed to mount overlay (type overlay) on /run/systemd/mount-rootfs/opt (MS_RDONLY "lowerdir=/run/systemd/unit-extensions/1/opt:/run/systemd/unit-extensions/0/opt:/run/systemd/mount-rootfs/opt"): Too many levels of symbolic links

This happens even if we mount each image in a different internal mount
path, as OverlayFS will resolve it and look for the backing device, which
will be the same device mapper entity, and return a hard error.
This error does not appear if dm-verity is not used, so it is very
confusing for users, and unnecessary.

When mounting ExtensionImages, check if an image is dm-veritied,
and drop duplicates if the root hashes match, to avoid this user-unfriendly
hard error.
2024-06-28 14:37:58 +01:00
Daan De Meyer 24284098a4 TEST-45-TIMEDATE: Use syslog identifier journalctl match
Using a unit match is racy whereas a syslog identifier match is
reliable.
2024-06-28 14:51:10 +02:00
Daan De Meyer 72d121b601 TEST-64-UDEV-STORAGE: Make nvme_subsystem expected pci symlinks more generic
When running the test on aarch64 the symlinks look as follows:

"""
[root@H ~]# ls /dev/disk/by-path
platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0       platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part1  platform-4010000000.pcie-pci-0000:00:05.0-nvme-16
platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part  platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part2  platform-4010000000.pcie-pci-0000:00:05.0-nvme-17
"""

So let's make the PCI patterns a little more generic so they match
both the x86 and the aarch64 paths.
2024-06-28 14:20:34 +02:00
Daan De Meyer 32f3617fd7 test: pull in multi-user.target explicitly
Let's make sure we pull in multi-user.target so that we get a console
when a test fails and we're running meson test with --interactive.
2024-06-28 13:34:37 +02:00
Daan De Meyer 4e469c0af2 TEST-64-UDEV-STORAGE: Fix python 3.9 compatibility
Using double quotes in f-strings only works from python 3.12 onwards.
Use single quotes to make sure python 3.9 works as well.

Also clean up quotes a little in general.
2024-06-28 13:18:29 +02:00
Daan De Meyer 7f07f9c8cd TEST-64-UDEV-STORAGE: Use bus pci slot 1 instead of 0
Trying to use bus pci slot 0 fails on aarch64 so let's use 1 instead.

The error:

"""
qemu-system-aarch64: -device virtio-blk-pci,drive=drive0,scsi=off,bus=pci_bridge25: Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.
"""
2024-06-28 12:51:26 +02:00
Zbigniew Jędrzejewski-Szmek 6bb3ea655d TEST-58-REPART: reverse order of diff args
I expect the test output to be the second argument, so we're diffing "expected"
and "output", not the other way around.

I noticed this when working on https://github.com/systemd/systemd/pull/33081.
2024-06-28 11:48:25 +02:00
Lennart Poettering ebc4a76a64 ci: add simple test for the new "ssh-exec:" varlink logic 2024-06-27 11:30:07 +02:00
Matthias Lisin 282bda46f1
tmpfiles: use common macro for a set of specifiers
This adds %q, %A and %M specifiers to tmpfiles:
- %A and %M were previously added to tmpfiles.d man page, but not to specifier_table
- %q is added via COMMON_SYSTEM_SPECIFIERS
2024-06-26 04:18:14 +02:00
Luca Boccassi 4d2a86936a
Merge pull request #33451 from yuwata/core-exec-use-write
core: use write() instead of send()
2024-06-25 14:44:21 +02:00
Luca Boccassi a016c8b67f
Merge pull request #33450 from yuwata/network-ndisc-do-not-override-static-routes
network/NDisc: do not override static routes
2024-06-25 14:40:06 +02:00
Lennart Poettering 7f1c31829b
Merge pull request #33003 from poettering/repart-progress
repart: draw progress bar during CopyBlocks= operation and other tweaks
2024-06-25 14:08:04 +02:00
Lennart Poettering a34930cee2
Merge pull request #33078 from poettering/import-generator
importd: add import generator
2024-06-25 14:07:46 +02:00
Luca Boccassi 59d4970a55 mkosi: add support for TEST_SAVE_JOURNAL to integration test wrapper
Same variable and values as supported by the shell suite
2024-06-25 12:16:59 +02:00
Lennart Poettering 9a9cc27761 ci: add small test case for /dev/urandom as source for CopyBlocks= 2024-06-25 10:24:47 +02:00
Lennart Poettering d7afdf36ae ci: add test for importd varlink interface + import generator 2024-06-25 09:57:42 +02:00
Yu Watanabe 956a9f00b4 test-execute: add a test case for issue #33299 2024-06-25 05:21:00 +09:00
Luca Boccassi f8f06462e5
Merge pull request #33042 from poettering/machined-unpriv
machined: unprivileged machine registration
2024-06-24 20:45:37 +02:00
Yu Watanabe 62fb079a3b test-network: check if static routes not overridden by NDisc routes 2024-06-25 03:17:21 +09:00
Lennart Poettering ecc4287dee vmspawn: by default, let machined register a cgroup for VMs
This mimics what we do in nspawn: if registration is enabled we'll let
machined allocate a scope unit for us. When --keep-unit is used we'll
register without creating a new scope.

This brings behaviour more inline with what nspawn does, exposing the
same sets of options.
2024-06-21 17:49:26 +02:00
Lennart Poettering f2b10bebb6 test: add some superficial integration tests 2024-06-21 17:28:16 +02:00
Lennart Poettering d42edbf1b8
Merge pull request #33430 from YHNdnzj/buserror-notify
core/service: store BUSERROR= & VARLINKERROR= received and show them through systemctl status
2024-06-20 23:05:32 +02:00
Mike Yuan 4b89c55c3f
TEST-80-NOTIFYACCESS: introduce test for ERRNO= + BUS/VARLINKERROR= 2024-06-20 20:51:12 +02:00
Lennart Poettering ea441dbd9d ci: test new --graceful= switch of varlinkctl 2024-06-20 18:20:09 +02:00
Lennart Poettering 9e10f3a7e8 bootctl: normalize how we report no boot entries found
This normalizes how we report an empty list of boot entries in
ListBootEntries(). Our usual pattern is to return one item per method
call, but when there is none we usually return a NoSuchXYZ error. Do so
here too.

Before this we'd return a null item instead here, and only here.

This is a minor compat break, but given that this IPC interface is very
new and probably not used so far (we don't use it in our code at least,
and google doesn#t find any other use) I think this normalization is OK
at this point.
2024-06-20 10:02:40 +02:00
Yu Watanabe 8f33bfeca1 varlink-idl: allow unbalanced quote and trailing backslash in comment
Fixes #33381.
Fixes OSS-FUZZ#69730.
Follow-up for fbb69c0306.
2024-06-19 14:12:20 +02:00
Luca Boccassi 5163c9b1e5 install: allow removing symlinks even for units that are gone
If a symlink is leftover, still allow cleaning it up via 'disable'. This
happens when a unit is stopped and removed, but not disabled, and a reload
has already happened. At that point, cleaning up the old symlinks becomes
impossible through the APIs, and needs to be done manually. Always allow
cleaning up symlinks, if they exist, by only erroring out if there is an
OOM.

Follow-up for f31f10a620
2024-06-18 16:07:26 +02:00
Luca Boccassi 3f4f065bab
Merge pull request #33359 from bluca/test_apparmor_unpriv
mkosi: enable unprivileged user ns for integration tests
2024-06-18 00:13:15 +01:00
Luca Boccassi fcbe3e3b2e
Merge pull request #32724 from bluca/dynamic_user_no_private_tmp
core: do not imply PrivateTmp with DynamicUser, create a private tmpfs instead
2024-06-18 00:11:11 +01:00
Luca Boccassi 0e551b04ef core: do not imply PrivateTmp with DynamicUser, create a private tmpfs instead
DynamicUser= enables PrivateTmp= implicitly to avoid files owned by reusable uids
leaking into the host. Change it to instead create a fully private tmpfs instance
instead, which also ensures the same result, since it has less impactful semantics
with respect to PrivateTmp=yes, which links the mount namespace to the host's /tmp
instead. If a user specifies PrivateTmp manually, let the existing behaviour
unchanged to ensure backward compatibility is not broken.
2024-06-17 17:05:55 +01:00
Yu Watanabe 4f6d8ab076 test-network: mention that the captive portal option is supported since v2.20
The current latest release is v2.19, hence the test is typically skipped now.
2024-06-18 00:20:27 +09:00
Luca Boccassi 80468db8fa test: use 'auto' instead of 'uefi' for automated fallback
mkosi will prefer UEFI if the architecture supports it, but fallback
to 'linux' if it doesn't.
2024-06-17 15:52:50 +01:00
Luca Boccassi 464d182b3e test: support TEST_NO_QEMU in mkosi integration wrapper
Same as the old integration test suite, allow skipping tests that
require qemu.
ppc64el's vsock support doesn't appear to work, so we'll skip it,
as it is already done in the legacy framework.
2024-06-17 15:52:50 +01:00
Luca Boccassi 7d2701e7d1 test: support TEST_NO_KVM
The shell integration suite allows to manually deselect KVM, so
suppor the same env var for the same purpose in python.
2024-06-17 15:52:50 +01:00
Luca Boccassi 626518ecd5 test: drop obsolete comment
We want to keep various logic here instead of mkosi, so drop the
temporary comment
2024-06-17 15:52:50 +01:00
Luca Boccassi f44fc531c9 test: drop unneeded firmware: uefi setting
These tests no longer need this, as they are running in nspawn, drop it
2024-06-17 11:34:52 +01:00
Luca Boccassi e1daedb4be test: check the skip condition before installing additional files 2024-06-17 11:34:52 +01:00
Lennart Poettering aa413d5fc6 ci: add superficial --quiet testcase 2024-06-13 11:31:44 +02:00
Lennart Poettering e1ef88e56e test: add test for new varlinkctl features 2024-06-13 09:37:15 +02:00
Frantisek Sumsal 2ac0e52f29 test: dump a simple summary at the end of TEST-02-UNITTEST
Let's dump a list of skipped tests and logs from failed tests at the end
of TEST-02-UNITTEST to make debugging fails in CI slightly less painful.
2024-06-12 14:04:10 +01:00
Lennart Poettering 8c5045f9b2 analyze: add verb for dumping SMBIOS Type #11 data
I find myself wanting to check this data with a quick command, and
browsing through /sys/ manually getting binary data sucks. Hence let's
do add a nice little analysis tool.
2024-06-12 12:48:28 +02:00
Matthieu Baerts (NGI0) 3f69070598 core/socket: allow MPTCP protocol
Multipath TCP (MPTCP), standardized in RFC8684 [1], is a TCP extension
that enables a TCP connection to use different paths. It allows a device
to make use of multiple interfaces at once to send and receive TCP
packets over a single MPTCP connection. MPTCP can aggregate the
bandwidth of multiple interfaces or prefer the one with the lowest
latency, it also allows a fail-over if one path is down, and the traffic
is seamlessly re-injected on other paths.

To benefit from MPTCP, both the client and the server have to support
it. Multipath TCP is a backward-compatible TCP extension that is enabled
by default on recent Linux distributions (Debian, Ubuntu, Redhat, ...).
Multipath TCP is included in the Linux kernel since version 5.6 [2]. To
use it on Linux, an application must explicitly enable it when creating
the socket:

  int sd = socket(AF_INET(6), SOCK_STREAM, IPPROTO_MPTCP);

No need to change anything else in the application.

This patch allows MPTCP protocol in the Socket unit configuration. So
now, a <unit>.socket can contain this to use MPTCP instead of TCP:

  [Socket]
  SocketProtocol=mptcp

MPTCP support has been allowed similarly to what has been already done
to allow SCTP: just one line in core/socket.c, a very simple addition
thanks to the flexible architecture already in place.

On top of that, IPPROTO_MPTCP has also been added in the list of allowed
protocols in two other places, and in the doc. It has also been added to
the missing_network.h file, for systems with an old libc -- note that it
was also required to include <netinet/in.h> in this file to avoid
redefinition errors.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.mptcp.dev [2]
2024-06-12 00:14:08 +01:00
Yu Watanabe 8843726ac2 test-network: wait a while for addresses to be dropped
Hopefully fixes the following failure:
```
======================================================================
FAIL: test_ipv6_token_prefixstable (__main__.NetworkdRATests.test_ipv6_token_prefixstable)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/systemd/tests/testdata/test-network/systemd-networkd-tests.py", line 5705, in test_ipv6_token_prefixstable
    self.assertNotIn('2002:da8:1:0:b47e:7975:fc7a:7d6e/64', output) # the 1st prefixstable
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '2002:da8:1:0:b47e:7975:fc7a:7d6e/64' unexpectedly found in
  '19: veth99@veth-peer: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000\n
       inet6 2002:da8:1:0:b47e:7975:fc7a:7d6e/64 scope global tentative dynamic mngtmpaddr noprefixroute \n
          valid_lft 2100sec preferred_lft 1000sec\n
       inet6 2002:da8:1:0:da5d:e50a:43fd:5d0f/64 scope global dynamic mngtmpaddr noprefixroute \n
          valid_lft 2100sec preferred_lft 1000sec\n
       inet6 fe80::1034:56ff:fe78:9abc/64 scope link proto kernel_ll \n
          valid_lft forever preferred_lft forever'
----------------------------------------------------------------------
```
2024-06-11 13:52:41 +01:00
Yu Watanabe 01420b2db5 network/ndisc: use router lifetime as one for redirect route
Previously, we did not set lifetime for redirect route, and redirect
routes were removed only when received a RA from the target address.
Thus, routes that redirect on-link addresses were never removed.

RFCs mention nothing about the lifetime of redirection. But the previous
implementation does not pass the IPv6 Core Conformance Tests.

This makes
- remember all received RAs and manage them by the sender address
  (previously, remembered only one with the highest preference),
- then use the router lifetime as one for redirect route,
- remove redirect route also when the router corresponds to the sender
  address is dropped (previously, considered only target address).

Note, even if we recieve a new RA, we do not update existing redirect
routes. The lifetime of the redirect route is updated only when a new
Redirect message is received.

Closes #32527.
2024-06-06 11:19:55 +01:00
Daan De Meyer 1a48d8549f core: Fix CPUQuotaPerSecUSec unit file serialization
CPUQuota= can deal with float percentages perfectly fine these days
(up to two places after the dot), so let's take that into account
when serializing the value to the transient unit file so we don't lose
precision when specifying e.g. "CPUQuota=0.5%".
2024-06-05 16:50:36 +02:00
Yu Watanabe dadf2bd4f4 test-network: introduce a .network file to protect existing interfaces 2024-06-03 18:41:26 +01:00
Yu Watanabe 653c38b3eb test-network: show PID and Invocation ID of networkd
Then, we can easily find relevant journal entry on failure.
This is especially useful when the test is running with --no-journal.
2024-06-03 18:41:26 +01:00
Yu Watanabe 6fec598290 test-network: flush stream buffer and journals before/after running test 2024-06-03 18:41:26 +01:00
Yu Watanabe 22fa8f6724 test-network: generate debugging logs of networkd-persistent-storage.service 2024-06-03 18:41:26 +01:00
Luca Boccassi 80a3eb5ab5 test: disable TEST-21-DFUZZER in mkosi, as it is very flacky
Can be re-enabled once https://github.com/systemd/systemd/issues/33156
is solved
2024-06-03 19:37:17 +02:00
Luca Boccassi d6243ebedd journald: enable persistent FD Store to fix logging during soft-reboot
A unit with StandardOutput=journal (the default) will get its stdout/stderr sockets
disconnected when journald stops, as the file descriptors on journald's side are
not preserved (it works on restart, as the FD Store keeps them open during restarts).
Set FileDescriptorStorePreserve=yes so that the journal FD's stay open during a soft
reboot, and applications don't get broken stdout/stderr.
2024-06-03 16:30:54 +01:00
Luca Boccassi 88c2ef1f75 Revert "test: Run end.sh when running integration tests with mkosi"
It seems this introduced a regression in the CentOS CI;

14:25:58 FAILED TASKS:14:25:58 -------------
14:25:58 TEST-03-JOBS
14:25:58 TEST-52-HONORFIRSTSHUTDOWN
14:25:58 TEST-63-PATH

Revert for now.

This reverts commit da3c6fc553.
2024-06-03 16:29:23 +01:00
Daan De Meyer 9619fdc102
Merge pull request #33157 from DaanDeMeyer/end
test: Run end.sh when running integration tests with mkosi
2024-06-02 21:04:56 +02:00
Daan De Meyer da3c6fc553 test: Run end.sh when running integration tests with mkosi 2024-06-02 19:15:21 +02:00
Daan De Meyer 7c0ab0cdf2 TEST-16-EXTEND-TIMEOUT: Convert to oneshot service
To match the other service units more and allow adding more
ExecStart= lines via dropins.
2024-06-02 19:15:21 +02:00
Yu Watanabe 46322f2742 test: exit earlier when cgroup user xattr is not supported
Also, use trap for cleaning up the test environment.
2024-06-01 22:35:07 +09:00
Yu Watanabe 5f03c19f7b test: reduce number of 'systemctl daemon-reload' a bit 2024-06-01 22:28:32 +09:00
Yu Watanabe 7faf8987ed test: sync journal in short-living services
This also adjusts LogLevelMax=.

Hopefully, this makes the test much stabler.
2024-06-01 22:25:50 +09:00
Yu Watanabe 77356099ce test-network: add missing sleep()
Fixes a bug introduced by 7ef26afca5.

Fixes #33098.
2024-06-01 08:25:10 +02:00
Daan De Meyer f4a0dd0ef6
Merge pull request #33105 from DaanDeMeyer/sanitizers
Sanitizers
2024-05-31 19:44:05 +02:00
Daan De Meyer 605d72cb14 TEST-21-DFUZZER: Stop marking as slow
This was a workaround to not run TEST-21-DFUZZER without sanitizers.
Now that we're going to get sanitizer support, let's run it by default
again.
2024-05-31 17:26:13 +02:00
Daan De Meyer e690a8cd09 TEST-69-SHUTDOWN: Order after systemd-user-sessions.service
Make sure that we're allowed to login by ordering ourselves after
systemd-user-sessions.service.
2024-05-31 17:26:13 +02:00
Daan De Meyer 80a5f762bb
Merge pull request #33121 from yuwata/test-integration-tests-mkosi
Test: several integration test improvements
2024-05-31 15:40:43 +02:00
Yu Watanabe 1f4345b5ed networkd-test: first wait for interface being configured
DNS setting propagation to resolved may take some time.
2024-05-31 10:00:21 +02:00
Yu Watanabe 7ae191a5ea test: optionally allow to disable user service manager, and disable it on TEST-64
The test triggers many uevents, and running both system and user service
managers make the test slow.
2024-05-31 16:29:19 +09:00
Yu Watanabe 052500a072 test: make it sure that devices are processed by udevd before running subtests 2024-05-31 16:10:55 +09:00
Yu Watanabe 60914351c8 test: lock device on sfdisk or mkfs, and extend timeout
Hopefully fixes #33111.
2024-05-31 16:09:31 +09:00
Luca Boccassi 0630069f0b
Merge pull request #33081 from keszybz/networkctl-formatting
Fix formatting of speeds in networkctl
2024-05-30 16:33:38 +02:00
Daan De Meyer 6b572e88a3 test-network: Add dirs_exist_ok=True to cp_r()
Let's not fail if directories already exist in cp_r().
2024-05-30 12:47:45 +02:00
Daan De Meyer f824a33a79 test-execute: Load systemd-asan-env environment file if available
When DynamicUser= is enabled, we need LD_PRELOAD to be configured
correctly as the tests will load systemd's nss module which will complain
when built with sanitizers if the sanitizer libraries were not loaded
first.
2024-05-30 12:47:45 +02:00
Daan De Meyer 9029f20b35 TEST-02-UNITTESTS: Pass asan environment to units if it is available
Some tests (e.g. test-udev.py) might trigger one of our NSS modules
which means LD_PRELOAD has to be configured properly.
2024-05-30 12:47:45 +02:00
Daan De Meyer aae2990907 TEST-79-MEMPRESS: Load systemd-asan-env if available
Required since we run with DynamicUser=1.
2024-05-30 12:47:45 +02:00
Daan De Meyer 0cd488617c TEST-36-NUMAPOLICY: Skip when running with sanitizers
The test does not work under sanitizers as strace is used. Until the
test is fixed to not use strace let's skip it when running with
sanitizers.
2024-05-30 12:47:43 +02:00
Zbigniew Jędrzejewski-Szmek 11226bf19b shared/format-table: do not print '.0'
This makes output a bit shorter and nicer. For us, shorter output is generally
better.

Also, drop unnecessary UINT64_C macros. The left operand is always uint64_t,
and C upcasting rules mean that it doesn't matter if the right operand is
narrower or signed, the operation is always done on the wider unsigned type.
2024-05-30 11:38:30 +02:00
Daan De Meyer 8acb02f395 TEST-02-UNITTESTS: Fix exit code checks 2024-05-30 09:59:30 +02:00
Daan De Meyer 412e2a6487 TEST-05-RLIMITS: Bump memory limits
When running with sanitizers we need more memory otherwise the unit
gets OOM killed.
2024-05-30 09:59:30 +02:00
Daan De Meyer eb47645e21 test: Use virtio-scsi for keydev drive
Otherwise qemu defaults to ide for which the module isn't always
available (e.g. it's missing in the debian linux cloud images).
2024-05-29 15:24:03 +02:00
Daan De Meyer ac09c21d45 TEST-64-UDEV-STORAGE: Replace megasas2 controller with virtio scsi controller
The virtio-scsi driver is available in the KVM/cloud kernel
packages provided by distributions whereas the megasas2 driver is
not. Let's switch to virtio-scsi so we can switch back to the KVM/cloud
kernel packages.
2024-05-29 15:24:03 +02:00
Daan De Meyer d12fedd25e mkosi: Run integration tests as root
This allows running integration tests that support it in nspawn
instead of qemu. This both gives extra coverage and speeds things up.
2024-05-29 14:10:50 +02:00
Daan De Meyer 1e5a1bbe02 test: Run tests that don't need a vm in systemd-nspawn
If we're not running the test as root, stick to using a virtual
machine, as mkosi can't do rootless nspawn yet.
2024-05-29 14:10:50 +02:00
Daan De Meyer a635b33214
Merge pull request #32562 from Werkov/test-cgroup-opensuse
Revert "TEST-19-CGROUP: Skip on opensuse"
2024-05-29 11:01:00 +02:00
Yu Watanabe 45af01d311 test-network: update comment about status of kernel regression 2024-05-29 09:07:48 +09:00
Yu Watanabe acddb3cb79 test-network: tun/tap fd may be owned by tentative worker processes
PID1 may invoke a helper process, e.g. sd-close, during the test.
So, processes other than networkd and PID1 may be shown.
```
testtap99: tap pi multi_queue vnet_hdr persist filter
        Attached to processes:systemd-network(2852)(sd-close)(2863)systemd(1)
```

Closes #33055.
2024-05-28 16:39:51 +02:00
Luca Boccassi 78247be91d
Merge pull request #33063 from keszybz/wiki-links
Update wiki links
2024-05-28 16:21:45 +02:00
Yu Watanabe 47e881ee65 test: lock device when sfdisk or mkfs
Or, trigger devices after the command incase the device is dm or md.

Fixes #33056.
2024-05-28 15:43:55 +02:00
Zbigniew Jędrzejewski-Szmek a37454bd90 man: update links to "API File Systems" 2024-05-28 14:48:56 +02:00
Zbigniew Jędrzejewski-Szmek d5c17aceb3 various: update links to more wiki pages 2024-05-28 14:48:53 +02:00
Zbigniew Jędrzejewski-Szmek 03d35b5d18 man: update links to catalog docs 2024-05-28 14:46:44 +02:00
Yu Watanabe 36c5035f2a test: suppress logs generated by journal tests
Note, journal_file_dump() is only used by tests.

Closes #33035.
2024-05-28 10:38:53 +02:00
Yu Watanabe 61fdb5b214 test: wait for the kernel finishes to attach backing file to loop device
Fixes #32680.
2024-05-28 08:49:47 +02:00
Daan De Meyer d821a1103f
Merge pull request #33038 from DaanDeMeyer/mkosi
Various integration test improvents
2024-05-27 16:12:24 +02:00
Chris Hofstaedtler 815025d767 test: fix iscsi TEST-64-UDEV-STORAGE on Debian 2024-05-27 14:33:32 +02:00
Daan De Meyer fedac4c279 test: Extend meson + mkosi integration test docs
Let's also put the meson + mkosi docs first to nudge readers towards
it instead of the old fashioned way to run the integration tests.
2024-05-27 13:59:26 +02:00
Daan De Meyer 65638f4855 Rewrite testsuite README in markdown
Let's use markdown here like we do for everything else as well.
2024-05-27 13:59:05 +02:00
Daan De Meyer e2f9f3409a meson: Look up mkosi once 2024-05-27 12:02:31 +02:00
Luca Boccassi e8b81df8b2 docs: add note about URL where to find recent Ubuntu CI logs 2024-05-27 09:50:50 +02:00
Daan De Meyer 09a2585686
Merge pull request #33013 from yuwata/journal-flush
journal: several fixlets for flushing runtime journal
2024-05-27 08:56:46 +02:00
Yu Watanabe fbe1e72eff test: use SYSLOG_IDENTIFIER= filter instead of "journalctl -u"
"journalctl -u foo.service" may not work as expected, especially entries
for _TRANSPORT=stdout, for short-living services or when the service manager
generates debugging logs. Instead, SYSLOG_IDENTIFIER= should be reliable for
stdout. Let's use it.

An example case:
```
__CURSOR=s=06278e3bf011458e973c81d370a8f7a5;i=1e4dc;b=1b0258a5c78341609bf462c72d4541c3;m=308de65;t=6194c3895a13f;x=50c7e9af5b8cfc37
__REALTIME_TIMESTAMP=1716665017803071
__MONOTONIC_TIMESTAMP=50912869
_BOOT_ID=1b0258a5c78341609bf462c72d4541c3
SYSLOG_FACILITY=3
_UID=0
_GID=0
_MACHINE_ID=d3490e076ab24968bfa19a6aab26beb3
_HOSTNAME=H
_RUNTIME_SCOPE=system
_TRANSPORT=stdout
PRIORITY=6
_PID=2668
_STREAM_ID=3f9b8855636041988d003a9c63379b8a
SYSLOG_IDENTIFIER=echo
MESSAGE=foo
```
As you can see, there is no unit identifier.
2024-05-26 11:00:22 +02:00
Yu Watanabe 7d93a340aa test: enable persistent storage for journal in TEST-82-SOFTREBOOT 2024-05-26 03:11:24 +09:00
Yu Watanabe 1ef586af23 test: applying timezone is asynchronous
So, we need to try to read timezone several times.
Also, on failure, show journal of timedated instead of hostnamed,
as the timezone is handled by timedated.

Hopefully fixes #33007.
2024-05-25 11:27:19 +02:00
Michal Koutný 307abfc83a Revert "TEST-19-CGROUP: Skip on opensuse"
This reverts commit 60d064d3fd.

The logged test failure was because of missing memory controller in
testing cgroup. With the test fixed in previous commit, memory
attributes are delegated as expected.

Ref: #32439
2024-05-23 18:05:25 +02:00
Michal Koutný 8fd755ffe6 test: Ensure delegation test unit has memory controller
When the test used to be run on distro that doesn't enable memory
accounting by default (such as openSUSE TW), there is no guarantee that
testing unit has memory.* cgroup attributes and delegation test would
fail if they are missing.

Require memory controller explicitly inside the unit so that test can
work in any environment.
2024-05-23 18:05:25 +02:00
Lennart Poettering f5faf4ec5b varlinkctl: when operating in --more mode, fail correcly on Varlink method error
In varlink.c we generally do not make failing callback functions fatal,
since that should be up to the app. Hence, in case of varlinkctl (where
we want failures to be fatal), make sure to propagate the error back
explicitly.

Before this change a failing call to "varlinkctl --more call …" would result in
a zero exit code. With this it will correctly exit with a non-zero exit
code.
2024-05-22 22:08:28 +02:00
Yu Watanabe 87ed87efe1 test: also flush and rotate journal before read
Follow-up for a610ba00d9.

Fixes #32890.
2024-05-22 12:42:09 +02:00
Yu Watanabe 505b20ecdd test: replace journal checkers with journalctl --follow + grep -m
Recently, for slow test environments, journalctl --sync was added to the
loop in the timeout. However, journalctl --sync may be slow in such systems,
and timeout easily triggered during syncing.
Hopefully, reading journal with --follow and grep the output with an expected
line should be efficient.

Hopefully fixes #32712.
2024-05-22 12:03:35 +02:00
Yu Watanabe be43c9b029 test: lock device during running cryptsetup
On running cryptsetup, udevd detects two inotify events for the
underlying device. Running the test on enough fast host, the expected
symlinks based on UUID and disk label are created by the second event.

During processing a uevent for a device, udevd disables the inotify
watch for the device. If the test runs on slow system, the second
inotify event may comes during a udev worker processing the synthesized
uevent triggered by the first inotify event. Hence, no synthesized
uevent for the second inotify event will be generated, and the expected
symlinks will be never created.

To prevent the issue, we need to lock the device during cryptsetup
command is running.

Fixes #32913.
2024-05-22 05:37:02 +09:00
Yu Watanabe bb6ce6b6a4 Revert "test: wipe filesystem before moving to the next test case"
This reverts commit 301d7ee611.

This does not solve issue #32913.
2024-05-22 05:37:02 +09:00
Luca Boccassi 2d988c149d
Merge pull request #32944 from yuwata/test-74
test: several changes for TEST-74-AUX-UTILS
2024-05-21 20:44:13 +02:00
Zbigniew Jędrzejewski-Szmek dcbf670430
Merge pull request #32957 from mrc0mmand/fix-coverage-builds
test: make TEST-65-ANALYZE happy when built with gcov
2024-05-21 18:42:08 +02:00
Yu Watanabe a5edb9b7b1 test: wait a bit before stopping/killing service
Otherwise, when stopping the service, the last command may not be
started yet, and the service manager may not send SIGTERM signal to the
last command, but send SIGKILL on timeout.

===
May 21 08:23:24 test19-exit-cgroup.sh[437]: + disown
May 21 08:23:24 test19-exit-cgroup.sh[438]: + sleep infinity
May 21 08:23:24 test19-exit-cgroup.sh[437]: + systemd-notify --ready
May 21 08:23:24 test19-exit-cgroup.sh[437]: + sleep infinity
May 21 08:23:24 test19-exit-cgroup.sh[441]: + systemctl stop one
May 21 08:23:24 test19-exit-cgroup.sh[443]: + sleep infinity
(snip)
May 21 08:23:24 systemd[1]: one.service: Changed running -> stop-sigterm
May 21 08:23:24 systemd[1]: Stopping one.service - /tmp/test19-exit-cgroup.sh "systemctl stop one"...
May 21 08:23:24 systemd[1]: Received SIGCHLD from PID 441 (systemctl).
May 21 08:23:24 systemd[1]: Child 437 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 437 belongs to one.service.
May 21 08:23:24 systemd[1]: one.service: Main process exited, code=killed, status=15/TERM (success)
May 21 08:23:24 systemd[1]: Child 439 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 439 belongs to one.service.
May 21 08:23:24 systemd[1]: Child 441 (systemctl) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 441 belongs to one.service.
May 21 08:23:24 systemd[1]: Child 442 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 442 belongs to one.service.
(snip)
May 21 08:24:54 systemd[1]: one.service: State 'stop-sigterm' timed out. Killing.
May 21 08:24:54 systemd[1]: one.service: Killing process 443 (sleep) with signal SIGKILL.
May 21 08:24:54 systemd[1]: one.service: Changed stop-sigterm -> stop-sigkill
May 21 08:24:54 systemd[1]: Received SIGCHLD from PID 443 (sleep).
May 21 08:24:54 systemd[1]: Child 443 (sleep) died (code=killed, status=9/KILL)
May 21 08:24:54 systemd[1]: one.service: Child 443 belongs to one.service.
May 21 08:24:54 systemd[1]: one.service: Control group is empty.
May 21 08:24:54 systemd[1]: one.service: Failed with result 'timeout'.
May 21 08:24:54 systemd[1]: one.service: Service restart not allowed.
May 21 08:24:54 systemd[1]: one.service: Changed stop-sigkill -> failed
May 21 08:24:54 systemd[1]: one.service: Job 738 one.service/stop finished, result=done
May 21 08:24:54 systemd[1]: Stopped one.service - /tmp/test19-exit-cgroup.sh "systemctl stop one".
May 21 08:24:54 systemd[1]: one.service: Unit entered failed state.
May 21 08:24:54 systemd[1]: one.service: Releasing resources...
===

Fixes #32947.
2024-05-21 18:35:15 +02:00
Yu Watanabe 07cbd02e9a test: collect information about loopback device on failure 2024-05-21 23:13:45 +09:00
Yu Watanabe e504f5a339 test: wait for loop/backing_file attribute being removed
Hopefully fixes issue like
https://github.com/systemd/systemd/issues/32680#issuecomment-2120959238
https://github.com/systemd/systemd/issues/32680#issuecomment-2122074805
2024-05-21 23:13:38 +09:00
Yu Watanabe 4a8ca3c6d5 test: wait for unit generated from /proc/self/mountinfo to be unloaded
Fixes https://github.com/systemd/systemd/issues/32680#issuecomment-2120974685.
===
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2475]: + mountpoint /tmp/tmp.eaRV7lSbX2/mnt
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2476]: /tmp/tmp.eaRV7lSbX2/mnt is not a mountpoint
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2449]: + systemd-mount /dev/loop0 /tmp/tmp.eaRV7lSbX2/mnt
May 21 02:45:08 systemd-mount[2477]: Failed to start transient mount unit: Unit tmp-tmp.eaRV7lSbX2-mnt.mount was already loaded or has a fragment file.
===
2024-05-21 23:09:38 +09:00
Yu Watanabe ee213b54ae test: also run some basic test cases on nspawn 2024-05-21 23:09:38 +09:00
Yu Watanabe d67e86ed67 test: stop container when it is not necessary anymore 2024-05-21 23:09:38 +09:00
Frantisek Sumsal d3c14f78cd test: add a brief comment for the chattr check
Addresses: https://github.com/systemd/systemd/pull/32907#discussion_r1605919598
2024-05-21 15:08:07 +02:00
Frantisek Sumsal 95400d1d83 test: make TEST-65-ANALYZE happy when built with gcov
systemd-analyze runs the generators in a sandbox, which makes gcov
unhappy since it can't update its counters. Let's "silence" gcov in this
particular case by telling it to look for gcov note files in /tmp (where
shouldn't be any, so gcov won't try to update any counters).
2024-05-21 15:04:22 +02:00
Yu Watanabe 702fdd3135 test: sync journal before read
Similar to recent commits, e.g. f961f0e47c2caf9af735a22e7f23210e746d0c8b.

Fixes #32926.
2024-05-21 02:00:08 +09:00
Yu Watanabe 123acb2560 test: call journalctl --sync just before reading journals
Otherwise, journal entries comes during sleep may not be read.

Follow-up for c22a112883.
2024-05-21 01:53:07 +09:00
Yu Watanabe fe816c23cf test: wait for partition device rather than the whole disk
Fixes #32931.
2024-05-20 15:05:47 +02:00
Yu Watanabe f1f1be71fe test-network: also set custom altternative name for netdevsim interface
Due to the bug in kernel 6.9 caused by
8debcf5832,
the net_id udev builtin does not work for netdevsim interface.
So, eni99np1 cannot be used with kernel 6.9 anymore.

Workaround for #32910.
2024-05-20 18:33:47 +09:00
Yu Watanabe 12e0d6ed38 test-network: split out setup_netdevsim() 2024-05-20 10:42:01 +09:00
Yu Watanabe bb84142513 test: sync journal before starting test
Follow-up for c22a112883.

Hopefully fixes #32712.
2024-05-19 22:56:37 +02:00
Yu Watanabe a610ba00d9 test: sync journal before read
Workaround for #32834 and #32890.
2024-05-19 13:54:28 +02:00
Yu Watanabe 301d7ee611 test: wipe filesystem before moving to the next test case 2024-05-19 05:10:28 +09:00
Yu Watanabe 2569e790f6 test: install modinfo to test image
Follow-up for 6c2d47d6d3.

Fixes the following unexpected skip:
```
[    6.163670] TEST-64-UDEV-STORAGE.sh[596]: + modinfo btrfs
[    6.164102] TEST-64-UDEV-STORAGE.sh[726]: /usr/lib/systemd/tests/testdata/units/TEST-64-UDEV-STORAGE.sh: line 726: modinfo: command not found
[    6.164683] TEST-64-UDEV-STORAGE.sh[727]: + echo 'This test requires the btrfs kernel module but it is not installed, skipping the test'
[    6.165069] TEST-64-UDEV-STORAGE.sh[728]: + tee --append /skipped
[    6.166801] TEST-64-UDEV-STORAGE.sh[728]: This test requires the btrfs kernel module but it is not installed, skipping the test
[    6.167177] TEST-64-UDEV-STORAGE.sh[596]: + exit 77
```
2024-05-19 05:08:31 +09:00
Yu Watanabe 19da480d3c test: wait for underlying .device unit being active before invoking systemd-mount
Fixes following failure:
===
May 17 04:12:04 TEST-74-AUX-UTILS.sh[2684]: + systemd-mount --owner=testuser /dev/loop0 /tmp/tmp.DVQdo2ou53/mnt
(snip)
May 17 04:15:04 systemd[1]: dev-loop0.device: Job dev-loop0.device/start timed out.
May 17 04:15:04 systemd[1]: dev-loop0.device: Job 5812 dev-loop0.device/start finished, result=timeout
May 17 04:15:04 systemd[1]: Timed out waiting for device dev-loop0.device - /dev/loop0.
May 17 04:15:04 systemd[1]: tmp-tmp.DVQdo2ou53-mnt.mount: Job 5804 tmp-tmp.DVQdo2ou53-mnt.mount/start finished, result=dependency
May 17 04:15:04 systemd[1]: Dependency failed for tmp-tmp.DVQdo2ou53-mnt.mount - /tmp/tmp.DVQdo2ou53/mnt.
May 17 04:15:04 systemd[1]: tmp-tmp.DVQdo2ou53-mnt.mount: Job tmp-tmp.DVQdo2ou53-mnt.mount/start failed with result 'dependency'.
May 17 04:15:04 systemd[1]: systemd-fsck@dev-loop0.service: Job 5805 systemd-fsck@dev-loop0.service/start finished, result=dependency
May 17 04:15:04 systemd[1]: Dependency failed for systemd-fsck@dev-loop0.service - File System Check on /dev/loop0.
May 17 04:15:04 systemd[1]: systemd-fsck@dev-loop0.service: Job systemd-fsck@dev-loop0.service/start failed with result 'dependency'.
May 17 04:15:04 systemd[1]: dev-loop0.device: Job dev-loop0.device/start failed with result 'timeout'.
(snip)
May 17 04:15:04 systemd-mount[2856]: A dependency job for tmp-tmp.DVQdo2ou53-mnt.mount failed. See 'journalctl -xe' for details.
2024-05-17 12:31:32 +02:00
Yu Watanabe 514458604b test: dynamically generate list of test cases
Follow-up for #32666.
2024-05-17 17:24:18 +09:00
Yu Watanabe fc5112580a test: wait for sessions being closed
If a session in closing state, the user state will be in online.

Fixes #32698.
2024-05-17 09:13:52 +02:00
Daan De Meyer c84b7a5743
Merge pull request #32875 from yuwata/network-route-wireguard
network/route: fix unexpected removal of routes for wireguard
2024-05-17 09:10:33 +02:00
Yu Watanabe 0664c1cf1d test: wait for partition device being processed by udevd
Fixes #32697.
2024-05-17 09:05:49 +02:00
Yu Watanabe 272aae38f8 test: wait for slice unit being (de)activated
Fixes #32731.
2024-05-17 09:02:23 +02:00
Daan De Meyer d42b71213a
Merge pull request #32885 from yuwata/test-do-not-fill-journal
test: do not fill journal with garbage
2024-05-17 08:54:24 +02:00
Yu Watanabe c22a112883 test: sync journal before reading journal
Otherwise, expected lines may not be processed or not sync()ed to disk.

Fixes #32712.
2024-05-17 07:46:02 +02:00
Yu Watanabe 71f0487173 test: wait for partition processed by udevd
Fixes #32695.
2024-05-17 07:43:29 +02:00
Yu Watanabe 55732636ed test: do not fill journal with diff 2024-05-17 14:17:11 +09:00
Yu Watanabe cad510b08c test: do not fill journal with "wait" 2024-05-17 14:17:11 +09:00
Yu Watanabe cd6507538a test-network: use different destination from gateway
Previously, one of the test route has the same address in destination
and gateway. Even it is a test case, that's super spurious. Let's use a
different address.
2024-05-17 09:28:49 +09:00
Daan De Meyer e182c7b4db test: Enable TEST-69-SHUTDOWN for mkosi
In mkosi, we run the test inside the VM instead of outside. To simplify
the implementation we drop the reboot part and only verify that we can
schedule and cancel shutdowns and that the wall messages are sent as
expected.
2024-05-16 18:21:32 +02:00
Daan De Meyer 11b706178c
Merge pull request #32842 from DaanDeMeyer/cryptsetup
test: Enable TEST-24-CRYPTSETUP for mkosi
2024-05-16 15:50:55 +02:00
Daan De Meyer 4ac46561e9 test: Enable TEST-24-CRYPTSETUP for mkosi
Encrypted /var is skipped because meson's limitations make per test
images not really feasible and we can't encrypt /var by default because
it slows down the image build too much.

Co-authored-by: Richard Maw <richard.maw@codethink.co.uk>
2024-05-16 14:46:37 +02:00
Luca Boccassi 88e791171a test: add coverate for Compress=yes config option
Avoid regressions like https://github.com/systemd/systemd/issues/32856

Follow-up for 2ef7cdc425
2024-05-16 14:07:46 +02:00
Zbigniew Jędrzejewski-Szmek b3aa88a475
Merge pull request #32800 from YHNdnzj/preserve-cred-mounts
switch-root: preserve the whole cred mount tree (/run/credentials/)
2024-05-16 12:45:40 +02:00
Daan De Meyer c7d16bc81b TEST-24-CRYPTSETUP: Store tokens in /usr
We want to be able to boot with empty /var.
2024-05-16 12:34:28 +02:00
Daan De Meyer 452f91d846 core: Skip private /tmp for generators in manager test runs
For manager test runs, the generator output paths are located in
/tmp, which means that if we mount a private /tmp for generators,
we lose all the generated units (actually the generators will just
fail because the directories don't exist, but if they did exist,
we'd still lose all the units).

Let's avoid the problem by skipping the private /tmp for manager
test runs. This also avoids any possible privilege issues with
mounting a private /tmp that might happen in this scenario.
2024-05-16 10:17:00 +02:00
Mike Yuan 85826351fb
TEST-82-SOFTREBOOT: test that creds for surviving units are carried over 2024-05-16 00:48:17 +08:00
Radoslav Kolev 2aee829fc8 test/test-rpm-macros.sh: add build directory to pkg-config search path
If tests are run during build time, without an already installed
systemd they fail to resolve the sysusersdir and tpmfilesdir pkg-config variables.
2024-05-15 18:25:27 +02:00
Daan De Meyer c2172400d7 TEST-08-INITRD: Fix result check 2024-05-15 13:30:10 +02:00
Daan De Meyer b13b7978e7 test: Enable TEST-08-INITRD on mkosi 2024-05-15 10:09:53 +02:00
Daan De Meyer deaa4fb41b test: Rename "shutdown initrd" to "exitrd" 2024-05-15 10:09:11 +02:00
Daan De Meyer 7379849ce0 TEST-64-UDEV-STORAGE: Give higher priority
Some of the udev storage tests can take quite a while, so let's make
sure they start early enough.
2024-05-15 08:27:26 +02:00
Daan De Meyer 4197900135 TEST-85-NETWORK: Give higher priority
Some of the networkd tests can take quite a while, so let's make sure
they start early enough.
2024-05-15 08:27:20 +02:00
Daan De Meyer be60f55c21 TEST-21-DFUZZER: Fix priority
Tests with higher priority, not lower priority are started first.
2024-05-15 08:26:34 +02:00
Daan De Meyer 985ea31173
Merge pull request #32666 from DaanDeMeyer/mkosi-network
test: Add TEST-85-NETWORK to run systemd-networkd-tests.py
2024-05-15 07:30:04 +02:00