Commit graph

560 commits

Author SHA1 Message Date
Jan Engelhardt 4094130b6f test: drop route from test-functions
I do not see `route` being exercised anywhere else, everything seems
to be on `ip route` already.
2024-02-27 17:51:56 +00:00
David Tardon dfdcc7c987 test: add a test for #31384 2024-02-19 16:45:19 +00:00
Frantisek Sumsal 18c769b0ff Revert "test: use btrfs by default on Arch as well"
There's something very wrong going on when using btrfs for the test
images, namely:
  - there's a significant performance hit, i.e. the Arch Linux run is
    ~20% slower, in the coverage run the situation is even worse
  - intermittent boot failures
  - intermittent "No space left on device" errors (even though there's
    enough free space)

Since debugging this might take a while, let's temporarily revert back
to ext4 to make the CI stable again.

This reverts commit 7eb7e3ec4f.
2024-02-19 11:43:54 +01:00
Frantisek Sumsal bce0fa7da1 test: don't abbreviate log messages when dumping the test journal
To make debugging test fails easier.
2024-02-17 12:49:44 +01:00
Frantisek Sumsal adafa3b2f8 test: always try to install the ext4 module
So the tests work even if the base image filesystem is not ext4.
2024-02-17 12:49:44 +01:00
Frantisek Sumsal 7eb7e3ec4f test: use btrfs by default on Arch as well 2024-02-17 12:49:44 +01:00
Frantisek Sumsal 8cc42169f1 test: add test cases for journal corruption on btrfs
For issue #24150 and #31222.
2024-02-16 03:48:18 +09:00
Franck Bui 08abfd0b8c test: make sure to install the filesystem package in the test image on SUSE
Othewise test images are missing the tmpfiles snippets used to create the very
basic files at boot, which can be useful when a test wants to reuse the OS tree
(is already running in) for spawning a new container in pristine state.
2024-02-14 10:21:33 +01:00
Franck Bui 03b1e10fc8 test: install systemd-boot in openSUSE test images
Needed since 87282a337d1ba7dc7d755f53b46c64b43718dcf7.
2024-02-13 18:13:21 +01:00
Lennart Poettering b68f4cade4 dissect: add --make-archive option to convert DDI to tarball 2024-01-25 18:47:39 +01:00
Frantisek Sumsal a0b50e4d25 test: use systemd-id128 from the build dir
As distro sd-id128 might not have all the options we need.

Follow-up for: 378712c
Replaces: #30901
2024-01-12 14:34:04 +00:00
Frantisek Sumsal 378712c830 test: use correct type for the root partition 2024-01-12 03:48:22 +09:00
Frantisek Sumsal ec6c7bac5c test: fix dbus installation on Arch
Arch finally made dbus-broker the default dbus daemon [0], but unlike
Fedora they don't use Alias=dbus.service to make the dbus.symlink under
/etc, instead they create the symlink manually under /usr/lib, so let's
account for that.

[0] b24d15795a
2024-01-11 12:01:42 +00:00
Frantisek Sumsal 91da9458f8 test: allow sanitized binaries to dump a core
If a binary built with ASan crashes for a reason unrelated to ASan
stuff, we're left with pretty much nothing, as there is neither an ASan
trace nor a coredump. Let's make this slightly more debug-able by
allowing such binaries to dump a core, but without the huge shadow map
(we should be actually fine by just setting disable_coredump=0, since
use_madv_dontdump defaults to true, but let's play it safe and not
potentially dump a 16+ TB core file).
2024-01-04 20:36:25 +01:00
Frantisek Sumsal 7eb234fe2b test: install correct kpartx udev rules on Ubuntu
Follow-up for 519f0074cf.
2024-01-04 20:28:37 +01:00
Frantisek Sumsal 519f0074cf test: install correct kpartx udev rules on Debian
Resolves: #30703
2024-01-04 05:24:20 +09:00
Frantisek Sumsal 77baca26f5 test: show journal entries matching the test's syslog identifier as well 2023-12-29 21:26:49 +01:00
Lennart Poettering a19e7f3101
Merge pull request #30321 from yuwata/find-esp
find-esp: gracefully handle btrfs RAID
2023-12-18 15:11:54 +01:00
Frantisek Sumsal 58bcbad86c test: don't check for -Dinstall-tests=true with NO_BUILD=1 2023-12-14 23:11:12 +01:00
Frantisek Sumsal fdd380dde2 test: install empty directories with NO_BUILD=1
Resolves: #30478
2023-12-14 23:11:12 +01:00
Frantisek Sumsal f9ba9d3eb7 test: install all necessary units & generators for LVM on Debian
And derivates.

