1
0
mirror of https://github.com/systemd/systemd synced 2024-07-09 04:26:06 +00:00
Commit Graph

5074 Commits

Author SHA1 Message Date
Daan De Meyer
3e550801e7 TEST-64-UDEV-STORAGE: Add missing udevadm settle
Otherwise we try to do the check before the udev queue is empty which
will make it fail.
2024-05-14 12:43:28 +02:00
Daan De Meyer
b37ed039f0 TEST-64-UDEV-STORAGE: Use virtio-scsi-pci instead of ahci
The debian cloud kernel does not support ahci, so let's use
virtio-scsi-pci everywhere instead.
2024-05-14 12:43:28 +02:00
Daan De Meyer
f41b6394d5 TEST-64-UDEV-STORAGE: Use ID based paths 2024-05-14 12:43:28 +02:00
Daan De Meyer
eb4c962aa4 test: Ignore configure scripts in minimal images
These are always aimed at the system image so ignore any specified
configure scripts in the minimal images.
2024-05-14 12:43:28 +02:00
Daan De Meyer
31c797e03d test: Add cmdline field to configure extra kernel command line args
Configuring extra cmdline arguments as a list is much nicer than
having to pass the --kernel-command-line-extra argument manually.
2024-05-14 12:43:28 +02:00
Daan De Meyer
348f5017a4 test: Generate basic testsuite services with meson
Most of these are identical, let's just generate from a meson
template.
2024-05-14 12:43:28 +02:00
Daan De Meyer
20e94309a7 TEST-46-HOMED: Simplify service unit
Let's remove the unneeded NotifyAccess=all and start the socket
and service in the test itself instead of via the service unit. This
makes the test unit identical to the other test units which will allow
us to autogenerate it in a later commit.
2024-05-14 12:43:28 +02:00
Daan De Meyer
f6af2976aa TEST-06-SELINUX: Simplify auto-relabeling
Let's ship a .autorelabel file so we can get rid of
firstboot-autorelabel.service.
2024-05-14 12:43:28 +02:00
Daan De Meyer
c87e243fef test: Rename mkosi_args to mkosi-args 2024-05-14 12:43:28 +02:00
Daan De Meyer
4ce12c3933 test: Disable tests via 'enabled' field
This allows doing other stuff with the test without actually defining
the test, such as generating a service unit automatically.
2024-05-14 12:43:28 +02:00
Daan De Meyer
f483e08313 test: Simplify argument/variable names 2024-05-14 12:43:28 +02:00
Daan De Meyer
7a321b5a21 test: Rename testsuite-XX units to match test name
Having these named differently than the test itself mostly creates
unecessary confusion and makes writing logic against the tests harder
so let's rename the testsuite-xx units and scripts to just use the
test name itself.
2024-05-14 12:43:28 +02:00
Daan De Meyer
5748f13e54 test: Rework integration test definitions
Let's make this behave more like all the rest of the meson stuff.
This also is the first step to making it a bit more flexible so we
can define integration tests in different ways as will be seen in
the next commits.
2024-05-14 12:43:28 +02:00
Daan De Meyer
cbb8c52a0f TEST-01-BASIC: Drop logic to run test without install-tests=true
We don't support this for any other tests either so let's drop the
support for running TEST-01-BASIC without installing as well to make
the upcoming commit easier to implement.
2024-05-14 12:43:28 +02:00
Daan De Meyer
3c0a1b1e70 core: Imply DefaultDependencies=no for credential mounts
Currently, on soft-reboot, /run/credentials/@system is unmounted
because it has DefaultDependencies=yes and as such will have
Conflicts=umount.target and Before=umount.target. Let's make sure
credential mounts survive soft-reboot by implying DefaultDependencies=no
for credential mounts.
2024-05-14 12:42:45 +02:00
Daan De Meyer
034e85c5f3 TEST-38-FREEZER: Relax regex a little
The state might be "freezing-by-parent" as well so let's take that
into account.

Fixes #32746
2024-05-13 15:19:40 +02:00
Daan De Meyer
82c2214539 debug-generator: Allow specifying name of unit-dropin credential
A fixed name is too rigid, let's give users the ability to define
custom drop-in names which at the same time also allows defining
multiple dropins per unit.

We use ~ as the separator because:
- ':' is not allowed in credential names
- '=' is used to separate credential from value in mkosi's --credential
  argument.
- '-' is commonly used in filenames
- '@' already has meaning as the unit template specifier which might be
  confusing when adding dropins for template units
2024-05-11 19:46:15 +02:00
Yu Watanabe
7ef26afca5 test-network: simplify and unify waiting loop
Also,
- drop unused fail_assert arguments,
- use wait_links() and check_networkd_log() in wait_activated().
2024-05-11 02:13:34 +09:00
Yu Watanabe
acc06d8a68 test-network: make link_exists() take multiple arguments
This also improves performance of test_delete_links().
2024-05-11 02:13:34 +09:00
Yu Watanabe
d22f2fb912 test-network: check existence of kernel bug
This adds checks for the kernel bug caused by
3ddc2231c8,
it will be fixed by
https://patchwork.kernel.org/project/netdevbpf/patch/20240510072932.2678952-1-edumazet@google.com/
2024-05-10 20:39:56 +09:00
Yu Watanabe
e92d7b7dd9 test-network: introduce --no-journal option
This should be useful when the test run as a service, e.g.
running on a mkosi image.
2024-05-10 20:39:30 +09:00
Luca Boccassi
086b277dc7
Merge pull request #32743 from yuwata/test-network-for-mkosi
test-network: several improvements for running with mkosi
2024-05-10 11:27:14 +02:00
Yu Watanabe
b2062ee2d9 test: wait for network interface reconfigured after updating config
Otherwise, at this stage, the interface may be in e.g. initialized or
pending state, and the drop-in file introduced by the previous command
may not be registered to the state file for the interface.

Fixes #32685.
2024-05-10 09:16:21 +02:00
Yu Watanabe
24e37929ed test-network: do not fail when /etc/protocols does not exist
Also this makes several checks more strict.
2024-05-10 15:16:20 +09:00
Yu Watanabe
2a4f9139d9 test-network: do not fail test_macvlan() with old kernel or ip command 2024-05-10 14:36:38 +09:00
Yu Watanabe
e97bb361a0 test-network: do not fail if macvlan module is not available 2024-05-10 14:33:38 +09:00
Daan De Meyer
6c5d4f0645 TEST-46-HOMED: Ignore "Disk Usage" field as well
This can change between the call to homectl inspect and userdbctl
user so let's ignore it along with the other disk fields.

