Commit Graph
5826 Commits
Author SHA1 Message Date
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
Mike Yuan d4bdcecaf9 TEST-07-PID1: remove bogus test case for DelegateNamespaces=cgroup
We enable nsdelegate for cgroupfs, and hence the kernel would
always refuse writes to /sys/fs/cgroup/cgroup.pressure and friends
regardless of whether the cgns is owned by userns:
https://github.com/torvalds/linux/blob/cb82ca153949c6204af793de24b18a04236e79fd/kernel/cgroup/cgroup.c#L4132
This currently works because the mountns (thus cgroupfs) remains
to be non-delegated and we're actually operating on the real root
cgroup.

It appears that cgroupfs generally doesn't care about userns,
so I'm yet to see a way to test this properly. Let's drop this for now,
to unblock fixes in the following commits.
2025-03-30 18:54:34 +02:00
Luca Boccassi da24983526 test: skip networkd tests if networkd/resolved are disabled at build time 2025-03-30 10:18:18 +02:00
Luca Boccassi 75b16ac59e test: skip TEST-75-RESOLVED if resolved is disabled at build time 2025-03-30 10:18:18 +02:00
Luca Boccassi fce07bcb7a meson: add feature flag for nspawn build (#36876)
Other tools have it, nspawn doesn't, add one
2025-03-28 13:55:19 +00:00
Luca Boccassi 6561d02ee1 mkosi: Use build image prepare scripts for tools tree as well (#36861)
Instead of listing dependencies manually for the default tools tree,
let's reuse the prepare scripts from the build image. To make this work,
the sync script has to be configured for the tools tree as well so that
it's invoked both when building the tools tree and for the regular
image,
otherwise, when doing the first build in a fresh checkout, the sync
script
won't have executed yet as sync scripts for the regular images are
executed
after building the default tools tree.
2025-03-28 13:31:28 +00:00
Daan De Meyer 848b5ae0d1 test: Drop --no-rebuild from meson test invocations
With meson 1.7.0, meson won't rebuild the world anymore when running
meson test so since meson 1.7.0 is in tumbleweed, debian testing, fedora
rawhide and Arch Linux, drop --no-rebuild from the docs since all the default
tools trees built by mkosi in the systemd repo will have meson 1.7.0 or newer
installed.

We keep --no-rebuild in CI because in CI we run with the same tools tree
distribution as the target distribution we're building and in those it's not
guaranteed for meson 1.7.0 to be available yet.

The advantage of dropping --no-rebuild is that meson will now reconfigure itself
if needed, which is required if we change or move around meson files, as otherwise
meson tends to explode spectacularly in hard to debug ways.

https://mesonbuild.com/Release-notes-for-1-7-0.html#test-targets-no-longer-built-by-default
2025-03-28 13:02:20 +01:00
Daan De Meyer e7df838a07 test: Use /dev/shm for TEST_JOURNAL_USE_TMP if /tmp isn't tmpfs
If /dev/shm is a tmpfs and /tmp isn't, use /dev/shm instead.
2025-03-28 11:40:39 +01:00
Daan De Meyer 29a1e7df64 test: Mark tests as skipped if requirements were not satisfied
Instead of not creating the test at all, let's always create test but
simply mark them as skipped as this is more observable than simply not
creating the test at all.
2025-03-28 11:40:39 +01:00
Daan De Meyer c2d2b382b6 TEST-06-SELINUX: Only enable if meson was invoked as root
This test only works if the image was built as root. Since that's
impossible to check as meson generally runs before we build the image,
let's use whether meson is run as root as a proxy.
2025-03-28 11:40:39 +01:00
Daan De Meyer 51b4920746 test: Boot integration test VMs without an initrd if possible
If we don't need an initrd, let's not waste time in one. We have to
gate this by distributions that have the necessary kernel modules to
make this work as builtin modules, hopefully we can expand the list in
the future.
2025-03-28 11:40:39 +01:00
Luca Boccassi 980aced10b test: always install test-resolve subdir
Content is also used by unit tests, not just resolved tests,
so they are needed even when resolved is disabled, as unit
tests are still built and run
2025-03-28 10:34:02 +00:00
Luca Boccassi d95818f522 meson: add feature flag for nspawn build
Other tools have it, nspawn doesn't, add one
2025-03-28 10:34:02 +00:00
Allison Karlitskaya f32962d758 test/README.md: mention mkosi genkey
This is a required first step before testing and it's not specifically
mentioned in the doc.  This tripped me up for a while, so let's save the
trouble for the next person.
2025-03-28 09:42:51 +01:00
Daan De Meyer 926adc6617 test: Fix symlink location of standalone tests
This was accidentally moved to the wrong folder so fix up the location
so it's located in the standalone/ folder as expected.
2025-03-27 22:49:26 +01:00
Daan De Meyer d9f48358bd test: Make it possible to run the integration tests standalone
Currently, to run the integration tests, it's still necessary to
install various other build tools besides meson: A compiler, gperf,
libcap, ... which we want to avoid in CI systems where we receive
prebuilt systemd packages and only want to test them. Examples are
Debian's autopkgtest CI and Fedora CI. Let's make it possible for
these systems to run the integration tests without having to install
any other build dependency besides meson by extracting the logic
required to run the integration tests with meson into a separate
subdirectory and adding a standalone top-level meson.build file which
can be used to configure a meson tree with as its only purpose running
the integration tests.

Practically, we do the following:
- all the integration test directories and integration-test-wrapper.py
  are moved from test/ to test/integration-test/.
- All the installation logic is kept out of test/integration-test/ or
  any of its subdirectories and moved into test/meson.build instead.
- We add test/integration-test/standalone/meson.build to run the
  integration tests standalone. This meson file includes
  test/integration-test via a cute symlink hack to trick meson into
  including a parent directory with subdir().
- Documentation is included on how to use the new standalone mode.
- TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate
  units for each testcase to make them behave more like the other integration
  tests.
2025-03-27 21:37:13 +01:00
Daan De Meyer b4b1d94a09 meson: Drop project_source_root and project_build_root variables
We can now rely on meson.project_source_root() and meson.project_build_root()
which do the same thing.
2025-03-26 14:45:34 +01:00
Daan De Meyer d22ffb44c1 tree-wide: Update outdated docs on removed old integration test stuff 2025-03-26 14:40:14 +01:00
Daan De Meyer 5944dc07cf Revert "test: dynamically generate list of test cases"
We want to decouple the integration tests in meson from the
rest of the source files so the integration tests can be run
without the source files available. Let's revert the change to
dynamically figure out the test cases from the networkd tests for
now so that the tests can be generated without the test source file
being available.

This reverts commit 514458604b.
2025-03-26 14:40:14 +01:00
Daan De Meyer 20a4f117d9 test: Make sure serial is always set explicitly for scsi-hd qemu devices
Now that mkosi uses -blockdev instead -drive, the device_id property
of scsi-hd devices is not populated automatically anymore so we have to
make sure to always specify serial= to make sure /dev/disk/by-id is populated
as expected in the test.
2025-03-26 14:40:14 +01:00
Daan De Meyer 52b4371807 test: Disable pager in integration test units
Integration test units are now connected to the tty when running
interactively, so let's make sure we disable the pager to avoid tests
hanging in the pager.
2025-03-25 12:35:23 +01:00
Erik Larsson c88adbc01d networkd: add support for setting vlan_tunnel on bridge ports 2025-03-24 17:15:19 +09:00
Daan De Meyer 4d938fa865 packit: Load fmf metadata from rpm spec repository
Maintaining the fmf metadata and script upstream makes it painful
to reuse downstream so let's move the metadata and testing script
downstream and load it upstream instead.
2025-03-21 16:30:31 +01:00
Daan De Meyer f37df8c563 test: Check that the journal file was actually created (#36821)
If the test fails in the mkosi setup logic the journal file will never
be created so let's add some checks.
2025-03-21 14:31:20 +01:00
Daan De Meyer 1fda095113 test: Check that the journal file was actually created
If the test fails in the mkosi setup logic the journal file will never
be created so let's add some checks.
2025-03-21 13:34:41 +01:00
Matteo Croce dcde1e903a match glibc in ConditionVersion
Extend ConditionVersion= to allow matching against glibc version,
as proposed in https://github.com/systemd/systemd/pull/36468#issuecomment-2674600909
2025-03-21 06:57:28 +09:00
Erik Larsson 6e529860ba networkd: add support for externally managed vxlan devices
With this a vxlan interface can be created which is managed by
for example a EVPN control plane.
2025-03-20 20:29:47 +09:00
Daan De Meyer a0063ac988 packit: Enable use_target_repo_for_fmf_url option (#36794)
Currently this is picked up from the main branch of the fork which is
suboptimal. The packit folks implemented this new option for us which
should fix the problem.
2025-03-20 09:24:41 +01:00