Commit Graph
5873 Commits
Author SHA1 Message Date
Luca Boccassi a3dc2bbf96 test: use /run/ for test configuration, not /etc/
In case of failures we don't want to leave an image with intermediate
test configuration, as images are reused across multiple tests

Follow-up for edca63a632
2025-04-25 06:13:43 +09:00
Daan De Meyer 45f63c3db7 test: Add custom signal handlers to integration test wrapper script
meson will send SIGTERM if the test gets stuck and hits the timeout,
in which case we still want to do log saving and analysis, so let's
add some signal handlers which allow us to do that.

This won't be very useful until https://github.com/mesonbuild/meson/pull/14513
lands, since we only get half a second from meson to handle SIGTERM
before it sends SIGKILL, but let's land this already so we immediately
start taking advantage of the meson fix once it lands.
2025-04-25 06:11:43 +09:00
Yu Watanabe 28659e1eac TEST-82-SOFTREBOOT: add test case for uevents generated during soft-reboot 2025-04-23 10:48:51 +09:00
Lennart Poettering edca63a632 test: add integration test for concurrency limits 2025-04-22 18:56:01 +02:00
Daan De Meyer 505492d61c udev: serialize queued events on exit (#37047)
Previously, all queued events were discarded on exit, hence several
events might not be processed by udevd when it is restarted. Such
situation especially easily happens on switching root.

This makes queued events serialized on exit, and deserialized in the
next invocation. Hence, no events should be lost during restarting
udevd.

This is important with the several aspects. Basically
systemd-udev-trigger.service (re)triggers all devices anyway after
switching root, But the service may be disabled or modified by admin.
Moreover, the service produces only 'add' events, and thus the service
cannot cover events with other actions generated by the kernel during
switching root. Also, the userspace triggered events may not contain
some parameters compared with events triggered by the kernel.
2025-04-22 10:54:25 +02:00
Yu Watanabe acd65ba1cd Revert "tests: add test for StartAuxiliaryScope()"
This reverts commit fd7fd59b6d.

The DBus method StartAuxiliaryScope() will be removed in the next
commit.
2025-04-22 09:00:19 +09:00
Yu Watanabe 7137e0bf24 ssh-proxy: use % as an alternative separator
Since OpenSSH 10.0p1, specifically
https://anongit.mindrot.org/openssh.git/commit/?id=487cf4c18c123b66c1f3f733398cd37e6b2ab6ab
ssh refuses comma in hostname by default.

Let's use % as an alternative separator.

Follow-up for defd5060d6.
2025-04-20 15:15:54 +02:00
Yu Watanabe a4f003bac0 TEST-17-UDEV: add test case for queued events serialization/deserialization 2025-04-19 01:51:59 +09:00
Matthieu Baerts (NGI0) defd5060d6 ssh-proxy: add scp and rsync support
ssh-generator and ssh-proxy are great features, it is very handy to be
able to do:

    ssh vsock/1

But, because of the '/' used as a separator, scp and rsync don't
interpret 'vsock/<CID>' as a hostname, e.g.

    $ scp /etc/machine-id vsock/2222:.
    cp: cannot create regular file 'vsock/2222:.': No such file or directory

    $ rsync /etc/machine-id vsock/2222:.
    rsync: [Receiver] change_dir#3 "(...)/vsock" failed: No such file or directory (2)
    rsync error: errors selecting input/output files, dirs (code 3) at main.c(829) [Receiver=3.4.1]

An alternative is to use ',' as separator, e.g.

    $ scp /etc/machine-id vsock,2222:.

This is what is being suggested here. The names with '/' are kept not to
break anything here.

Others are possible: '%', '=', '#', '@', ':', etc. As mentioned in
commit 0abd510f7f ("ssh-proxy: add ssh ProxyCommand tool that can
connect to AF_UNIX + AF_VSOCK sockets"), it is better to avoid ':' as it
is already taken by SSH itself when doing sftp, and "@" is already taken
for separating the user name. '#' will cause some issues with some
shells like ZSH when quotes are not used.
2025-04-18 12:58:28 +02:00
Yu Watanabe 39dd06dbc4 meson: build tests for nspawn even -Dnspawn= is disabled
Follow-up for d95818f522.
Fixes #36880.
2025-04-18 09:03:33 +02:00
Daan De Meyer 710653d3bc test: Use meson add_test_setup() instead of environment variables
We add a default test setup that excludes the integration-tests suite
so that the integration tests don't run by default. This allows us to
get rid of $SYSTEMD_INTEGRATION_TESTS. Then, we add two extra setups:
'integration' and 'shell'. The 'integration' setup does not exclude the
integration-tests suite, and so can be used to run the integration tests.
The 'shell' setup does the same, but additionally sets $TEST_SHELL=1,
allowing to get rid of $TEST_SHELL in the docs.
2025-04-17 20:31:08 +02:00
Beniamino Galvani ec65c29e51 network: fix handling of routing policy rule fwmask
The firewall mask should be applied even if the mark is 0, to allow defining a
value of e.g. 0/255.

Fixes #36973
2025-04-17 09:18:54 +09:00
Yu Watanabe 051675ea80 test: replace deprecated CGroup v1 settings with v2 ones 2025-04-15 22:34:22 +09:00
Luca Boccassi bd9c55ebe2 import/export: add support for zstd 2025-04-15 12:21:30 +01:00
Yu Watanabe 012d76ab79 test: also wait for all queued events being processed
Otherwise, if already 'remove' uevent for the device is queued, then
the device node may not exist any more when 'udevadm wait' command succeeds.

Follow-up for 90941d458a.
2025-04-12 09:22:27 +09:00
Yu Watanabe c50606aa56 TEST-17-UDEV: add test cases for reverting/serializing/deserializing config 2025-04-12 05:08:20 +09:00
Daan De Meyer 0a893ef3f3 mkosi: update fedora commit reference to 6646d13acae64665f63354cd60ecf963ee563b96 (#37065)
* 6646d13aca fmf: Run tests from systemd-tests rpm if possible
2025-04-11 13:46:20 +02:00
Daan De Meyer fc4f9c5f8b test: Work around bug in meson when installing directory symlinks
Installing symlinks pointing to directories with install_subdir() is
broken (see https://github.com/mesonbuild/meson/pull/14471). Let's work
around the issue for now by manually installing the standalone directory
until the issue is fixed upstream and available in meson in all supported
distributions.
2025-04-11 12:13:31 +02:00
Daan De Meyer 96e7472dcd meson: Fix installation directory for integration-tests when using rsync 2025-04-11 11:42:04 +02:00
Daan De Meyer 9c8646646c integration-tests: Don't enable tpm for every single test 2025-04-11 06:20:25 +09:00
Daan De Meyer beecd4e344 test: Fix typing error in integration-test-wrapper.py 2025-04-11 06:20:25 +09:00
Daan De Meyer e2b01571d0 mkosi: Move TEST-24-CRYPTSETUP files to mkosi/ directory
If the integration tests have been installed in the systemd-tests
package, the path to these in mkosi.postinst.chroot will be wrong.
Let's fix the issue by moving these files into the mkosi/ directory
as they're only used by mkosi regardless so they make more sense to
be there anyway.
2025-04-10 15:09:29 +02:00
Yu Watanabe 62146da6ce core,run0: fixlets/tweaks around $SHELL handling (#37052)
Fixes #35007
2025-04-10 04:29:30 +09:00
Daan De Meyer 75a5ff01d3 test: Make sure symlinks in integration-tests are properly installed
meson follows symlinks by default, so make sure we use
follow_symlinks=False if meson is new enough and rsync otherwise like
we already do for other testdata subdirectories.
2025-04-09 20:47:30 +02:00
Daan De Meyer c7eda25593 test: Drop version from standalone meson file
The file won't exist if we're running tests from the systemd-tests
package so let's drop it as it's not used for anything.
2025-04-09 20:23:26 +02:00
Mike Yuan aadb8f9784 test: add test case for PAMName= $SHELL acquisition for root 2025-04-09 19:31:58 +02:00
Daan De Meyer a0ce5e642f test: Install files required to run integration tests standalone
Let's make it possible to run the integration tests without requiring
the sources by installing the mkosi and integration-tests directories.
2025-04-08 13:02:24 +02:00
Luca Boccassi 442d8c3f06 TEST-04-JOURNAL: include util.sh before calling cgroupfs_supports_user_xattrs() (#37039)
Fixes a bug introduced by 46322f2742
(v256).
Fixes #36991.
2025-04-08 09:52:13 +01:00
Yu Watanabe f0cf0c9ba7 TEST-17-UDEV: several follow-ups (#37042) 2025-04-08 16:43:03 +09:00
Jules Lamur 06fadc4286 fstab-generator: fix options in systemd.mount-extra= arg
Fixes a bug introduced by 55365b0a23 (v254).

The arguments `(rd.)systemd.mount-extra` take a value that looks like
`WHAT:WHERE[:FSTYPE[:OPTIONS]]`. The `OPTIONS` were parsed into a nulstr
where a comma-separated c-string was expected. This leads to a bug where
only the first option was taken into account by the generator.

For example, if you passed `systemd.mount-extra=/x:/y:baz:ro,defaults`
to the kernel, `systemd-fstab-generator` would translate that into a
nulstr: `ro\0defaults\0`.
Since methods processing options in the generator expected a
comma-separated c-string, they would only see the first option, `ro` in
this case.
2025-04-08 07:10:07 +09:00
Luca Boccassi 5f8e5297b4 test: switch to new config keyword for bind9 >= 9.21
bind9 9.21 removed the deprecated 'managed-keys', swap it with
'trust-anchors' if the version is 9.21 or newer

[   20.654086] TEST-75-RESOLVED.sh[1217]: + delv -a /etc/bind.keys @ns1.unsigned.test signed.test
[   20.654425] TEST-75-RESOLVED.sh[1218]: + tee /tmp/tmp.D4LNomAKqY
[   20.672599] TEST-75-RESOLVED.sh[1218]: ;; /etc/bind.keys:1: option 'managed-keys' no longer exists
2025-04-08 07:09:26 +09:00
Yu Watanabe 9e372b643b TEST-04-JOURNAL: sync journal in test script, and find journal with invocation ID
Hopefully improve the stability of the test.
2025-04-08 06:56:52 +09:00
Yu Watanabe 86d59686b7 TEST-04-JOURNAL: include util.sh before calling cgroupfs_supports_user_xattrs()
Fixes a bug introduced by 46322f2742 (v256).
Fixes #36991.
2025-04-08 06:39:06 +09:00
Yu Watanabe ae84aa286a TEST-17-UDEV: fd may be >= 10
Follow-up for db5d89309a.
2025-04-08 06:16:14 +09:00
Yu Watanabe 9f7ddd2955 TEST-17-UDEV: update rules filename
Follow-up for 40959dcc02.
2025-04-08 06:15:22 +09:00
Yu Watanabe d893f35559 udev-watch: push inotify fd to service manager's fdstore (#36977) 2025-04-05 20:34:42 +09:00
Yu Watanabe e4e40936f3 nspawn: drop cgv1 handling; core: drop cgroup agent (#36764) 2025-04-05 17:57:18 +09:00
Yu Watanabe db5d89309a TEST-17-UDEV: check journal about inotify watch 2025-04-05 17:33:31 +09:00
Yu Watanabe 40959dcc02 TEST-17-UDEV: rename subtests 2025-04-05 17:33:31 +09:00
Matteo Croce 936e298f0e use grep whole-word search
grep supports whole-word search with `-w`, no need to look for a
trailing space.
2025-04-05 05:24:30 +09:00
Beniamino Galvani f7996e2a33 network: add support for HSR netdev
Add support for creating HSR/PRP interfaces. HSR (High-availability Seamless
Redundancy) and PRP (Parallel Redundancy Protocol) are two protocols that
provide seamless failover against failure of any single network component. They
are both implemented by the "hsr" kernel driver.
2025-04-05 05:23:53 +09:00
Yu Watanabe c3c905c6c1 TEST-64-UDEV-STORAGE: enable debug logging and set timeout
For debugging the following failure:
```
41/95 systemd:integration-tests / TEST-64-UDEV-STORAGE-mdadm_basic                              TIMEOUT        1800.02s   killed by signal 15 SIGTERM
[   30.902392] TEST-64-UDEV-STORAGE.sh[517]: + sfdisk --wipe=always /dev/md/mdmirpar
[   31.326202] TEST-64-UDEV-STORAGE.sh[517]: + udevadm trigger --settle --parent-match /dev/md/mdmirpar
[  900.971338] kauditd_printk_skb: 10 callbacks suppressed
[  900.971343] audit: type=1130 audit(1743767825.783:146): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-tmpfiles-clean comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  900.974057] audit: type=1131 audit(1743767825.786:147): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-tmpfiles-clean comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Finishing after writing 68494 entries
qemu-kvm: terminating on signal 15 from pid 131949 (/usr/bin/python3)
```
2025-04-05 02:32:13 +09:00
Mike Yuan 6801a9d88a nspawn: drop cgroup v1 handling 2025-04-04 14:36:11 +02:00
Matteo Croce e39062b0ba test logind restart with different classes
Test logind restart with every possible value of XDG_SESSION_CLASS
2025-04-03 23:14:42 +01:00
Daan De Meyer 0298ddb881 docs: Make sure we run mkosi genkey before everything else
Otherwise other commands might fail saying the keys don't exist
yet.
2025-04-03 16:37:56 +02:00
Daan De Meyer 5b21c43e98 test: Be smarter about detecting the mkosi configuration directory
Instead of always looking up two directories from the
test/integration-tests/meson.build file, let's search in up to 4
parent directories from the given meson project source root. This
allows us to just pass in meson.project_source_root() to
integration-test-wrapper.py instead of having to pass in a fixed
relative offset from the current meson file.

It'll also allow us to install the integration tests and mkosi
configuration in the future without breaking the standalone
integrationt tests functionality;
2025-04-03 10:21:54 +02:00
Daan De Meyer 342d21ef19 mkosi: Move all mkosi configuration into mkosi/ subdirectory
Now that mkosi can automatically pick up its main configuration from
a mkosi/ subdirectory if it exists and there is no configuration in the
top level directory, let's make use of it  to reduce the amount of clutter
in the top level directory of the repository.

This will also make it easier to install the mkosi configuration files as
part of the testing packages later on.
2025-04-03 09:59:15 +02:00
Yu Watanabe 90941d458a test: wait for the device node symlink being created
Follow-up for 6e003d18bb.

Hopefully fixes the following failure:
```
[   50.650939] TEST-87-AUX-UTILS-VM.sh[3637]: + mkdir -p /tmp/validatefs-test.mount/somewhere/else
[   50.652499] TEST-87-AUX-UTILS-VM.sh[3637]: + mount /dev/disk/by-label/qnurx /tmp/validatefs-test.mount/somewhere/else
[   50.660885] /dev/disk/by-label/qnurx: Can't lookup blockdev
[   50.654964] TEST-87-AUX-UTILS-VM.sh[3731]: mount: /tmp/validatefs-test.mount/somewhere/else: special device /dev/disk/by-label/qnurx does not exist.
```
2025-04-03 09:41:35 +02:00
Yu Watanabe 5c311ea21a test: Use test.service template for all integration tests (#36979)
Instead of having some tests have their own unit, let's make
test.service.in generic enough so that it works for all integration
tests.
2025-04-03 12:11:49 +09:00
Yu Watanabe 3ff6d02320 test: set timeout for udevadm settle/wait/lock
Otherwise, if a test in a spurious state, it consumes quite long time.
Let's fail earlier in such case.

This also drops an unnecessary calls of 'udevadm settle' in
testcase_nvme_basic() of TEST-64-UDEV-STORAGE.
2025-04-03 10:28:25 +09:00