Commit Graph

5853 Commits

Author SHA1 Message Date
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
Matteo Croce
3ad3ee8e54 test logind restart
Add a simple check which ensures that a user service survives
a logind restart.
2025-04-03 08:55:21 +09:00
Daan De Meyer
48e19280b2 test: Use test.service template for all integration tests
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-02 21:58:59 +02:00
Daan De Meyer
1da030e6e1 test: Unset JOURNAL_STREAM for integration test units
We use StandardOutput=journal+console for integration test units
to make sure the output from the test ends up on both the serial
console and in the journal. Unfortunately this only works for
messages written to stdout/stderr of the test service. All journal
messages logged by systemd tools will only end up in the journal and
not on the serial console. This makes test failures harder to debug
than needed because developers have to fetch the journal to figure
out the actual error that was logged by any systemd tool that failed
when invoked from the integration test script.

To fix this, let's unset $JOURNAL_STREAM for the integration test
units. This forces all output to go through stdout, which will make
journald forward it to the console and save it in the journal.
2025-04-02 20:43:41 +02:00
Yu Watanabe
b0c9ba4eb1 core: delegate mountns implicitly when any of pidns/cgns/netns is in use, clean up private cgroupfs mount (#36892)
Fixes #36952
2025-04-03 00:15:33 +09:00
Luca Boccassi
f5c626df2c test: skip TEST-06-SELINUX if not on fedora/centos
The test skips at runtime on the same condition, but that's already too late
as it often gets stuck on boot in Debian/Ubuntu. Check in the meson
condition directly so that it's not even started.
2025-04-02 15:04:20 +01:00
Daan De Meyer
aa299a99f1 mkosi: Various improvements and fixes (#36931) 2025-04-02 13:02:10 +02:00
Daan De Meyer
9ead378ba0 mkosi: Use mkosi.tools.conf for tools tree configuration
This allows us to use the regular settings instead of having to bother
with ToolsTreeXXX variants. It'll also allow us to share configuration
between the regular images and the tools tree image, which we'll make
use of in the next commit.
2025-04-02 10:34:01 +02:00
Yu Watanabe
34ae6b682b user-runtime-dir: correct quota size calculation (#36884) 2025-04-02 00:59:09 +09:00
Luca Boccassi
79bc7625f6 test: fix usage of --hostnqn= (#36927)
Fixes #36908.
2025-04-01 14:04:23 +01:00
Zbigniew Jędrzejewski-Szmek
f77a8edfef TEST-46-HOMED: conditionally skip usrquota tests
The tests were failing, because the quota was not enforced.
It seems that we simply don't have privileges to set or display the quota.
The test is running priviled, so this is probably some SELinux:
TEST-46-HOMED.sh[117]: + /usr/lib/systemd/tests/unit-tests/manual/test-display-quota tmpfsquota /dev/shm /tmp
TEST-46-HOMED.sh[1103]: Lacking privileges to query UID quota on /dev/shm: Operation not permitted
TEST-46-HOMED.sh[1103]: Lacking privileges to query UID quota on /tmp: Operation not permitted

If we cannot display the quota, ignore the test results.
In a local run under mkosi, quota is shown and the tests pass. So this is something
about how the testing-farm:fedora-rawhide-x86_64 is configured.
2025-04-01 14:16:40 +02:00
Zbigniew Jędrzejewski-Szmek
cb86668f2c TEST-46-HOMED: check for support on /dev/shm and /tmp separately
The test fails in CI. My guess was this is because the enablement of quota on
/tmp and /dev/shm is independent. The former fs is mounted by systemd in the
host, while the latter is mounted in the initrd, so we can end up with quota
support on one but not the other, which is the situation I had on my laptop.
This wasn't actually the source of the problems in CI, but it's a reasonable
change to make anyway.

While at it, test both mountpoints separately.
2025-04-01 14:16:40 +02:00
Yu Watanabe
c70a113a6c test: replace deprecated --hostid= with --hostnqn=
Fixes #36908.
2025-04-01 19:01:45 +09:00
Luca Boccassi
4b85218629 test: use 'exit 0' instead of 'return' in test scripts
14385s [   66.896852] TEST-87-AUX-UTILS-VM.sh[3744]: + test -x /usr/lib/systemd/systemd-validatefs
14385s [   66.898544] TEST-87-AUX-UTILS-VM.sh[3744]: + echo 'no systemd-validatefs'
14385s [   66.899115] TEST-87-AUX-UTILS-VM.sh[3744]: no systemd-validatefs
14385s [   66.899699] TEST-87-AUX-UTILS-VM.sh[3744]: + return
14385s [   66.900189] TEST-87-AUX-UTILS-VM.sh[3744]: .//usr/lib/systemd/tests/testdata/units/TEST-87-AUX-UTILS-VM.validatefs.sh: line 13: return: can only `return' from a function or sourced script

Follow-up for 6e003d18bb
2025-04-01 10:59:27 +01:00
Yu Watanabe
699c377d0d Revert "test: call nvme-cli with --hostnqn= instead of the deprecated --hostid="
This reverts commit b8942f4ae2.

As commented https://github.com/systemd/systemd/issues/36908#issuecomment-2768507373,
the usage of --hostnqn= is different from --hostid=.
2025-04-01 18:58:43 +09:00
Luca Boccassi
b8942f4ae2 test: call nvme-cli with --hostnqn= instead of the deprecated --hostid=
Fixes https://github.com/systemd/systemd/issues/36908
2025-04-01 11:36:58 +09:00
Zbigniew Jędrzejewski-Szmek
5399910671 TEST-46-HOMED: write zeros instead of random bytes
This should be faster, and equivalent for the purposes of quota calculation.
2025-03-31 22:46:04 +02:00
Luca Boccassi
ebc0514a65 test: pass verbose option to nvme-cli
When the test fails due to nvme-cli/kernel issues it's hard to report it
upstream as there's not enough details, add verbose flags
2025-03-31 17:22:30 +01:00
Lennart Poettering
6e003d18bb ci: add test for new validatefs work 2025-03-31 15:14:53 +02:00
Lennart Poettering
84b41ef082 ci: add -no-xattrs to unsquashfs cmdline
If the target dir is tmpfs and we run on old kernels we cannot extract
xattrs and the extracting will fail if there are any. hence add
-no-xattrs to the two remaining unsquashfs invocations that don't have
it.

(Also all other invocations across our test tree spell "-dest" instead
of "-d", hence do so here too.)
2025-03-31 15:14:50 +02:00
Mike Yuan
32b69b190b core: delegate mountns implicitly when any of pidns/cgns/netns is in use 2025-03-30 18:57:18 +02:00