Commit Graph

5791 Commits

Author SHA1 Message Date
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
Daan De Meyer
314ea2ec7b fmf: Use mkosi -f together with ToolsTreePackageDirectories=
There's no need to build various systemd tools from source again to
build the mkosi image when we can just install the packages that were
already built from source into the tools tree so let's do that to avoid
unnecessary compiling.
2025-03-20 09:24:07 +01:00
Daan De Meyer
f5cf72b566 fmf: Drop -f from subsequent mkosi sandbox calls
Only required for the first call to mkosi sandbox, after that we can
assume the tools tree has already been built.
2025-03-20 09:24:07 +01:00
Daan De Meyer
1f3bf2a9a2 fmf: Allow overriding the mkosi distribution and release used 2025-03-20 09:24:07 +01:00
Daan De Meyer
a3b8fee46e fmf: Download rpms manually instead of going via repositories
This both makes the script more independent, and allows us to add support
for CBS (CentOS Community Build System) at the same time.
2025-03-20 09:24:03 +01:00
Yu Watanabe
db4b4e0cd3 core: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN (#36771)
Currently DelegateNamespaces= only works for services spawned by the
system manager. User managers will always unshare the user namespace
first even if they're running with CAP_SYS_ADMIN.

Let's add support for DelegateNamespaces= for user managers if they're
running with CAP_SYS_ADMIN. By default, we'll still delegate all
namespaces
for user managers, but this can now be overridden by explicitly passing
DelegateNamespaces=.

If a user manager is running without CAP_SYS_ADMIN, the user manager is
still always unshared first just like before.
2025-03-20 06:28:18 +09:00
Daan De Meyer
da42c1441b fmf: Drop support for dist-git-source: true
In preparation for moving the fmf stuff to the fedora spec repo instead
of maintaining it upstream, let's drop support for dist-git-source: true
which won't be needed anymore when we move the fmf stuff to the Fedora
spec repository.
2025-03-19 13:01:24 +01:00
Daan De Meyer
91418656e8 fmf: Stop creating /etc/pacman.d/gnupg mountpoint
Not needed anymore with latest versions of mkosi.
2025-03-19 13:01:24 +01:00
Daan De Meyer
3f2700287f fmf: Drop btrfs workaround
We switched to ext4 in mkosi.repart itself, so drop the workaround
in the fmf integration test script.
2025-03-19 13:01:24 +01:00
Daan De Meyer
38748596f0 core: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN
Currently DelegateNamespaces= only works for services spawned by the
system manager. User managers will always unshare the user namespace
first even if they're running with CAP_SYS_ADMIN.

Let's add support for DelegateNamespaces= for user managers if they're
running with CAP_SYS_ADMIN. By default, we'll still delegate all namespaces
for user managers, but this can now be overridden by explicitly passing
DelegateNamespaces=.

If a user manager is running without CAP_SYS_ADMIN, the user manager is
still always unshared first just like before.
2025-03-19 10:01:19 +01:00
Daan De Meyer
b281686b4f test: Fix formatting 2025-03-19 10:01:19 +01:00
Daan De Meyer
87ddf5188b TEST-07-PID1.private-pids: Use --machine=testuser@.host instead of runas
Let's use the systemd way to run systemd-run as a different user instead
of setpriv.
2025-03-19 10:01:19 +01:00
Daan De Meyer
9a78b5eb7e TEST-07-PID1.delegate-namespaces: Actually run the testcases 2025-03-19 10:01:19 +01:00
Daan De Meyer
b7602662cb TEST-07-PID1.delegate-namespaces: Fix testcase_pid()
Make sure the test has its own /proc and skip it in containers as
MountAPIVFS=yes in a container always results in a read-only /proc/sys
which means the test can't write to /proc/sys/kernel/ns_last_pid.
2025-03-19 10:01:16 +01:00
Daan De Meyer
aae4748464 TEST-07-PID1.delegate-namespaces: Make sure fully visible procfs is available
To be able to mount /proc inside an unprivileged user namespace, we have
to make sure a fully visible procfs is available on the host, so let's make
sure that's the case.
2025-03-19 10:00:45 +01:00
Daan De Meyer
c8912e3d83 TEST-07-PID1.delegate-namespaces: Fix testcase_network() 2025-03-19 10:00:45 +01:00
Matteo Croce
c154bb65ad condition: introduce ConditionVersion=/AssertVersion=
Add a new condition wich checks against systemd version.
Change condition_test_kernel_version() into a generic condition_test_version()
so most of the code can be reused.

    $ systemctl --version
    systemd 258 (258~devel-g53ca5f6)

    $ systemd-analyze condition 'ConditionVersion=systemd>255'
    test.service: ConditionVersion=>255 succeeded.

    $ systemd-analyze condition 'ConditionVersion=systemd>260'
    test.service: ConditionVersion=>260 failed.

    $ systemd-analyze condition 'ConditionVersion=systemd>=258'
    test.service: ConditionVersion=>=258 succeeded.

    $ systemd-analyze condition 'ConditionVersion=systemd>=257.1'
    test.service: ConditionVersion=>=257.1 succeeded.

    $ uname -r
    6.12.13-200.fc41.aarch64

    $ systemd-analyze condition 'ConditionVersion=kernel > 4.4'
    test.service: ConditionVersion=kernel > 4.4 succeeded.

    $ systemd-analyze condition 'ConditionVersion=kernel > 6.20'
    test.service: ConditionVersion=kernel > 6.20 failed.

    $ systemd-analyze condition 'ConditionVersion=kernel < 9.0'
    test.service: ConditionVersion=kernel < 9.0 succeeded.
2025-03-18 18:36:59 +09:00
Yu Watanabe
8b75e15a94 TEST-17-UDEV: add more test cases for udev builtins 2025-03-17 12:42:28 +09:00
Yu Watanabe
15a46a961f TEST-13-NSPAWN: re-enable KILL test 2025-03-16 11:03:32 +09:00
Matteo Croce
912a48572d test-network: check that network configuration is stable with KeepConfiguration=yes
Check that when networkd restarts, and the network configures
KeepConfiguration=yes, the network configuration is never changed.

Ensure this by dumping the `ip monitor` output when networkd is restarting.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-03-15 10:26:20 +09:00
Andrii Chubatiuk
5209e9cb05 journal-remote: added custom headers support 2025-03-15 07:27:38 +09:00
Yu Watanabe
d8a353552a TEST-73-LOCALE: do not unnecessarily restart systemd-localed
It is not necessary to clear previous keymap assignment, as
`localectl set-keymap` will anyway overwrite the previous assignment.

This drops the unnecessary restart of systemd-localed in the loop.
The mkosi test image contains about 500~700 keymaps. The test
performance is greatly improved by reducing the number of restarts,
especially when the test is running with sanitizers.

On Fedora 41 with sanitizers,
Before:
1/1 systemd:integration-tests / TEST-73-LOCALE OK             1157.50s
After:
1/1 systemd:integration-tests / TEST-73-LOCALE OK              104.43s
2025-03-13 09:24:49 +01:00
Yu Watanabe
b15053de89 udev/net: fix assignment of ID_NET_NAME=
E.g. sd_device object of network interface 'hoge!foo' has sysname 'hoge/foo'.
So, previously udevd assigned 'hoge/foo' rather than 'hoge!foo' to ID_NET_NAME,
hence even when renaming is not requested, such interface was renamed to 'hoge_foo'
(note '/' cannot be used in network interface name, hence escaped to underbar).
2025-03-13 01:48:33 +09:00
Lennart Poettering
d54196a4cd Fixes several recent CI issues (#36691)
- Fixes a race in systemd-run caused by
b7ba8d55b8, which causes issue #36679.
- Skip verifying masked units in TEST-23.
- Avoid false-positive ASan warning by switching sanitizer run from
Fedora rawhide to Fedora 41, caused by recent update from
llvm-19.1.7-11.fc43 to llvm-20.1.0-1.fc43. Hopefully issue #36678 should
be fixed.

Closes #36678.
Closes #36679.
2025-03-12 15:32:58 +01:00
Yu Watanabe
07355061db TEST-74-AUX-UTILS: fail earlier when systemd-run fail to reconnect to bus
Note, the default timeout for systemctl daemon-reload is 270 seconds.
Hence, 300 seconds should be enough.
2025-03-12 04:33:46 +09:00
Yu Watanabe
e5e7cc9a98 TEST-23-UNIT-FILE: skip verifying masked unit
This fixes the following failure:
TEST-23-UNIT-FILE.sh[2408]: + systemd-analyze --recursive-errors=no --man=no verify /usr/lib/systemd/system/sysinit.target.wants/systemd-hwdb-update.service
systemd-analyze[2737]: sys-kernel-config.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: proc-sys-fs-binfmt_misc.automount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: dev-hugepages.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-kernel-tracing.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-kernel-debug.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-fs-fuse-connections.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: dev-mqueue.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: Unit systemd-hwdb-update.service is masked.
TEST-23-UNIT-FILE.sh[166]: + :
TEST-23-UNIT-FILE.sh[166]: + kill -0 2408
TEST-23-UNIT-FILE.sh[166]: + wait 2408
TEST-23-UNIT-FILE.sh[166]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE.verify-unit-files.sh failed'
TEST-23-UNIT-FILE.sh[166]: Subtest /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE.verify-unit-files.sh failed
2025-03-12 04:33:46 +09:00
Lennart Poettering
f1bc816c09 test: add test checking if pattern based hostnames work 2025-03-11 18:01:42 +01:00
Yu Watanabe
51c086b9cc meson: use more features provided by newer meson
No functional change. Preparation for future bump of required meson
version.
2025-03-10 02:41:40 +09:00
Yu Watanabe
c0cc01de8a meson: use install_symlink() where applicable
Now our baseline of meson is 0.62, hence install_symlink() can be used.

Note, install_symlink() implies install_emptydir() for specified
install_dir. Hence, this also drops several unnecessary
install_emptydir() calls.

Note, the function currently does not support 'relative' and 'force' flags,
so several 'ln -frsT' inline calls cannot be replaced.
2025-03-10 02:41:40 +09:00
Yu Watanabe
ff697bb909 meson: invert version check condition to magically suppress warning
Then, it works with --fatal-meson-warnings.
2025-03-10 02:41:40 +09:00
Yu Watanabe
5506aff98d test-network: replace symlink to 99-default.link with a copy
Then, we can drop ugly workaround in meson.build.
The .link file is not necessarily synced with 99-default.link.
Also, 99-default.link is not updated so frequently.
Let's manually sync it when necessary.
2025-03-10 02:41:40 +09:00
Luca Boccassi
d9208ff9a4 keyutil: support adding content into PKCS#7 signature (#36663)
Support including the data that was signed inside the PKCS#7 signature.
This creates a self-contained file where the signature of the data can
be verified without any other information, since the file contains the
data, signature, and certificate (which contains the public key used for
the signing).

One use case of this is IPE which requires a PKCS#7 signature that is
not "detached", i.e. includes the IPE configuration that has been
signed.

This also slightly adjusts the test case to use the x509 certificate
inside the PKCS#7 signature instead of supplying it externally during
verification.
2025-03-08 01:42:20 +00:00
Dan Streetman
f80bb317f6 keyutil: support adding content into PKCS#7 signature 2025-03-07 18:36:23 -05:00
Lennart Poettering
b9f711b66e test: add integration test for the functionality added in this PR 2025-03-07 18:15:10 +01:00
Lennart Poettering
fd0dd2d4bc userdbctl: optionally show user/group data from JSON filerather than from system 2025-03-07 18:13:36 +01:00
Dan Streetman
2d09fd72ea test: run PKCS#7 verification with both internal and external certificates 2025-03-07 11:52:44 -05:00