Fixes #32727
2024-05-09 11:02:45 +02:00
Daan De Meyer
904b8ae47a TEST-04-JOURNAL: Sleep more in delegated cgroup filtering script
We already changed logs-filtering.service to sleep 2 seconds before
exiting to combat flakyness, let's do the same for the delegated
cgroup filtering payload.

Fixes #32696 (hopefully)
2024-05-08 12:27:35 +02:00
Daan De Meyer
65690de6f9 TEST-81-GENERATORS: Do a lazy unmounts
Otherwise we might fail if PID 1 is currently accessing these files.

Fixes #32692 (hopefully)
2024-05-08 12:27:24 +02:00
Daan De Meyer
a35edc9ad4 TEST-74-AUX-UTILS: Make more robust
Let's run mkfs on the file we create instead of the loop device and
let's use udevadm wait --settle to wait for udev to settle before
doing anything with the loop device

Fixes #32680 (hopefully)
2024-05-08 11:35:15 +02:00
Daan De Meyer
b438ebd7bc TEST-07-PID1: Fix race in aux-scope subtest
Currently test-aux-scope.service can get killed by the test before
it's had a chance to setup its signal handler. Make it Type=notify
to fix the race.

Fixes #32670 (hopefully)
2024-05-08 10:20:20 +02:00
Daan De Meyer
0d13ca5544 test: Mark TEST-21-DFUZZER as slow and skip it by default
The test is not really useful without sanitizers, so let's mark it
as slow and not run it by default in CI.
2024-05-07 19:06:42 +02:00
Daan De Meyer
f1f87f3b2e test: Add infra to mark integration tests as slow
Some integration tests take much more time than others, let's add
a test param that can be used to configure this and integrate it
with the slow-tests meson option.
2024-05-07 19:06:42 +02:00
Daan De Meyer
a77f65d0c9 ci: Print a helpful link to download and view a failed test's journal 2024-05-07 19:06:39 +02:00
Daan De Meyer
ca2e19f2b7 test: Don't keep journals for skipped tests
Let's make sure we don't save journals for tests that were skipped.
2024-05-07 17:34:42 +02:00
Daan De Meyer
f3548f28b3 meson: Fix formatting 2024-05-06 18:16:24 +02:00
Daan De Meyer
77962e1242 mkosi: Enable more integration tests 2024-05-06 11:57:09 +02:00
Daan De Meyer
1f2c9bda49 test: Default to linux qemu firmware
Direct kernel boot results in much faster boot times so let's use
it by default.

