Commit graph

4810 commits

Author SHA1 Message Date
Daan De Meyer 1ce32f2f5f TEST-81-GENERATORS: Use SYSTEMD_PROC_CMDLINE more
Makes the test more robust as the command line the image is booted
won't influence the test result.
2024-04-30 10:45:35 +02:00
Daan De Meyer 7a66f21556 core: Add systemd.crash_action= kernel command line argument
Required for integration tests to power off on PID 1 crashes. We
deprecate systemd.crash_reboot and related options by removing them
from the documentation but still parsing them.
2024-04-29 14:34:22 +02:00
Sebastian Pucilowski e6c4b5dc52 network: DHCP version logging typos
Some DHCP client log messages report "DHCP4" or "DHCP6" instead of
"DHCPv4" or "DHCPv6" as used within the rest of the codebase. Typos
fixed.
2024-04-28 11:47:55 +09:00
Daan De Meyer 4c36bbdfd7
Merge pull request #32439 from CodethinkLabs/simple-mkosi-integration-tests
Enable some simple mkosi integration tests
2024-04-26 20:48:00 +02:00
Richard Maw 66fb77a8bf test/meson.build: Add some runnable integration tests 2024-04-26 17:25:55 +01:00
Richard Maw 337d246faf TEST-81-GENERATORS: Clean /proc/cmdline of unusual mounts 2024-04-26 17:25:55 +01:00
Richard Maw 90eee2cf0f TEST-36-NUMAPOLICY: Bump PID1 strace time to 3 seconds
CI can be slow and only waiting 1 second makes it flaky there.
2024-04-26 17:25:55 +01:00
Richard Maw 4114b723f9 TEST-26-SYSTEMCTL: Create /etc/init.d if needed
OpenSUSE doesn't disable sysv compat but also may not have anything in
/etc/init.d.
2024-04-26 17:25:55 +01:00
Richard Maw dcb17e3295 TEST-25-IMPORT: Skip if importctl not installed
machinectl import-* was split out into importctl
which is a separately configurable component to machinectl
and might not always be available.
2024-04-26 17:25:34 +01:00
Richard Maw 60d064d3fd TEST-19-CGROUP: Skip on opensuse
OpenSUSE images seem to be unhappy with either how they are built
or what they are being asked to do.

The listed device-mapper failure is just one of the strange errors,
I have also seen it fail to propagate cgroup properties into new cgroups
that were previously guaranteed to exist.
2024-04-26 17:23:53 +01:00
Richard Maw 8ccba68cb5 TEST-17-UDEV: Skip credentials test if service not loaded
It does not appear to exist on OpenSUSE yet.
2024-04-26 17:22:10 +01:00
Frantisek Sumsal 516652bbfd test: mountnfsd -> mountfsd
I keep accidentally writing mountnfsd instead of mountfsd, and a couple
of instances managed to get into the repo.
2024-04-26 17:14:07 +02:00
Richard Maw ab5f60cb23 test: Disable network by default in mkosi tests 2024-04-26 15:55:42 +01:00
Daan De Meyer dcbf0be1b7 TEST-50-DISSECT: Don't log image contents to console
These can contain quite a few files, so let's not write every single
file and directory straight to the console to speed things up.
2024-04-26 13:51:49 +02:00
Daan De Meyer 536b5c0748
Merge pull request #32445 from DaanDeMeyer/mkosi-images
mkosi: Build minimal images and enable related integration tests
2024-04-25 21:59:23 +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
Daan De Meyer 69dc36f69b TEST-50-DISSECT: Make sure logging sockets are mounted into images
Otherwise we lose valuable logging from systemd-executor when things
go wrong since it can only log to the journal and not to the console
in these cases.
2024-04-25 19:39:31 +02:00
Luca Boccassi d1c4174d69
Merge pull request #32475 from bluca/skip
test: skip testsuite-50.mountnfsd if kernel/polkit are too old
2024-04-25 18:48:57 +02:00
Daan De Meyer cf5e1b5d39 test: Skip meson integration tests if SYSTEMD_INTEGRATION_TESTS != 1
We cannot mark a test suite as excluded by default in meson. Instead,
let's require that SYSTEMD_INTEGRATION_TESTS=1 and skip any integration
test if it's not set. This is effectively the same as excluding it by
default. If the integration-test option is enabled, we'll set the
environment variable by default, just like we do with SYSTEMD_SLOW_TESTS
and the slow-tests meson option.
2024-04-25 17:06:40 +02:00
Luca Boccassi f9419fe610 test: skip testsuite-50.mountnfsd if kernel/polkit are too old
Need full support of pidfd to work, so skip the test if it's not
available
2024-04-25 13:32:35 +01:00
Luca Boccassi c790537b89 test: use sd-analyze for kernel version check in TEST-62 2024-04-25 13:32:10 +01:00
Lennart Poettering 3c1d1ca146 manager: switch service unit type over to using new handoff timestamping logic
Also: rename Handover → Handoff. I think it makes it clearer that this
is not really about handing over any resources, but that the executor is
out off the game from that point on.
2024-04-25 13:40:41 +02:00
Daan De Meyer 2fcf8bf3b1
Merge pull request #32465 from CodethinkLabs/mkosi-debug
mkosi: Build images and run mkosi tests with --debug to aid debugging in CI
2024-04-24 21:02:41 +02:00
Daan De Meyer 5ae6ff1258 TEST-50-DISSECT: Skip mutable sysext tests on virtiofs
virtiofs cannot be used as the upper fs for overlayfs, so skip all
the sysext mutable tests that would try to use virtiofs as the
upper fs.
2024-04-24 19:30:00 +02:00
Richard Maw 125b2fee18 test: Add --debug when running mkosi through integration-test-wrapper 2024-04-24 18:27:07 +01:00
Daan De Meyer c709499a4e TEST-50-DISSECT: Use --apparent-size when calling du
Otherwise if the file is full of holes we get the wrong size and
we'll fail later on.
2024-04-24 15:51:37 +02:00
Daan De Meyer 2a9184b902 TEST-50-DISSECT: Skip mountfsd test if the user namespace interface is not supported 2024-04-24 15:51:35 +02:00
Richard Maw 2fd849016b test: Shut down tests on crash
If an assert in systemd fails it can't shut down normally.

