64 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
01100f15ad tree-wide: drop space after shell redirection ops
Those are all unary operators.
2025-11-17 16:50:50 +01:00
Mike Yuan
ca8658120e TEST-80-NOTIFYACCESS: add test case for #37515 2025-11-04 12:18:34 +01:00
Antonio Alvarez Feijoo
2fbfbfc5fa test: enable TEST-06-SELINUX in openSUSE
openSUSE switched to SELinux by default for quite some time now, so this test is
also successful.
2025-10-14 17:56:39 +01:00
Frantisek Sumsal
cfb604f8f7 test: exclude test-stacktrace(-not)?-symbolized from the coredump check
As they are expected coredumps from the EnterNamespace= feature test.
2025-10-11 22:37:33 +02:00
Yu Watanabe
862b61a3a1 test: merge TEST-76-SYSCTL into TEST-87-AUX-UTILS-VM 2025-10-06 03:26:28 +09:00
Yu Watanabe
10b2d19219 timer: fix unexpected triggering of service immediately after restart of a timer (#38868)
Fixes: #31231
Fixes: #35805
2025-09-26 09:51:36 +09:00
Frantisek Sumsal
953c347fb6 test: rename TEST-53-ISSUE-16347 to TEST-53-TIMER
And split the existing test into a separate subtest.
2025-09-24 09:52:36 +02:00
Yu Watanabe
e2c5e9c011 test: use relative paths to executables
This also makes shebang always use env command, and drops unnecessary
'bash -c' or 'sh -c' when a signle command is invoked in the shell,
like sleep or echo.
2025-09-23 15:48:53 +01:00
Luca Boccassi
52ff4de962 Revert "TEST-55-OOMD: Verify that ExecStopPost= runs on oom-kill"
The test consistently fails on CentOS 9:

TEST-55-OOMD.sh[678]: + test -f /run/testbloat-exec-stop-post
[FAILED] Failed to start TEST-55-OOMD.service.

https://github.com/systemd/systemd/actions/runs/17689186773/job/50293446228?pr=38911

This reverts commit 5bf7438ff0.
2025-09-15 19:38:28 +01:00
Daan De Meyer
5bf7438ff0 TEST-55-OOMD: Verify that ExecStopPost= runs on oom-kill 2025-09-13 00:20:56 +01:00
Yu Watanabe
642744b492 test: move test units to their own directories
This also add test cases for verifying loopy.service and friends,
which was added by e66047ff62 but never
used in integration tests.
2025-09-04 14:36:46 +09:00
Yu Watanabe
045227426e test: fix typo 2025-08-20 16:17:11 +09:00
Luca Boccassi
208ba34a43 test: add coverage for kernel keyring in TEST-50-DISSECT
Use the kernel keyring to verify images in the dissect test.
The userspace keyring is still covered by the DDI and mountfsd tests.
2025-08-11 10:59:51 +01:00
Yu Watanabe
922885e0a5 test: several cleanups for DeferReactivation=
- move to TEST-07-PID1, as it is a timer setting,
- rename the timer and service, to emphasize they are for testing
  DeferReactivation=,
- use timeout command to wait for the timer being triggered several times,
- stop the timer when not necessary,
- accept 9 seconds as delta, as there are fluctuations.

Fixes the following failure:
```
TEST-74-AUX-UTILS.sh[422]: + last=
TEST-74-AUX-UTILS.sh[422]: + read -r time
TEST-74-AUX-UTILS.sh[422]: + '[' -n '' ']'
TEST-74-AUX-UTILS.sh[422]: + last=1753779616
TEST-74-AUX-UTILS.sh[422]: + read -r time
TEST-74-AUX-UTILS.sh[422]: + '[' -n 1753779616 ']'
TEST-74-AUX-UTILS.sh[422]: + delta=9
TEST-74-AUX-UTILS.sh[422]: + '[' 9 -lt 10 ']'
TEST-74-AUX-UTILS.sh[422]: + echo 'Timer fired too early: 9 < 10'
```

Fixes #38403.
2025-07-30 15:37:18 +01:00
Yu Watanabe
db1e099a7a ci: add test coverage for secure boot and addons, and shim integration (#38377)
Now that we can enable SB on GHA do it by default in mkosi images with
selfenroll, and add a smoke test.
Also add one CI job that tests the shim integration. This will catch
regressions like https://github.com/systemd/systemd/issues/38349
2025-07-29 12:08:42 +09:00
Yu Watanabe
f9b56cf3b6 TEST-04-JOURNAL: add one more missing journalctl --sync
Fixes the following failure:
```
TEST-04-JOURNAL.sh[124]: + add_logs_filtering_override delegated-cgroup-filtering.service 01-discard-hello '~hello'
TEST-04-JOURNAL.sh[124]: + local unit=delegated-cgroup-filtering.service
TEST-04-JOURNAL.sh[124]: + local override_name=01-discard-hello
TEST-04-JOURNAL.sh[124]: + local 'log_filter=~hello'
TEST-04-JOURNAL.sh[124]: + mkdir -p /run/systemd/system/delegated-cgroup-filtering.service.d/
TEST-04-JOURNAL.sh[124]: + echo -ne '[Service]\nLogFilterPatterns=~hello'
TEST-04-JOURNAL.sh[124]: + NEEDS_RELOAD=1
TEST-04-JOURNAL.sh[1408]: ++ run_service_and_fetch_logs delegated-cgroup-filtering.service
TEST-04-JOURNAL.sh[1408]: ++ local unit=delegated-cgroup-filtering.service
TEST-04-JOURNAL.sh[1408]: ++ [[ -n 1 ]]
TEST-04-JOURNAL.sh[1408]: ++ systemctl daemon-reload
TEST-04-JOURNAL.sh[1408]: ++ NEEDS_RELOAD=
TEST-04-JOURNAL.sh[1408]: ++ systemctl start delegated-cgroup-filtering.service
TEST-04-JOURNAL.sh[1408]: ++ journalctl --sync
TEST-04-JOURNAL.sh[1408]: ++ journalctl -q -u delegated-cgroup-filtering.service -I -p notice
TEST-04-JOURNAL.sh[124]: + [[ -z Jul 28 22:41:41 H delegated_cgroup_filtering_payload.sh[1448]: child_process: hello, world!
TEST-04-JOURNAL.sh[124]: Jul 28 22:41:41 H delegated_cgroup_filtering_payload.sh[1448]: child_process: hello, people! ]]
TEST-04-JOURNAL.sh[124]: + at_exit
```
2025-07-29 12:07:36 +09:00
Luca Boccassi
5ae58ac2b9 test: add a secureboot test with an addon 2025-07-28 23:11:04 +01:00
Yu Watanabe
e0b5e14835 TEST-04-JOURNAL: add test case for log filtering through syslog
For issue #38361.
2025-07-28 16:29:31 +09:00
Yu Watanabe
b926dda2ef TEST-04-JOURNAL: several cleanups
- move scripts from test/units/ to the test specific units directory,
- drop meaningless true from silent-success.service,
- call journalctl from the same bash invocation of echo.

No functional change, just refactoring and preparation for the next
commit.
2025-07-28 16:29:31 +09:00
Zbigniew Jędrzejewski-Szmek
c5dcbd073e meson: use files() not find_program() for helper scripts
We went back and forth between 'prog.sh', files('prog.sh'), and
find_program('prog.sh'). We want to use files() or find_program() so that we
get a good error message if the file is missing. Behaviour of meson changed
over time, and in the past not all forms could be used in all places. For
example 0f4c4f3824 added find_program() in many
places to avoid repeated messages. But it seems that all recent meson versions
work fine with files().

find_program prints silly messages:
  Program tools/make-man-index.py found: YES
       (/home/zbyszek/src/systemd/tools/make-man-index.py)
  Program tools/meson-render-jinja2.py found: YES
       (/home/zbyszek/src/systemd/tools/meson-render-jinja2.py)
  ...
We know that those files will be found, they are part of the git checkout.
With files() this is gone and the meson output is easier to read.
2025-07-25 14:04:17 +02:00
Zbigniew Jędrzejewski-Szmek
0bf9bbecae tools: consistently use #!/usr/bin/env python3
It's ugly, but it's better to be consistently ugly.
2025-07-25 12:33:13 +02:00
Luca Boccassi
c8082ac09c test: wait for userspace mount options applied (#38327)
Hopefully fixes #32712.
2025-07-25 10:57:13 +01:00
Yu Watanabe
62c3f42deb test: move testcase_dependencies() to TEST-10-MOUNT
TEST-60-MOUNT_RATELIMIT is run on nspawn by default, and currently run
on vm only on arch mkosi. Let's move the test case to new TEST-10-MOUNT,
which always run on vm.
2025-07-25 04:54:42 +09:00
Yu Watanabe
1227795362 integration-test: mention TEST_SAVE_JOURNAL in README 2025-07-25 04:54:42 +09:00
Yu Watanabe
8269396078 integration-test: show journalctl command for showing saved journal when TEST_SAVE_JOURNAL=1 2025-07-25 04:54:38 +09:00
Yu Watanabe
7532bc8718 TEST-04-JOURNAL: use bash to make builtin echo command used
When non-builtin echo command is used, then the command may exit before
journald find the source of the stream, and the log filtering may not be
applied.

Hopefully fixes #37143.
2025-07-24 20:55:10 +09:00
Yu Watanabe
a532879c65 test: drop executable flag from prefix-shell.service 2025-07-24 20:55:10 +09:00
Luca Boccassi
042138fbe7 readme: update ubuntu autopkgtest infra support channels
ubuntu is moving away from IRC
2025-07-18 12:15:46 +01:00
Vishal Chillara Srinivas
7eb276dced test: resolve: add integration tests for browsing services
Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
Co-authored-by: Vishwanath Chandapur <vishwanath.chandapur@philips.com>
2025-07-17 19:41:22 +05:30
Luca Boccassi
375d80b04a ci: re-enable uefi secure boot
Kernel 6.11.0-1018-azure is now in use, which has a workaround
for the HyperV bug, so this should work again in GHA
2025-07-12 21:07:58 +09:00
DaanDeMeyer
42c288dfd8 test: Fix --capability=CAP_BPF condition
We also run in a VM if we're not running as root, yet we weren't
checking this when deciding whether to pass --capability=CAP_BPF or
not. Let's fix that.

Follow up for 9554ac3052
2025-07-11 16:08:00 +02:00
DaanDeMeyer
7f76ff2821 tree-wide: Use "mkosi box" instead of "mkosi sandbox"
The box verb was added as a synonym for sandbox. sandbox still works,
but let's switch to box as it's shorter.
2025-07-10 16:24:34 +02:00
Matteo Croce
9554ac3052 tests: run test with CAP_BPF
Add CAP_BPF to tests run with nspawn, so we don't have to use a VM
to test BPF calls.
2025-07-08 18:23:46 +02:00
Luca Boccassi
163e666204 meson: call qemu with -machine virt on aarch64
'qemu-system-aarch64 -device help' fails when no machine is specified.
Use the 'virt' type which seems to be what everyone uses for VMs.
2025-07-05 20:21:51 +01:00
Luca Boccassi
c0a5801f7b mkosi: enable arm64 job
There's no acceleration, so nested VMs are too slow, only enable
nspawn.
2025-07-04 17:39:29 +01:00
Matteo Croce
030b227cec test: add test for systemd upgrade
Add a basic test to check that systemd works after an upgrade
2025-06-18 09:51:21 +01:00
Yu Watanabe
7ded7cfb7f TEST-73-LOCALE: drop unnecessary workaround
It should be fixed by 157d5b5c30.
2025-05-14 02:28:27 +09:00
Yu Watanabe
71078275e8 integration-tests: adjust priorities
When running with sanitizers:
```
26/95 systemd:integration-tests / TEST-21-DFUZZER                          OK 1517.75s
40/95 systemd:integration-tests / TEST-85-NETWORK-NetworkdDHCPClientTests  OK  779.18s
42/95 systemd:integration-tests / TEST-04-JOURNAL                          OK  716.17s
```
and without sanitizers:
```
44/95 systemd:integration-tests / TEST-85-NETWORK-NetworkdDHCPClientTests  OK  730.33s
29/95 systemd:integration-tests / TEST-64-UDEV-STORAGE-simultaneous_events OK  701.49s
40/95 systemd:integration-tests / TEST-04-JOURNAL                          OK  348.05s
```

So, let's set higher priorities only on these tests.
2025-05-14 02:28:27 +09:00
Yu Watanabe
59dd650501 TEST-21-DFUZZER: skip test when no sanitizer is enabled 2025-05-14 02:28:22 +09:00
Mike Yuan
81d5eda6c5 core: accept "|" ExecStart= prefix to spawn target user's shell; teach run0 about the new logic (#37071)
I've always been reluctant to invoke the current user's shell in another
user's context, hence was fully grounded in `sudo -i`. With this bit in
place `run0` will finally be feature-complete on my side ;-)
2025-05-12 16:10:03 +02:00
Daan De Meyer
d8def5dc87 meson: Stop doing nested build when fuzzers are enabled
Currently, when fuzzers are enabled, we run meson from within meson
to build the fuzzer executables with sanitizers. The idea is that
we can build the fuzzers with different kinds of sanitizers
independently from the main build.

The issue with this setup is that we don't actually make use of it.
We only build the fuzzers with one set of sanitizers (address,undefined)
so we're adding a bunch of extra complexity without any benefit as we
can just setup the top level meson build with these sanitizers and get
the same result.

The other issue with this setup is that we don't pass on all the options
passed to the top level meson build to the nested meson build. The only things
we pass on are extra compiler arguments and the value of the auto_features
option, but none of the individual feature options if overridden are passed on,
which can lead to very hard to debug issues as an option enabled in the top
level build is not enabled in the nested build.

Since we're not getting anything useful out of this setup, let's simplify
and get rid of the nested meson build. Instead, sanitizers should be enabled
for the top level meson.build. This currently didn't work as we were overriding
the sanitizers passed to the meson build with the fuzzer sanitizer, so we
fix that as well by making sure we combine the fuzzer sanitizer with the ones
passed in by the user.

We also drop support for looking up libFuzzer as a separate library as
it has been shipped builtin in clang since clang 6.0, so we can assume
that -fsanitize=fuzzer is available.

To make sure we still run the fuzzing tests, we enable the fuzz-tests option
by default now to make sure they still always run (without instrumentation unless
one of llvm-fuzz or oss-fuzz is enabled).
2025-05-12 13:34:28 +02:00
Mike Yuan
66a3b69440 test: add test cases for ExecStart= via-shell prefix 2025-05-07 18:32:20 +02: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
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
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
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
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
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