We disable it for tests that need to reboot because +-50% of the
time, doing a reboot when using direct kernel boot causes qemu to
hang on reboot. Until we figure that out, let's use UEFI for the
tests that need to reboot.
2024-05-06 11:57:09 +02:00
Daan De Meyer
a90bba42f4 TEST-46-HOMED: Skip barely fits test on ext4
For some reason this fails on ext4 with "No space left on device".
Until we figure out why, let's skip the test on ext4 (which is reported
as ext2/ext3 by stat).
2024-05-06 11:57:09 +02:00
Daan De Meyer
7a273d6570 TEST-46-HOMED: Only run resize tests on btrfs
Other filesystems do not support online shrinking.
2024-05-06 11:57:09 +02:00
Daan De Meyer
6ff6b2e29b TEST-53-ISSUE-16347: Add rtc configuration for qemu 2024-05-06 11:57:09 +02:00
Daan De Meyer
9e71acab00 TEST-55-OOMD: Configure init.scope credential in mkosi image 2024-05-06 11:57:09 +02:00
Daan De Meyer
8f5095ff74 TEST-55-OOMD: Skip on opensuse
opensuse does not have the stress tool packaged.
2024-05-06 11:57:09 +02:00
Richard Maw
9be49de41f TEST-55-OOMD: swapoff before adding new swapfile
When running test images built with read-only /usr
a swap partition is likely so needs to be turned off first.
2024-05-06 11:57:09 +02:00
Daan De Meyer
f1d3962e61 TEST-04-JOURNAL: Skip bsod test if systemd-bsod is not installed
systemd is built without qrencode support on CentOS which means
systemd-bsod will not be installed. Let's skip the test if that's
the case.
2024-05-06 11:57:09 +02:00
Daan De Meyer
f74fb048f9 TEST-04-JOURNAL: Run with persistent journal
This test depends on having the journal in /var/log/journal.
2024-05-06 11:57:09 +02:00
Daan De Meyer
0214a8fd75 TEST-04-JOURNAL: Make more robust
Avoid hitting https://github.com/systemd/systemd/issues/2913 by adding
some more sleeps. This is required to make the test pass when executed
with mkosi on my machine.
2024-05-06 11:57:09 +02:00
Daan De Meyer
e86afb0314 TEST-07-PID1: Schedule exit on successful execution
The test unit has RemainAfterExit=yes so let's schedule our own
shutdown from the test itself once we finish running.
2024-05-06 11:57:09 +02:00
Richard Maw
c5073aa204 TEST-07-PID1: Test access to allocated loop instead of loop0
loop0 and 1 can be used by systemd-repart and vanish
but we can guarantee that $LODEV was allocated and is available.
2024-05-06 11:57:09 +02:00
Daan De Meyer
733d0594f0 TEST-07-PID1: Lower TriggerLimitIntervalSec= unconditionally
It shouldn't hurt to do this when KVM is enabled or we're not collecting
coverage so let's just always lower the trigger limit interval.
2024-05-06 11:57:09 +02:00
Richard Maw
7590e1d037 TEST-07-PID1: Move mount units to test dir
To load the units it is sufficient to add them to the units directory
and it's a step towards not needing any customisations for this test.
2024-05-06 11:57:09 +02:00
Daan De Meyer
b95bb3b3bb TEST-70-TPM2: Call udevadm wait after attaching disk image
Otherwise /dev/loop0p1 might not exist when calling
systemd-cryptsetup attach.
2024-05-06 11:57:09 +02:00
Daan De Meyer
6b146cef3f TEST-70-TPM2: Add dependency on tpm2.target
Let's make sure the TPM is available before running the test as the
test makes use of it.
2024-05-06 11:57:09 +02:00
Daan De Meyer
e631cc91e0 TEST-74-AUX-UTILS: Use persistent journal
This test depends on having the journal in /var/log/journal.
2024-05-06 11:57:09 +02:00
Daan De Meyer
3d5c6ece1c TEST-74-AUX-UTILS: Drop usage of loop module
This module is builtin on ubuntu causing the test to fail. Let's
use just dummy instead. I tried replacing it with scsi_debug but
that caused issues with modprobe complaining it could not remove
scsi_debug because it was in use.
2024-05-06 11:57:09 +02:00
Daan De Meyer
da87c35f35 TEST-74-AUX-UTILS: Skip run0 test if pam snippet is not installed 2024-05-06 11:57:09 +02:00
Daan De Meyer
a2190c22b8 TEST-74-AUX-UTILS: Make sure at least two locales exist 2024-05-06 11:57:09 +02:00
Richard Maw
8c9d241c55 TEST-74-AUX-UTILS: Support running on UEFI systems 2024-05-06 11:57:00 +02:00
Richard Maw
fe8d7d25d5 TEST-74-AUX-UTILS: Support systems with pre-existing modules config 2024-05-06 10:58:47 +02:00
Richard Maw
b7b6bdc9e0 TEST-74-AUX-UTILS: Support credential-provided root SSH public key
When root authorized keys are provided by mkosi they are not
newline-terminated so appending a public key to the file results
in a corrupt key, so just to be safe we add an empty line.
2024-05-06 10:58:24 +02:00
Daan De Meyer
904fc035cb TEST-75-RESOLVED: Ignore resource record ifindex field
Depending on host configuration this may or may not be included (e.g.
on mkosi we get a result without an ifindex field). Let's strip it from
the resolved reply to avoid failing the test.
2024-05-06 10:56:55 +02:00
Daan De Meyer
9cd3e292c6 TEST-75-RESOLVED: Add missing sleep after knotc reload
We already have this workaround for knotc reload a little further
in the test, let's apply it to our first invocation of knotc reload
as well.
2024-05-06 10:56:55 +02:00
Daan De Meyer
a37e58a156 TEST-75-RESOLVED: Restart systemd-networkd
systemd-networkd might already be running, let's make sure we restart
it if it is already running.
2024-05-06 10:56:55 +02:00
Daan De Meyer
9a4f925b57 TEST-75-RESOLVED: Move knot configuration to /usr/lib/systemd/tests/testdata
This allows the logic to install the configuration to be done inside
the test itself which allows it to be shared with mkosi.
2024-05-06 10:56:55 +02:00
Daan De Meyer
ae25df53bf TEST-21-DFUZZER: Give higher priority
This test takes a long time to run. Let's make sure it is started
first to avoid it being the only test running for a long time at the
end.
2024-05-06 10:56:55 +02:00
Daan De Meyer
ca72b8f6f8 TEST-21-DFUZZER: Bump timeout to 1h 2024-05-06 10:56:55 +02:00
Richard Maw
7afb533711 TEST-21-DFUZZER: Skip test if dfuzzer is not installed 2024-05-06 10:56:55 +02:00
Daan De Meyer
e3ab65cff3 test: Fix udev storage test name 2024-05-06 10:56:55 +02:00
Daan De Meyer
15faee5309 test: Add missing TEST-69-SHUTDOWN to list 2024-05-06 10:56:54 +02:00
Daan De Meyer
3beefac9eb test: Remove flaky test comments
These two tests don't seem to fail in CI, so let's remove the comments
about flakyness.
2024-05-06 10:56:54 +02:00
Daan De Meyer
d91bb1cbf0 test: Always shutdown on test success in mkosi
When we want to get an interactive shell in a test that fails because
of a race condition, we might need to run the test a few times with
--repeat before it fails. However, currently, when -i is used, the VM
needs to be shut down manually each time before the next run can start.

Let's always shut down the VM if the test succeeds so that --repeat can
be used with -i to run the test until it fails and then get an interactive
shell in the VM.
2024-05-06 10:56:54 +02:00
Daan De Meyer
0596237e0e test: Use MESON_TEST_ITERATION if available
This allows running the same test multiple times concurrently with
meson's --repeat option. Proposed upstream but not yet merged:
https://github.com/mesonbuild/meson/pull/13177.
2024-05-06 10:56:54 +02:00
Daan De Meyer
3cb61e0d1c test: Pass through test matching environment variables to the mkosi VM 2024-05-06 10:56:54 +02:00
Daan De Meyer
38db5eff34 test: Only set environment variable if integration tests are enabled.
If we set it to '0' if integration tests are not enabled then we can't
enable them from the command line since environment from meson takes
priority over environment variables from the command line.