By default it freezes. For interactive runs we want the crash shell
to enable further debugging, but during test runs we want it to exit
without having to wait for the test timeout.

By deactivating the crash shell, enabling reboot, and configuring qemu
so that it shuts down instead of rebooting we can shut down instead.

Because by default UEFI will enroll keys and then reboot
we also have to set --qemu-firmware-variables=custom
so it doesn't need to auto-enroll.

Because mkosi has to handle not receiving an EXIT_STATUS notification
it falls back to the exit code of qemu, which in the case of reboot
would be 0, we also override the success exit status to 123
and check that we got that as an exit code from mkosi.
2024-04-24 11:01:45 +02:00
Richard Maw 796cf1b483 test: document when writable /usr overlays may be needed 2024-04-24 11:01:45 +02:00
Daan De Meyer b85e54961c test: Various mkosi integration test improvements
- Stop using logging module since the default output formatting is
  pretty bad. Prefer print() for now.
- Log less, logging the full mkosi command line is rather verbose,
  especially when it contains multi-line dropins.
- Streamline the journalctl command we output for debugging failed
  tests.
- Don't force usage of the disk image format.
- Don't force running without unit tests.
- Don't force disabling RuntimeBuildSources.
- Update documentation to streamline the command for running a single
  test and remove sudo as it's not required anymore.
- Improve the console output by having the test unit's output logged
  to both the journal and the console.
- Disable journal console log forwarding as we have journal forwarding
  as a better alternative.
- Delete existing journal file before running test.
- Delete journal files of succeeded tests to reduce disk usage.
- Rename system_mkosi target to just mkosi
- Pass in mkosi source directory explicitly to accomodate arbitrary
  build directory locations.
- Add test interactive debugging if stdout is connected to a tty
- Stop explicitly using the 'system' image since it'll likely be
  dropped soon.
- Only forward journal if we're not running in debugging mode.
- Stop using testsuite.target and instead just add the necessary
  extras to the main testsuite unit via the credential dropin.
- Override type to idle so test output is not interleaved with
  status output.
- Don't build mkosi target by default
- Always add the mkosi target if mkosi is found
- Remove dependency of the integration tests on the mkosi target
  as otherwise the image is always built, even though we configure
  it to not be built by default.
- Move mkosi output, cache and build directory into build/ so that
  invocations from meson and regular invocations share the same
  directories.
- Various aesthetic cleanups.
2024-04-23 10:32:42 +02:00
Daan De Meyer 741d59b326 test: Rework TEST-02-UNITTESTS
Currently, A large amount of unit test output is logged directly
to the console instead of to the per test log file as any subprocesses
executed by a test manager will detect that stderr is not connected
to the journal and log directly to /dev/console instead.

To solve this issue, let's make sure all tests are connected directly
to the journal by running them with systemd-run. We also simplify the
entire test script by getting rid of the custom queue and replicating
it with xargs instead. By using bash's function export feature, we can
make our run_test() function available to the bash subprocess spawned
by xargs.