Replaces: #30458
2023-12-13 23:56:14 +09:00
Yu Watanabe 97bbb9cfbd test: create ESP and xbootldr partitions 2023-12-13 14:28:30 +09:00
Yu Watanabe 0f236e8cd6 test: mask mdmonitor when building image
Follow-up for 22e31655f3.
2023-12-13 14:28:03 +09:00
Yu Watanabe 4ed943e97b test: make install_mdadm() also install relevant kernel modules
Installing mdadm without kernel modules is mostly meaningless.
2023-12-13 14:19:28 +09:00
Yu Watanabe 5b4fa6f13c test: split out host_has_{btrfs,mdadm}() from TEST-64-UDEV-STORAGE 2023-12-13 14:19:28 +09:00
Frantisek Sumsal 52c1fb6885 test: set correct group for systemd-journal-upload tests
We can't use the systemd-journal-upload user here, since it's created
dynamically by DynamicUser=yes. However, we can use the group specified
in SupplementaryGroups=, so do exactly that.
2023-12-05 09:07:14 +01:00
Yu Watanabe fa316d553c test: show saved journal files after TEST-02-UNITTESTS 2023-11-28 04:10:25 +09:00
Frantisek Sumsal 60f9c49b16 test: remove the reboot counter just before spawning container/VM
Doing that in test_run() is not enough, since it's called only once and
spawns all QEMU/nspawn jobs.
2023-11-25 20:22:24 +01:00
Frantisek Sumsal fa6f37c043 test: don't redirect stdout/stderr to console
Turns out that redirecting a lot of output to the console can have some
funny effects, like random kernel soft lockups. I spotted this in
various CIs, but it remained almost entirely hidden thanks to
`softlockup_panic=1`, until 1a36d2672f which introduced a couple of
tests that log quite a lot in a short amount of time. This, in
combination with newer kernel version, which, for some reason, seem to
be more susceptible to such soft lockups, made the Arch Linux jobs soft
lockup quite a lot, see [0].

While debugging this I also noticed that runs which don't redirect
stdout/stderr to the console are noticeably faster, e.g.:

    # TEST-71 nspawn + QEMU (KVM), StandardOutput=journal+console
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:24.64
    # TEST-71 nspawn + QEMU (KVM), StandardOutput=journal
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:17.95

    # TEST-71 nspawn + QEMU, StandardOutput=journal+console
    Elapsed (wall clock) time (h:mm:ss or m:ss): 2:04.70
    # TEST-71 nspawn + QEMU, StandardOutput=journal
    Elapsed (wall clock) time (h:mm:ss or m:ss): 1:44.48

    # TEST-04 QEMU, StandardOutput=journal+console
    Elapsed (wall clock) time (h:mm:ss or m:ss): 4:22.70
    # TEST-04 QEMU, StandardOutput=console
    Elapsed (wall clock) time (h:mm:ss or m:ss): 5:04.67

Given all this, let's effectively revert ba7abf79a5, and dump the
testsuite-related journal messages only after the test finishes, so they
don't go through the slow console.

Resolves: systemd/systemd-centos-ci#660

[0] https://github.com/systemd/systemd-centos-ci/issues/660
2023-11-24 18:00:07 +01:00
Frantisek Sumsal 09bdb9f121 test: clean up the save_journal() stuff a bit
Let's save all journals from the test machine instead of calling export
on each journal file separately, which makes the code less complicated
(and probably faster).
2023-11-24 11:51:27 +01:00
Frantisek Sumsal f258a76332 test: don't use ddebug() before it's defined
I'm pretty sure this is not the only case, but it's the one I recently
noticed. Even though we call ddebug() from a function, that function is
called before ddebug() is defined, resulting in the same issue as if we
called just ddebug() in its place, i.e.:

..//test-functions: line 276: ddebug: command not found
2023-11-20 21:26:17 +01:00
Frantisek Sumsal 6162caa288 test: move a couple of binaries to the BASICTOOLS array
As they're not optional.
2023-11-20 21:26:14 +01:00
Frantisek Sumsal 8ddbd9e078 test: support NO_BUILD=yes on Fedora 2023-11-20 21:26:11 +01:00
Frantisek Sumsal b54bc139ae test: make the LOOKS_LIKE_* variables proper booleans 2023-11-20 21:26:08 +01:00
Frantisek Sumsal 5ef964f88c test: make TEST-06-SELINUX work with the refpolicy and beef it up a bit
Currently the test works only with policy shipped by Fedora, which makes
it pretty much useless in most of our CIs. Let's drop the custom module
and make the test more generic, so it works with the refpolicy as well,
which should allow us to run it on Arch and probably even in Ubuntu CI.
2023-11-14 18:54:16 +01:00
Frantisek Sumsal 4f3d8def18 test: don't pre-process $KERNEL_APPEND
Let's just rely on the word splitting done by bash instead of messing
with that ourselves, as it's just adding extra complexity to appease one
ShellCheck check. Also, this apparently never worked for the nspawn
stuff anyway, since I forgot to set $IFS to an appropriate value, so it
always put all arguments from $KERNEL_APPEND into a single array item
with an extra newline, which then made systemd sad:

