Commit graph

5028 commits

Author SHA1 Message Date
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
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 9e262ef92e test: Enable TEST-54-CREDS on mkosi 2024-05-14 23:19:28 +02:00
Daan De Meyer aa09f3078f test: Add TEST-85-NETWORK to run systemd-networkd-tests.py
This adds a testsuite unit to run systemd-networkd-tests.py. This is
mkosi only for now as python is not available in the images set up
by the bash framework. We give the test a lower priority as it takes
a while to run so we want to start it as soon as possible.
2024-05-14 22:58:50 +02:00
Daan De Meyer 15c1a7855c test: Allow using TEST_MATCH_TESTCASE with systemd-networkd-tests.py 2024-05-14 22:58:28 +02:00
Daan De Meyer 4222f81597 test: Enable TEST-82-SOFTREBOOT on mkosi 2024-05-14 21:41:59 +02:00
Daan De Meyer aaebebb7bd TEST-64-UDEV-STORAGE: Fix drive ID 2024-05-14 18:23:59 +02:00
Daan De Meyer 1d9b8f3476 test: Only add tpm2.target dependency to TEST-70-TPM2.service
Let's not add the dependency unless required.
2024-05-14 15:36:49 +02:00
Daan De Meyer 5692f87160 test: Run TEST-64-UDEV-STORAGE with mkosi
We add a configure script for each subtest to add the required
qemu arguments.

Co-authored-by: Richard Maw <richard.maw@codethink.co.uk>
2024-05-14 12:43:28 +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 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