Once a test is finished, we read its logs from the journal and put them
in the appropriate file if needed.
2024-04-22 19:37:13 +02:00
Lennart Poettering f92868db4e
Merge pull request #32369 from DaanDeMeyer/serial
terminal-util: Enable line wrapping in reset_terminal_fd()
2024-04-22 17:48:14 +02:00
Luca Boccassi edd3d4d7c2 nspawn: ensure single-process container running as --user can access credentials
When starting a container with --user, the new uid will be resolved and switched to
only in the inner child, at the end of the setup, by spawning getent. But the
credentials are set up in the outer child, long before the user is resolvable,
and the directories/files are made only readable by root and read-only, which
means they cannot be changed later and made visible to the user.

When this particular combination is specified, it is obvious the caller wants
the single-process container to be able to use credentials, so make them world
readable only in that specific case.

Fixes https://github.com/systemd/systemd/issues/31794
2024-04-22 15:47:44 +02:00
Daan De Meyer f57705d67d terminal-util: Enable line wrapping in reset_terminal_fd()
The qemu seabios firmware disables serial console line wrapping. Let's
make sure we re-enable it again when we reset a terminal to some sane
defaults.

To avoid potentially blocking on writing to the terminal, we put it
in nonblocking mode and add a timeout of 50ms.
2024-04-22 15:28:26 +02:00
Luca Boccassi 93cb78aee2 core: add ExecMainHandoverTimestamp property recording time-of-execve
Enable the exec_fd logic for Type=notify* services too, and change it
to send a timestamp instead of a '1' byte. Record the timestamp in a
new ExecMainHandoverTimestamp property so that users can track accurately
when control is handed over from systemd to the service payload, so
that latency and startup performance can be trivially and accurately
tracked and attributed.
2024-04-22 15:16:05 +02:00
Yu Watanabe 0fe4a1c870 test-network: add test for [IPv6SendRA] ReachableTimeSec= and RetransmitSec= 2024-04-22 18:42:56 +09:00
Lennart Poettering b7866fa6aa
Merge pull request #31987 from flatcar-hub/krnowak/usr-perm-check
sysext: Fix issues with merged hierarchy mode
2024-04-22 11:14:35 +02:00
Yu Watanabe d51377ac42 test-network: add test for global UseDomains= setting 2024-04-20 12:01:53 +09:00
Luca Boccassi 565f6130b2
Merge pull request #32142 from bluca/portable_vpick
portable: support vpick
2024-04-19 20:34:16 +02:00
Luca Boccassi 8257508c58 portable: support vpick
Resolve at attach/detach/inspect time, so that the image is pinned and requires
re-attaching on update, given files are extracted from it so just passing
img.v/ to RootImage= is not enough to get a portable image updated
2024-04-19 13:25:32 +01:00
Krzesimir Nowak d74d69ae53 test: Make the sysext test to run with --root and without
I was bitten several times by testing things only with --root flag, so this
commit prepares the existing test cases to run on / too. This required the test
cases to clean up after themselves, thus I have put each test case in a
separate subshell and used traps to do the cleanups.

I needed to change the hierarchy used by the test extension to /opt, because
unmounting /usr often failed with EBUSY.
2024-04-19 10:24:17 +02:00
Krzesimir Nowak 60c335a4bc test: Do not limit hierarchies 2024-04-19 07:20:52 +02:00
Krzesimir Nowak 140f834333 test: Add sysext test case for checking valid mutable directory mode 2024-04-19 07:18:38 +02:00
Krzesimir Nowak 6aab53b175 test: Add sysext test-cases for checking mode preservation 2024-04-19 07:15:01 +02:00
Luca Boccassi e54bf3fe0b
Merge pull request #32299 from yuwata/network-radv-ignore-rs-from-the-same-interface
network/radv: ignore RS message from the same interface
2024-04-18 23:45:06 +02:00
Lennart Poettering dd37963aff
Merge pull request #31790 from poettering/pcrlock-policy-fix
Replace PolicyAuthValue by PolicySigned as access policy for pcrlock policy nvindex
2024-04-18 21:11:27 +02:00
Luca Boccassi 0c8bda7dc3
Merge pull request #32121 from CodethinkLabs/basic-mkosi-integration-tests
Basic mkosi integration tests
2024-04-18 21:02:41 +02:00
Lennart Poettering 36769db1b0 ci: update tests to showcase new option a bit 2024-04-18 18:12:24 +02:00
Richard Maw 945b722f13 test: Add mkosi-based integration test runner
The first two tests are included to ensure parallel test execution is
demonstrable.
2024-04-18 16:26:38 +01:00
Luca Boccassi 966d7977c7 portablectl: add --clean parameter for detaching
Calls CleanUnit on each portable service being removed, after it has
stopped
2024-04-18 10:47:29 +01:00