Commit graph

1742 commits

Author SHA1 Message Date
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 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 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 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
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
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 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
Daan De Meyer c2172400d7 TEST-08-INITRD: Fix result check 2024-05-15 13:30:10 +02:00
Daan De Meyer deaa4fb41b test: Rename "shutdown initrd" to "exitrd" 2024-05-15 10:09:11 +02:00
Luca Boccassi e0d13e719e
Merge pull request #32830 from yuwata/home-skel
home: fix ownership of files copied from skelton directory
2024-05-15 01:26:15 +02:00
Yu Watanabe 82260fc426 test: add tests for "homectl --skel" 2024-05-15 06:39:05 +09:00
Daan De Meyer f0888bb297 TEST-21-DFUZZER: Fix script name 2024-05-14 23:38:45 +02:00
Daan De Meyer aaebebb7bd TEST-64-UDEV-STORAGE: Fix drive ID 2024-05-14 18:23:59 +02:00
Daan De Meyer f2c6afa6c0 TEST-64-UDEV-STORAGE: Skip LVM subtests on Ubuntu
These fail for unknown reasons on Ubuntu. Until someone from Ubuntu
who cares can figure out why, let's skip these tests on Ubuntu.
2024-05-14 12:43:28 +02:00
Daan De Meyer 2cf6f55b72 TEST-64-UDEV-STORAGE: Bump timeout for testcase_simultaneous_events_1
The timeout is reliably hit when running tests in mkosi.
2024-05-14 12:43:28 +02:00
Daan De Meyer 6c2d47d6d3 TEST-64-UDEV-STORAGE: Skip btrfs_basic if btrfs module is not available 2024-05-14 12:43:28 +02:00
Daan De Meyer d760e2a8c3 TEST-64-UDEV-STORAGE: Check for tgt and tgtd services
On Debian/Ubuntu, the unit is named tgt.service instead of tgtd.service,
so let's make sure we take that into account.

On CentOS, tgtd.service is not available, so let's skip the test if we
can't find the service.
2024-05-14 12:43:28 +02:00
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 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 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 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 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
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 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 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 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 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 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
Richard Maw 7afb533711 TEST-21-DFUZZER: Skip test if dfuzzer is not installed 2024-05-06 10:56:55 +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 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
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
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 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 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 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