We also rename the related variables to avoid conflicts with the
existing integration_tests variable.
2024-05-06 10:56:54 +02:00
Daan De Meyer
bdade5f597 test: Formatting fixes 2024-05-06 10:56:43 +02:00
Daan De Meyer
54d0507223 meson: Add missing spdx line 2024-05-05 14:49:21 +02:00
Daan De Meyer
ea07a6d45d meson: Test installation fixes
Let's use the new follow_symlinks flag instead on newer meson to.
We also switch back to copying symlinks instead of following them
and add an exclude for 25-default.link which becomes dangling when
installed and recreate it manually instead.
2024-05-05 14:49:21 +02:00
Daan De Meyer
69e02d94f5 meson: Remove --debug from mkosi arguments
The exit status issue for which we introduced this was fixed so
let's remove --debug again to make the meson output less verbose.
2024-05-05 14:49:21 +02:00
Luca Boccassi
72007bbc9b
Merge pull request #32588 from CodethinkLabs/mkosi-selinux
Add TEST-06-SELINUX to mkosi integration tests
2024-05-04 20:48:55 +02:00
Frantisek Sumsal
568d97953b test: replace Europe/Kiev with Europe/Kyiv
As the former is deprecated and might not be available (i.e. on Ubuntu
Noble it's only available after installing the tzdata-legacy package).
2024-05-04 12:52:49 +02:00
Richard Maw
ab9d60250e test: Enable TEST-06-SELINUX testing with mkosi 2024-05-03 12:57:11 +01:00
Richard Maw
a2a734e737 test: Integrate custom selinux relabelling unit with firstboot 2024-05-03 12:57:11 +01:00
Richard Maw
049b456d9a test: Skip TEST-06-SELINUX early if not on fedora/centos
Other distributions may be able to install selinux
but they are not expected to use it.

The distribution is tested rather than whether selinux is enabled
because it is expected to work on CentOS and Fedora
and we want it to fail noisily.
2024-05-03 12:57:11 +01:00
Luca Boccassi
0fee0c0780 test: drop --tpm2-public-key= from TEST-70
Fixes test failure

Follow-up for 03e3b2672b
2024-05-03 10:16:46 +02:00
Mike Yuan
49a4badb7d
Merge pull request #32595 from bluca/old_docs
Remove outdated documents
2024-05-02 03:45:00 +08:00
Yu Watanabe
8bf27cd010
Merge pull request #32611 from DaanDeMeyer/qdisc
network/tc: Avoid concurrent set modification in tclass_drop()/qdisc_drop()
2024-05-02 00:51:31 +09:00
Daan De Meyer
f2adc1de89 test-network: Make source directory optional 2024-05-01 16:15:20 +02:00
Daan De Meyer
e9b066ff92 test: Follow symlinks when copying with rsync
We have e.g. 25-default.link in test-network/ which becomes a broken
symlink when installed so let's not copy the symlinks but follow them
instead so they don't become broken.
2024-05-01 16:15:20 +02:00
Daan De Meyer
6be4dab095 systemctl: Implement --wait for kill command
TEST-26-SYSTEMCTL is racy as we call systemctl is-active immediately
after systemctl kill. Let's implement --wait for systemctl kill and
use it in TEST-26-SYSTEMCTL to avoid the race.
2024-05-01 09:40:32 +02:00
Luca Boccassi
c8de1a8c56 docs: move information from AUTOPKGTEST.md to test/README.testsuite and delete it
This is not information that needs to be published on systemd.io as it's
purely internal, so the README is enough
2024-05-01 01:30:12 +01:00
Daan De Meyer
4b1edf5cc6 test: Add disabled mkosi tests to meson.build
Makes it easier to track which ones still need to be fixed.
2024-04-30 22:10:05 +02:00
Richard Maw
f2018d060f test: Enable more mkosi integration tests 2024-04-30 22:10:05 +02:00
Daan De Meyer
51273281cd test: Bump mkosi integration test timeout to 1800 seconds
Same timeout as the bash framework.
2024-04-30 22:10:05 +02:00
Daan De Meyer
9a69900a4b test: Make journal storage configurable per test and make persistent for TEST-09-JOURNAL
Also fix a bug in the logic since it's 'volatile' and not 'runtime'.
2024-04-30 22:10:05 +02:00
Daan De Meyer
b8afa59583 test: Drop /usr overlay workaround
/usr is not erofs anymore in the mkosi images so let's drop the
workaround where we mount a writable tmpfs on top of /usr.
2024-04-30 22:10:05 +02:00
Daan De Meyer
db07533f74 Revert "TEST-25-IMPORT: Skip if importctl not installed"
This reverts commit dcb17e3295.

importctl is now correctly installed on opensuse, so no need for
this workaround anymore.
2024-04-30 22:10:05 +02:00
Daan De Meyer
27246d2bb6 TEST-71-HOSTNAME: Ignore error from reset-failed
On OpenSUSE the systemd-hostnamed does not fail and is unloaded which
causes reset-failed to fail. So let's ignore any errors from reset-failed
to make the test more robust.
2024-04-30 22:10:05 +02:00
Daan De Meyer
b676bbbfc6 TEST-46-HOMED: Check for sshd pam snippet in /usr/lib/pam.d as well
opensuse ships pam snippets in /usr/lib/pam.d.
2024-04-30 22:10:05 +02:00
Daan De Meyer
e290b45dfa TEST-82-SOFTREBOOT: Exit with exit status 123
Required to make mkosi consider the test successful.
2024-04-30 22:10:05 +02:00
Daan De Meyer
e1f17dc641 TEST-35-LOGIN: Exclude manager entry in testcase_sanity_check()
Otherwise we try to kill the wrong session.
2024-04-30 22:10:05 +02:00
Daan De Meyer
b03c2d51b2 TEST-18-FAILUREACTION: Exit with 123 on success
mkosi expects the virtual machine/container to exit with exit status
123 on success so let's make sure that's the case.
2024-04-30 22:10:05 +02:00
Daan De Meyer
8c89620e80 TEST-09-REBOOT: Make journalctl grep pattern more specific
We might be rotating because we reached limits, which is perfectly
fine, so don't fail if that happens.
2024-04-30 22:10:05 +02:00
Daan De Meyer
409c8a8ee0 TEST-13-NSPAWN: Skip on virtiofs
The rootfs only has 64K UIDs available when booting with virtiofs,
whereas the nspawn tests want to use user namespace which require
more than 64K UIDs.
2024-04-30 22:10:05 +02:00
Richard Maw
3630f5aaf8 TEST-13-NSPAWN: move disk images to /var/tmp
/tmp may not be large enough to contain disk images
and will result in strange errors when it runs out of space.
2024-04-30 22:10:02 +02:00
Richard Maw
047d5b6a32 TEST-13-NSPAWN: move container template to /usr/share
Having directories in / causes problems for make-root-on-boot images
2024-04-30 18:17:13 +02:00
Daan De Meyer
b81ece59c4 TEST-04-JOURNAL: Make LogFilterPatterns= tests more robust
Let's use oneshot services as we don't need long running services
for the tests we're doing. Let's also increase the sleeps a little
as the current values weren't sufficient when running the test locally
on my machine with mkosi.
2024-04-30 18:17:13 +02:00
Daan De Meyer
191a31fbcf TEST-83-BTRFS: Skip if root filesystem is not btrfs 2024-04-30 18:17:13 +02:00
Richard Maw
37029ce769 TEST-35-LOGIN: Handle multiple lock messages per sleep
If 3 lock messages get sent when going to sleep
then we can falsely assume we have woken up if we only assume we have at least two
so checking we have more than we did before sleeping addresses that issue.
2024-04-30 18:17:13 +02:00
Daan De Meyer
27f166c523 mkosi: Use systemd.crash_action=poweroff in integration tests
Some integration tests expect to be able to reboot so switch to using
the new systemd.crash_action=poweroff instead.
2024-04-30 17:01:41 +02:00
Daan De Meyer
e911a335ed mkosi: Mask systemd-networkd-wait-online when --runtime-network=none
Otherwise it will wait forever waiting for an interface to appear.
See https://github.com/systemd/systemd/issues/29388.
2024-04-30 17:01:41 +02:00
Daan De Meyer
d99deaaaea mkosi: Disable --runtime-scratch=no for tests
Breaks TEST-83-BTRFS if enabled.
2024-04-30 17:01:41 +02:00
Daan De Meyer
06489e8332 mkosi: Make sure our extra kernel command line overrides the config one 2024-04-30 17:01:41 +02:00
Frantisek Sumsal
9fe18055fe test: exclude gperf files from captured coverage
Recent lcov started complaining loudly about unknown lines in gperf
files:

...
Found gcov version: 13.2.1
Using intermediate gcov format
Recording 'internal' directories:
...
Finished processing 1634 GCNO files
Apply filtering..
Message summary:
  1 error message:
    range: 1
  28 warning messages:
    gcov: 27
    usage: 1
geninfo: ERROR: (range) unknown line '33' in /build/src/home/homed-gperf.gperf: there are only 22 lines in the file.
  Use 'geninfo --filter range' to remove out-of-range lines.
        (use "geninfo --ignore-errors range ..." to bypass this error)

Since we drop the coverage of built files from the final report anyway,
let's do it also when capturing both initial and real coverage to avoid
this error.
2024-04-30 15:42:45 +02:00
Daan De Meyer
c89244842b test: Don't persist journal in mkosi image if we're not debugging tests
If we're not debugging tests, there's no point in persisting the journal,
so let's use the volatile journal storage mode in that case to avoid doing
unnecessary work.

We don't disable journal storage alltogether since various tests check
that stuff is written to the journal.
2024-04-30 15:20:55 +02:00
Daan De Meyer
1ce32f2f5f TEST-81-GENERATORS: Use SYSTEMD_PROC_CMDLINE more
Makes the test more robust as the command line the image is booted
won't influence the test result.
2024-04-30 10:45:35 +02:00
Daan De Meyer
7a66f21556 core: Add systemd.crash_action= kernel command line argument
Required for integration tests to power off on PID 1 crashes. We
deprecate systemd.crash_reboot and related options by removing them
from the documentation but still parsing them.
2024-04-29 14:34:22 +02:00
Sebastian Pucilowski
e6c4b5dc52 network: DHCP version logging typos
Some DHCP client log messages report "DHCP4" or "DHCP6" instead of
"DHCPv4" or "DHCPv6" as used within the rest of the codebase. Typos
fixed.
2024-04-28 11:47:55 +09:00
Daan De Meyer
4c36bbdfd7
Merge pull request #32439 from CodethinkLabs/simple-mkosi-integration-tests
Enable some simple mkosi integration tests
2024-04-26 20:48:00 +02:00
Richard Maw
66fb77a8bf test/meson.build: Add some runnable integration tests 2024-04-26 17:25:55 +01:00
Richard Maw
337d246faf TEST-81-GENERATORS: Clean /proc/cmdline of unusual mounts 2024-04-26 17:25:55 +01:00
Richard Maw
90eee2cf0f TEST-36-NUMAPOLICY: Bump PID1 strace time to 3 seconds
CI can be slow and only waiting 1 second makes it flaky there.
2024-04-26 17:25:55 +01:00
Richard Maw
4114b723f9 TEST-26-SYSTEMCTL: Create /etc/init.d if needed
OpenSUSE doesn't disable sysv compat but also may not have anything in
/etc/init.d.
2024-04-26 17:25:55 +01:00
Richard Maw
dcb17e3295 TEST-25-IMPORT: Skip if importctl not installed
machinectl import-* was split out into importctl
which is a separately configurable component to machinectl
and might not always be available.
2024-04-26 17:25:34 +01:00
Richard Maw
60d064d3fd TEST-19-CGROUP: Skip on opensuse
OpenSUSE images seem to be unhappy with either how they are built
or what they are being asked to do.

The listed device-mapper failure is just one of the strange errors,
I have also seen it fail to propagate cgroup properties into new cgroups
that were previously guaranteed to exist.
2024-04-26 17:23:53 +01:00
Richard Maw
8ccba68cb5 TEST-17-UDEV: Skip credentials test if service not loaded
It does not appear to exist on OpenSUSE yet.
2024-04-26 17:22:10 +01:00
Frantisek Sumsal
516652bbfd test: mountnfsd -> mountfsd
I keep accidentally writing mountnfsd instead of mountfsd, and a couple
of instances managed to get into the repo.
2024-04-26 17:14:07 +02:00
Richard Maw
ab5f60cb23 test: Disable network by default in mkosi tests 2024-04-26 15:55:42 +01:00
Daan De Meyer
dcbf0be1b7 TEST-50-DISSECT: Don't log image contents to console
These can contain quite a few files, so let's not write every single
file and directory straight to the console to speed things up.
2024-04-26 13:51:49 +02:00
Daan De Meyer
536b5c0748
Merge pull request #32445 from DaanDeMeyer/mkosi-images
mkosi: Build minimal images and enable related integration tests
2024-04-25 21:59:23 +02:00
Daan De Meyer
c77dad706b mkosi: Build minimal images and enable related integration tests
This commit adds definitions to build the minimal_0 and minimal_1
images with mkosi and includes them into the system image. We also
move the building of the various app-xxx and similar images that are
extremely minimal into the tests itself by moving the related logic
from install_verity_minimal() into a new function
install_extension_images() in util.sh. Because the mkosi /usr is
read-only, we now place the extension images in /tmp instead of
/usr/share.

Co-authored-by: Richard Maw <richard.maw@codethink.co.uk>
Co-authored-by: sam-leonard-ct <sam.leonard@codethink.co.uk>
2024-04-25 21:06:30 +02:00
Daan De Meyer
69dc36f69b TEST-50-DISSECT: Make sure logging sockets are mounted into images
Otherwise we lose valuable logging from systemd-executor when things
go wrong since it can only log to the journal and not to the console
in these cases.
2024-04-25 19:39:31 +02:00
Luca Boccassi
d1c4174d69
Merge pull request #32475 from bluca/skip
test: skip testsuite-50.mountnfsd if kernel/polkit are too old
2024-04-25 18:48:57 +02:00
Daan De Meyer
cf5e1b5d39 test: Skip meson integration tests if SYSTEMD_INTEGRATION_TESTS != 1
We cannot mark a test suite as excluded by default in meson. Instead,
let's require that SYSTEMD_INTEGRATION_TESTS=1 and skip any integration
test if it's not set. This is effectively the same as excluding it by
default. If the integration-test option is enabled, we'll set the
environment variable by default, just like we do with SYSTEMD_SLOW_TESTS
and the slow-tests meson option.
2024-04-25 17:06:40 +02:00
Luca Boccassi
f9419fe610 test: skip testsuite-50.mountnfsd if kernel/polkit are too old
Need full support of pidfd to work, so skip the test if it's not
available
2024-04-25 13:32:35 +01:00
Luca Boccassi
c790537b89 test: use sd-analyze for kernel version check in TEST-62 2024-04-25 13:32:10 +01:00
Lennart Poettering
3c1d1ca146 manager: switch service unit type over to using new handoff timestamping logic
Also: rename Handover → Handoff. I think it makes it clearer that this
is not really about handing over any resources, but that the executor is
out off the game from that point on.
2024-04-25 13:40:41 +02:00
Daan De Meyer
2fcf8bf3b1
Merge pull request #32465 from CodethinkLabs/mkosi-debug
mkosi: Build images and run mkosi tests with --debug to aid debugging in CI
2024-04-24 21:02:41 +02:00
Daan De Meyer
5ae6ff1258 TEST-50-DISSECT: Skip mutable sysext tests on virtiofs
virtiofs cannot be used as the upper fs for overlayfs, so skip all
the sysext mutable tests that would try to use virtiofs as the
upper fs.
2024-04-24 19:30:00 +02:00
Richard Maw
125b2fee18 test: Add --debug when running mkosi through integration-test-wrapper 2024-04-24 18:27:07 +01:00
Daan De Meyer
c709499a4e TEST-50-DISSECT: Use --apparent-size when calling du
Otherwise if the file is full of holes we get the wrong size and
we'll fail later on.
2024-04-24 15:51:37 +02:00
Daan De Meyer
2a9184b902 TEST-50-DISSECT: Skip mountfsd test if the user namespace interface is not supported 2024-04-24 15:51:35 +02:00
Richard Maw
2fd849016b test: Shut down tests on crash
If an assert in systemd fails it can't shut down normally.

By default it freezes. For interactive runs we want the crash shell
to enable further debugging, but during test runs we want it to exit
without having to wait for the test timeout.

By deactivating the crash shell, enabling reboot, and configuring qemu
so that it shuts down instead of rebooting we can shut down instead.

Because by default UEFI will enroll keys and then reboot
we also have to set --qemu-firmware-variables=custom
so it doesn't need to auto-enroll.

Because mkosi has to handle not receiving an EXIT_STATUS notification
it falls back to the exit code of qemu, which in the case of reboot
would be 0, we also override the success exit status to 123
and check that we got that as an exit code from mkosi.
2024-04-24 11:01:45 +02:00
Richard Maw
796cf1b483 test: document when writable /usr overlays may be needed 2024-04-24 11:01:45 +02:00
Daan De Meyer
b85e54961c test: Various mkosi integration test improvements
- Stop using logging module since the default output formatting is
  pretty bad. Prefer print() for now.
- Log less, logging the full mkosi command line is rather verbose,
  especially when it contains multi-line dropins.
- Streamline the journalctl command we output for debugging failed
  tests.
- Don't force usage of the disk image format.
- Don't force running without unit tests.
- Don't force disabling RuntimeBuildSources.
- Update documentation to streamline the command for running a single
  test and remove sudo as it's not required anymore.
- Improve the console output by having the test unit's output logged
  to both the journal and the console.
- Disable journal console log forwarding as we have journal forwarding
  as a better alternative.
- Delete existing journal file before running test.
- Delete journal files of succeeded tests to reduce disk usage.
- Rename system_mkosi target to just mkosi
- Pass in mkosi source directory explicitly to accomodate arbitrary
  build directory locations.
- Add test interactive debugging if stdout is connected to a tty
- Stop explicitly using the 'system' image since it'll likely be
  dropped soon.
- Only forward journal if we're not running in debugging mode.
- Stop using testsuite.target and instead just add the necessary
  extras to the main testsuite unit via the credential dropin.
- Override type to idle so test output is not interleaved with
  status output.
- Don't build mkosi target by default
- Always add the mkosi target if mkosi is found
- Remove dependency of the integration tests on the mkosi target
  as otherwise the image is always built, even though we configure
  it to not be built by default.
- Move mkosi output, cache and build directory into build/ so that
  invocations from meson and regular invocations share the same
  directories.
- Various aesthetic cleanups.
2024-04-23 10:32:42 +02:00
Daan De Meyer
741d59b326 test: Rework TEST-02-UNITTESTS
Currently, A large amount of unit test output is logged directly
to the console instead of to the per test log file as any subprocesses
executed by a test manager will detect that stderr is not connected
to the journal and log directly to /dev/console instead.

To solve this issue, let's make sure all tests are connected directly
to the journal by running them with systemd-run. We also simplify the
entire test script by getting rid of the custom queue and replicating
it with xargs instead. By using bash's function export feature, we can
make our run_test() function available to the bash subprocess spawned
by xargs.

Once a test is finished, we read its logs from the journal and put them
in the appropriate file if needed.
2024-04-22 19:37:13 +02:00
Lennart Poettering
f92868db4e
Merge pull request #32369 from DaanDeMeyer/serial
terminal-util: Enable line wrapping in reset_terminal_fd()
2024-04-22 17:48:14 +02:00
Luca Boccassi
edd3d4d7c2 nspawn: ensure single-process container running as --user can access credentials
When starting a container with --user, the new uid will be resolved and switched to
only in the inner child, at the end of the setup, by spawning getent. But the
credentials are set up in the outer child, long before the user is resolvable,
and the directories/files are made only readable by root and read-only, which
means they cannot be changed later and made visible to the user.

When this particular combination is specified, it is obvious the caller wants
the single-process container to be able to use credentials, so make them world
readable only in that specific case.

Fixes https://github.com/systemd/systemd/issues/31794
2024-04-22 15:47:44 +02:00
Daan De Meyer
f57705d67d terminal-util: Enable line wrapping in reset_terminal_fd()
The qemu seabios firmware disables serial console line wrapping. Let's
make sure we re-enable it again when we reset a terminal to some sane
defaults.

To avoid potentially blocking on writing to the terminal, we put it
in nonblocking mode and add a timeout of 50ms.
2024-04-22 15:28:26 +02:00
Luca Boccassi
93cb78aee2 core: add ExecMainHandoverTimestamp property recording time-of-execve
Enable the exec_fd logic for Type=notify* services too, and change it
to send a timestamp instead of a '1' byte. Record the timestamp in a
new ExecMainHandoverTimestamp property so that users can track accurately
when control is handed over from systemd to the service payload, so
that latency and startup performance can be trivially and accurately
tracked and attributed.
2024-04-22 15:16:05 +02:00
Yu Watanabe
0fe4a1c870 test-network: add test for [IPv6SendRA] ReachableTimeSec= and RetransmitSec= 2024-04-22 18:42:56 +09:00
Lennart Poettering
b7866fa6aa
Merge pull request #31987 from flatcar-hub/krnowak/usr-perm-check
sysext: Fix issues with merged hierarchy mode
2024-04-22 11:14:35 +02:00
Yu Watanabe
d51377ac42 test-network: add test for global UseDomains= setting 2024-04-20 12:01:53 +09:00
Luca Boccassi
565f6130b2
Merge pull request #32142 from bluca/portable_vpick
portable: support vpick
2024-04-19 20:34:16 +02:00
Luca Boccassi
8257508c58 portable: support vpick
Resolve at attach/detach/inspect time, so that the image is pinned and requires
re-attaching on update, given files are extracted from it so just passing
img.v/ to RootImage= is not enough to get a portable image updated
2024-04-19 13:25:32 +01:00
Krzesimir Nowak
d74d69ae53 test: Make the sysext test to run with --root and without
I was bitten several times by testing things only with --root flag, so this
commit prepares the existing test cases to run on / too. This required the test
cases to clean up after themselves, thus I have put each test case in a
separate subshell and used traps to do the cleanups.

I needed to change the hierarchy used by the test extension to /opt, because
unmounting /usr often failed with EBUSY.
2024-04-19 10:24:17 +02:00
Krzesimir Nowak
60c335a4bc test: Do not limit hierarchies 2024-04-19 07:20:52 +02:00
Krzesimir Nowak
140f834333 test: Add sysext test case for checking valid mutable directory mode 2024-04-19 07:18:38 +02:00
Krzesimir Nowak
6aab53b175 test: Add sysext test-cases for checking mode preservation 2024-04-19 07:15:01 +02:00
Luca Boccassi
e54bf3fe0b
Merge pull request #32299 from yuwata/network-radv-ignore-rs-from-the-same-interface
network/radv: ignore RS message from the same interface
2024-04-18 23:45:06 +02:00
Lennart Poettering
dd37963aff
Merge pull request #31790 from poettering/pcrlock-policy-fix
Replace PolicyAuthValue by PolicySigned as access policy for pcrlock policy nvindex
2024-04-18 21:11:27 +02:00
Luca Boccassi
0c8bda7dc3
Merge pull request #32121 from CodethinkLabs/basic-mkosi-integration-tests
Basic mkosi integration tests
2024-04-18 21:02:41 +02:00
Lennart Poettering
36769db1b0 ci: update tests to showcase new option a bit 2024-04-18 18:12:24 +02:00
Richard Maw
945b722f13 test: Add mkosi-based integration test runner
The first two tests are included to ensure parallel test execution is
demonstrable.
2024-04-18 16:26:38 +01:00
Luca Boccassi
966d7977c7 portablectl: add --clean parameter for detaching
Calls CleanUnit on each portable service being removed, after it has
stopped
2024-04-18 10:47:29 +01:00
Yu Watanabe
3b4eeccd27 test-network: add test case of RS sent by the same interface 2024-04-18 09:40:23 +09:00
Yu Watanabe
45c2bbbaea test-network: introduce check_networkd_log() helper function 2024-04-18 09:40:23 +09:00
Yu Watanabe
864c7980c0 test-network: drop trailing spaces
Follow-up for fb57300743.
2024-04-18 09:40:23 +09:00
Yu Watanabe
88382e8dab test: fix typo
Follow-up for 236634c82c.
2024-04-17 13:29:39 +09:00
Yu Watanabe
e27f2ad6be
Merge pull request #32300 from mrc0mmand/assorted-tweaks
test: split TEST-50-DISSECT into smaller parts
2024-04-17 11:52:30 +09:00
Sam Leonard
b6183109cb
test-64-udev-storage: partition disk inside testcase - testcase_multipath_basic_failover 2024-04-16 17:02:31 +01:00
Sam Leonard
211062e3b5
test-64-udev-storage: partition disk inside testcase - testcase_virtio_scsi_identically_named_partitions 2024-04-16 16:18:55 +01:00
Sam Leonard
8d82e39046
test-64-udev-storage: partition disk inside testcase - testcase_long_sysfs_path 2024-04-16 16:18:36 +01:00
Frantisek Sumsal
236634c82c test: rework systemd-sysext test
Let's rework the test a bit, namely:
  - condense the code a bit
  - drop unnecessary braces around variables
  - drop unnecessary explanations around `touch` calls
  - drop/rename functions to make the code more self-explanatory
  - simplify cleanup a bit
  - create R/O bind mounts directly (supported since util-linux 2.27)
2024-04-16 14:25:57 +02:00
Frantisek Sumsal
5f42fae2f1 test: simplify unit check 2024-04-16 14:25:57 +02:00
Frantisek Sumsal
5d259f1236 test: split some overly long lines
Let's get the line count back up again by splitting some overly long
lines in hopes to make the code slightly more readable.
2024-04-16 14:25:57 +02:00
Frantisek Sumsal
ccb2671539 test: split TEST-50-DISSECT into smaller parts
As the current version has almost 2k lines.
2024-04-16 14:25:57 +02:00
Yu Watanabe
78d5bad2f5
Merge pull request #32294 from yuwata/network-generator-creds
network-generator: also load drop-ins for networkd.conf from credentials
2024-04-16 16:42:59 +09:00
Yu Watanabe
9c202ba2e2 test: add test case for 'networkctl cat' without arguments 2024-04-16 13:31:14 +09:00
Yu Watanabe
9a4a8fbe48 test: add test case for network.conf.* credential 2024-04-16 12:45:08 +09:00
Yu Watanabe
a3e4edd1af test: add test for systemd-udev-load-credentials.service 2024-04-16 10:35:13 +09:00
Yu Watanabe
b2800ec597 udevadm-control: check if control command really specified
Previously, 'udevadm control' only checked the number of the arguments.
So, if only `--timeout` is specified, it spuriously did nothing and succeeded.
This makes the command request at least one control command.
2024-04-16 09:42:20 +09:00
Luca Boccassi
a4328b284e
Merge pull request #32258 from yuwata/network-tc-fix-stack-overflow
network/tc: fix stack overflow
2024-04-15 22:34:39 +02:00
Yu Watanabe
ae9fd433d6
Merge pull request #32194 from henryli001/lihl/add-defaultUseDomains-config
network: add mechanism to configure default UseDomains= setting
2024-04-14 13:40:06 +09:00
Henry Li
fb57300743 network: add mechanism to configure default UseDomains= setting, update man page and add test 2024-04-13 16:54:31 -07:00
Yu Watanabe
e6fa91195b test-network: add test for stack overflow in qdisc_drop() and tclass_drop() 2024-04-13 09:39:55 +09:00
Frantisek Sumsal
844af666ed test: add instructions on how to run Coverity locally
This requires a Coverity license, so the usefulness of the instructions
is somewhat limited, but at least I won't have to re-discover everything
from scratch when I need to debug something Coverity-related again in the
future.
2024-04-12 14:42:00 +02:00
Yu Watanabe
9944629eee network/ndisc: fix verification of sender of Redirect message
The sender must be the first-hop router of the destination. Previously,
we only accepted Redirect messages whose sender is the current default
router with the highest priority.

See RFC 4861 section 8.1 for more details.

Fixes #31981.
2024-04-12 04:59:42 +09:00
Yu Watanabe
2e73aa507b network/ndisc: do not set per-route MTU and hop limit
Setting MTU announced in RA message to routes is problematic, as the
value may be larger than the device MTU (IFLA_MTU), and in such case the
route cannot be used.

These two properties are now set per-interface, and gracefully handled
such invalid cases. Hence not necessary to set them to each route.

Follow-up for #32195.
2024-04-12 04:59:38 +09:00
Frantisek Sumsal
6d13aacaac test: make sd-journal-gatewayd tests even more debug-able
Unfortunately bfd30e8af6 is not enough and the test fails, that still
occasionally occur, don't provide enough information to see what's
wrong. Let's rework the test a little to improve this, namely:

  - redirect curl's output into a temporary file instead of piping it
    directly into the "check" expression; that way we can simply dump
    the temporary file when the test fails, providing potentially
    crucial information. We don't want to always dump everything to
    stdout, as some of the tests request an entire system journal (note
    that shell redirection instead of `curl -o file` is used
    intentionally, so the output file is always nuked first)
  - by dropping the pipes in curl commands we can re-enable pipefail
  - also, split some very long commands to multiple lines to (slightly)
    improve readability

Follow-up for bfd30e8af6.
2024-04-11 14:42:45 +02:00
Frantisek Sumsal
8d9cdb31f7 test: make the output of TEST-69 less painful to read
The logs from TEST-69 still contain a lot of unnecessary shell
metacharacters, so to make the output more readable let's just set
TERM=dumb, instead of having to strip everything semi-manually. Also,
move the related --background= tweak to TEST-69, since it's relevant
only for that particular test.

Follow-up for 8d4bfd38ed.
2024-04-11 11:35:17 +02:00
Luca Boccassi
798ea5c05a
Merge pull request #32181 from YHNdnzj/open-file
Some fixes/improvements for OpenFile=
2024-04-10 23:15:56 +01:00
Luca Boccassi
d0ea800943
Merge pull request #32195 from yuwata/network-ndisc-mtu
network: several cleanups for IPv6 MTU
2024-04-10 23:12:21 +01:00
Luca Boccassi
bf5e509840
Merge pull request #32166 from yuwata/network-rfc7217-dad
network: generate another address on conflict
2024-04-10 22:59:01 +01:00
Mike Yuan
48c21790ba
test: merge TEST-77-OPENFILE into TEST-23-UNIT-FILE
And add coverage for #32179
2024-04-10 21:49:28 +08:00
Yu Watanabe
a0430b0d95 test-network: add test case for ndisc MTU option 2024-04-10 12:24:33 +09:00
Frantisek Sumsal
515eb678a0 test: wait until the test container is fully booted up
TEST-69 still occasionally times out in CI and appears to be stuck on
boot, so let's see if this helps the situation a bit.
2024-04-09 21:39:46 +02:00
Frantisek Sumsal
8d4bfd38ed test: disable background color for nspawn containers
As it makes the logs really messy in certain tests.
2024-04-09 21:39:46 +02:00
Frantisek Sumsal
04f0c6752c test: set pexpect's logfile early
So we capture the container's boot as well.
2024-04-09 21:39:46 +02:00
Frantisek Sumsal
721e78ff73 test: give sd-resolved enough time to timeout
The timeout on sd-resolved's side is 5-10s (UDP or TCP), but dig's
default timeout is 5s. Let's give sd-resolved enough time to timeout
before either giving up or checking if it served stale data on dig's
side.

Resolves: #31639
2024-04-09 21:39:46 +02:00
Frantisek Sumsal
bfd30e8af6 test: let curl show a potential error in silent mode
I collected a couple of fails in this particular test, but without any
output they're impossible to debug. Let's make this slightly less
annoying and let curl show an error (if any) even in silent mode.

This patch uncovers that curl has been (silently) complaining about not
being able to write to the output destination, because `grep -q`
short-circuits on the first match and doesn't bother reading the rest,
so replace `grep -q` with `grep ... >/dev/null` to force grep to always
read the whole thing from curl.
2024-04-09 21:39:46 +02:00