1
0
mirror of https://github.com/systemd/systemd synced 2024-07-08 20:15:55 +00:00
Commit Graph

577 Commits

Author SHA1 Message Date
Frantisek Sumsal
2ac0e52f29 test: dump a simple summary at the end of TEST-02-UNITTEST
Let's dump a list of skipped tests and logs from failed tests at the end
of TEST-02-UNITTEST to make debugging fails in CI slightly less painful.
2024-06-12 14:04:10 +01:00
Chris Hofstaedtler
815025d767 test: fix iscsi TEST-64-UDEV-STORAGE on Debian 2024-05-27 14:33:32 +02: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
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
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
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
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
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
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
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
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
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
Lennart Poettering
625646815b test: add integration test for unpriv mountfsd/nsresourced 2024-04-06 16:09:10 +02:00
Lennart Poettering
1d98716ef7 libkmod: turn into dlopen() dependency
As it turns out libkmod has quite a bunch of deps, including various
compressing libs and similar. By turning this into a dlopen()
dependency, we can make our depchain during install time quite a bit
smaller. In particular as inside of containers kmod doesn't help anyway
as CAP_SYS_MODULE is not available anyway.

While we are at it, also share the code that sets up logging/kmod
context.

After:

$ lddtree ./build/systemd
systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2)
    libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so
        libaudit.so.1 => /lib64/libaudit.so.1
            libcap-ng.so.0 => /lib64/libcap-ng.so.0
                ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
        libm.so.6 => /lib64/libm.so.6
        libmount.so.1 => /lib64/libmount.so.1
            libblkid.so.1 => /lib64/libblkid.so.1
        libseccomp.so.2 => /lib64/libseccomp.so.2
        libselinux.so.1 => /lib64/libselinux.so.1
            libpcre2-8.so.0 => /lib64/libpcre2-8.so.0
    libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so
        libacl.so.1 => /lib64/libacl.so.1
            libattr.so.1 => /lib64/libattr.so.1
        libcap.so.2 => /lib64/libcap.so.2
        libcrypt.so.2 => /lib64/libcrypt.so.2
        libgcrypt.so.20 => /lib64/libgcrypt.so.20
            libgpg-error.so.0 => /lib64/libgpg-error.so.0
        liblz4.so.1 => /lib64/liblz4.so.1
        libcrypto.so.3 => /lib64/libcrypto.so.3
            libz.so.1 => /lib64/libz.so.1
        libpam.so.0 => /lib64/libpam.so.0
            libeconf.so.0 => /lib64/libeconf.so.0
        liblzma.so.5 => /lib64/liblzma.so.5
        libzstd.so.1 => /lib64/libzstd.so.1
    libc.so.6 => /lib64/libc.so.6

Before:

$ lddtree ./build/systemd
systemd => ./build/systemd (interpreter => /lib64/ld-linux-x86-64.so.2)
    libsystemd-core-255.so => ./build/src/core/libsystemd-core-255.so
        libaudit.so.1 => /lib64/libaudit.so.1
            libcap-ng.so.0 => /lib64/libcap-ng.so.0
                ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
        libkmod.so.2 => /lib64/libkmod.so.2
            libzstd.so.1 => /lib64/libzstd.so.1
            liblzma.so.5 => /lib64/liblzma.so.5
            libz.so.1 => /lib64/libz.so.1
            libcrypto.so.3 => /lib64/libcrypto.so.3
            libgcc_s.so.1 => /lib64/libgcc_s.so.1
        libm.so.6 => /lib64/libm.so.6
        libmount.so.1 => /lib64/libmount.so.1
            libblkid.so.1 => /lib64/libblkid.so.1
        libseccomp.so.2 => /lib64/libseccomp.so.2
        libselinux.so.1 => /lib64/libselinux.so.1
            libpcre2-8.so.0 => /lib64/libpcre2-8.so.0
    libsystemd-shared-255.so => /home/lennart/projects/systemd/build/src/shared/libsystemd-shared-255.so
        libacl.so.1 => /lib64/libacl.so.1
            libattr.so.1 => /lib64/libattr.so.1
        libcap.so.2 => /lib64/libcap.so.2
        libcrypt.so.2 => /lib64/libcrypt.so.2
        libgcrypt.so.20 => /lib64/libgcrypt.so.20
            libgpg-error.so.0 => /lib64/libgpg-error.so.0
        liblz4.so.1 => /lib64/liblz4.so.1
        libpam.so.0 => /lib64/libpam.so.0
            libeconf.so.0 => /lib64/libeconf.so.0
    libc.so.6 => /lib64/libc.so.6
2024-04-04 18:16:45 +02:00
Luca Boccassi
8707c9b244 gcrypt: dlopenify for libsystemd
gcrypt is used only for journal sealing operations in libsystemd, so it
can be made into a dlopen dependency that is used only on demand. This
allows to reduce the footprint of libsystemd in the most common cases.

Keep systemd-pull and systemd-resolved with normal linking, as they are
executables, and usually built with OpenSSL support anyway.
2024-04-03 11:50:25 +01:00
Frantisek Sumsal
607be850b9 test: make coverage runs happy with capsule@.service
capsule@.service uses DynamicUser=yes, so let's use the same tweak we
use for other such units.
2024-03-28 23:29:46 +00:00
Luca Boccassi
a82cf4902d test: delete private images on clean-again
Private images are not reused, they are unique to tests, so delete them
as they take a lot of disk space, and we are starting to run in /var/tmp
space issues on the Ubuntu CI
2024-03-21 11:08:18 +00:00
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