~# readarray arr <<< "foo bar baz"; for i in "${arr[@]}"; do echo "'$i'"; done
'foo bar baz
'
~# make -C test/TEST-45-TIMEDATE/ clean setup run BUILD_DIR=$PWD/build TEST_NO_QEMU=1 KERNEL_APPEND="systemd.log_level=console"
...
~# journalctl -o short-monotonic --no-hostname --file /var/tmp/systemd-tests/systemd-test.XaDX67/system.journal --grep "Failed to parse" -p info --no-pager
[551138.986882] systemd-tmpfiles[21]: Failed to parse log level 'console
[551138.987179] systemd-remount-fs[20]: Failed to parse log level 'console
[551138.993125] systemd-sysusers[23]: Failed to parse log level 'console
[551138.998685] journalctl[29]: Failed to parse log level 'console

Resolves: #29945
2023-11-09 16:31:12 +00:00
Frantisek Sumsal 4e086c389a Revert "test: don't panic on soft lockups"
Let's put this back in, as it could help with occasional machine lock ups
on overloaded systems (and it didn't help with the original issue
anyway).

This reverts commit 3a89904e45.
2023-11-03 20:38:31 +00:00
Maanya Goenka db776f6935 portable: add support for confext
Support confexts for portable services
2023-11-03 16:59:58 +00:00
Frantisek Sumsal af70e2021e test: add a couple more tests for systemd-pcrextend 2023-10-25 18:18:47 +02:00
Frantisek Sumsal 5ab2f737cd test: introduce $TEST_SKIP_SHUTDOWN
To get rid of some boilerplate.
2023-10-24 12:35:03 +02:00
Franck Bui a1af99df8e test: install af_packet kernel module on openSUSE
Currently needed by test-dhcp-server unit test, af_packet is not built-in on
openSUSE distributions.
2023-10-21 11:39:10 +01:00
Frantisek Sumsal a2dd592002 test: unify checking for user xattrs support in cgroupfs
Also, run the coredump forwarding test only if user xattrs are
supported.
2023-10-19 18:01:07 +01:00
Frantisek Sumsal c1b129f4ad test: introduce TEST-09-REBOOT
To test stuff involving state preserved across (multiple) reboots, like
journal boot IDs.
2023-09-27 14:50:19 +02:00
Frantisek Sumsal 7f048f0ed0 test: enable debug logs for the user instances as well
To make debugging [0], hopefully, easier.

[0] https://github.com/systemd/systemd/issues/28504
2023-09-25 15:24:11 +01:00
Frantisek Sumsal 18c3ffbfcc test: wait for the swtpm socket to appear
On slower/overloaded systems it may take a bit for the swtpm socket
to show up:

I: Started swtpm as PID 189419 with state dir /tmp/tmp.pWqUutuGUj
I: Configured emulated TPM2 device tpm-spapr
+ tee /var/tmp/systemd-test-TEST-70-TPM2_1/console.log
+ timeout --foreground 1200 /bin/qemu-system-ppc64le -smp 4 ...
qemu-system-ppc64le: -chardev socket,id=chrtpm,path=/tmp/tmp.pWqUutuGUj/sock: Failed to connect to '/tmp/tmp.pWqUutuGUj/sock': No such file or directory
E: qemu failed with exit code 1

Spotted regularly in the ppc64le cron job and in some Ubuntu CI/CentOS CI
pr runs [0].

[0] https://github.com/systemd/systemd/pull/29183#issuecomment-1721727927
2023-09-23 11:32:12 +01:00
Frantisek Sumsal 3a89904e45 test: don't panic on soft lockups
We can't do anything about them anyway, and most importantly this seems
to alleviate systemd/systemd-centos-ci#660, which should make the CIs
a bit less angry (at least until the issue is addressed properly).
2023-09-23 14:19:55 +08:00
Frantisek Sumsal 5599c84bcd test: fix debugging of nspawn tests
The pipe stuff introduced in 701e0c2660 causes nspawn to switch the
console from 'interactive' into 'read-only' which is a bit useless when
debugging. Let's set --console=interactive explicitly in such case.

Follow-up to 701e0c2660.
2023-08-29 01:08:08 +01:00
Mathieu Tortuyaux 41712cd1c0 sysext: support EXTENSION_RELOAD_MANAGER metadata
This metadata (EXTENSION_RELOAD_MANAGER) can be set to "1" to reload the manager
when merging/refreshing/unmerging a system extension image. This can be useful in case the sysext
image provides systemd units that need to be loaded.

With `--no-reload`, one can deactivate the EXTENSION_RELOAD_MANAGER metadata interpretation.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2023-08-21 11:13:54 +02:00
Maanya Goenka b856f1dfc5 test: add test for confext service-scoped support 2023-08-15 18:34:57 +00:00
Frantisek Sumsal cb16b72e9c test: correctly propagate return code from check_result hooks 2023-08-11 16:57:06 +02:00