1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00
Commit Graph

5488 Commits

Author SHA1 Message Date
Yu Watanabe
d2d006cc8c test: use systemd-asan-env environment file at more places 2024-12-10 11:01:53 +09:00
Yu Watanabe
456727b5d4 test-network: check status of networkd after everything cleared on tear down
Otherwise, if networkd is failed, e.g. .network files that triggered the
failure will remain, and the next test case will start with previous
.network files. So, most subsequent test will fail.
2024-12-10 11:01:53 +09:00
Yu Watanabe
1bdb9e808f test: extract sanitizer reports from journal 2024-12-10 11:01:48 +09:00
Yu Watanabe
dbf83c6613 Revert "test: tentatively disable SELinux tests"
This reverts commit 261a3d191e.
2024-12-09 21:52:06 +01:00
Daan De Meyer
8f51cf6981 test: Set kernel loglevel to INFO when running tests unattended
This makes sure all kernel log messages are logged to the console.
This should be helpful during shutdown to detect possible issues with
journald when the logs can't be written to the journal itself anymore
but are written to kmsg.
2024-12-08 12:55:43 +01:00
Yu Watanabe
261a3d191e test: tentatively disable SELinux tests
Currently, mkosi GitHub action complains the following:
===
Could not find 'setfiles' which is required to relabel files.
===
Let's tentatively disable SELinux test.
2024-12-08 12:59:08 +09:00
Daan De Meyer
ead814a0b0 test: Remove old bash test runner
We put a timeline of 257 to remove the old bash test runner so since
we're about to release 257, let's remove the old bash test runner in
favor of the meson + mkosi test runner.
2024-12-06 18:54:10 +00:00
Daan De Meyer
e022e73e3f test: Implement TEST_PREFER_QEMU and use it in one of the mkosi jobs
We want to make sure the integration tests that don't require qemu
can run successfully both in an nspawn container and in a qemu VM.
So let's add one more knob TEST_PREFER_QEMU=1 to run jobs that normally
require nspawn in qemu instead.

Running these tests in qemu is also possible by not running as root but
that's very implicit so we add an explicit knob instead to make it explicit
that we want to run these in qemu instead of nspawn.
2024-12-05 16:43:11 +01:00
Daan De Meyer
900ac3a76a
ci: Implement coverage on top of mkosi (#35407) 2024-12-05 10:47:45 +01:00
Daan De Meyer
c45174f05d ci: Implement coverage on top of mkosi 2024-12-05 00:21:57 +01:00
Luca Boccassi
162760f16c
Use nicer syntax in two places in CI (#35455) 2024-12-04 13:32:28 +00:00
Daan De Meyer
e69d724aff test-execute: Make /coverage writable in DynamicUser= tests
DynamicUser=yes implies ProtectSystem=yes, so let's explicitly make
sure the coverage directory is writable in these tests.
2024-12-04 14:04:24 +01:00
Daan De Meyer
820a9373fc test: Skip TEST-38-FREEZER if coverage is enabled
The test freezes regularly when run with coverage so let's skip it
if coverage is enabled.
2024-12-04 11:12:50 +01:00
Zbigniew Jędrzejewski-Szmek
92e43e5c53 TEST-64: use more idiomatic loop syntax 2024-12-04 09:58:52 +01:00
Yu Watanabe
552e5db9ac Revert "mkosi: extend DefaultTimeoutStopSec= when running on sanitizers"
This reverts commit b75befc3c9.

Unfortunately, it does not work. Let's revert.
2024-12-04 09:13:18 +09:00
Mike Yuan
703b1b7f24 core/service: preserve RuntimeDirectory= even if oneshot service exits
Follow-up for c26948c6da

We only want to get rid of cred mount here, and RuntimeDirectory=
is documented to be retained for SERVICE_EXITED state.

Fixes #35427
2024-12-02 10:57:45 +01:00
Yu Watanabe
472e3cce6e TEST-13-NSPAWN: enable debugging logs by nspawn run by systemd-run
Otherwise, it is hard to debug issue #35209.
2024-12-01 15:40:19 +01:00
Yu Watanabe
b75befc3c9 mkosi: extend DefaultTimeoutStopSec= when running on sanitizers
Hopefully fixes #35335.
2024-11-30 04:28:24 +09:00
Yu Watanabe
6bb3771e8c TEST-67-INTEGRITY: blkid should not provide the underlying loopback block device
Fixes #35363.
2024-11-28 00:56:43 +09:00
Yu Watanabe
d5c4f1997a TEST-67-INTEGRITY: modernize test code
- make udevd generate debugging logs for loopback and DM devices,
- insert 'udevadm wait' at several places to make the device processed
  by udevd,
- cleanup generated integritysetup service before moving to next
  algorithm,
- drop unnecessary exit on command failure,
- also test data splitting mode for all algorithms.
2024-11-28 00:56:23 +09:00
Lennart Poettering
c18a102464 tests: fix access mode of root inode of throw-away container images
Otherwise the root inode will typically have what mkdtemp sets up, which
is something like 0700, which is weird and somewhat broken when trying
to look into containers from unpriv users.
2024-11-28 00:13:27 +09:00
Luca Boccassi
0566bd9643
machine: increase timeouts in attempt to fix #35115 (#35117)
An attempt to fix https://github.com/systemd/systemd/issues/35115
2024-11-26 16:12:56 +00:00
Daan De Meyer
e3b5a0c32d test: Use env in testsuite readme
Let's make sure we use env when we're setting environment variables
to rely less on shell specifics.
2024-11-25 14:54:23 +00:00
Zbigniew Jędrzejewski-Szmek
766d74fd8b
core/device: ignore ID_PROCESSING udev property on enumerate (#35332)
Fixes #35329.
2024-11-25 14:21:36 +01:00
Zbigniew Jędrzejewski-Szmek
d293fade24
Check inode number to see if we are in init namespace (#35306)
This is a more comprehensive fix compared to #35273. Also adds a minimal
test only.

Based on Luca's #35273 but generalizes the code a bit.

In v258 we really should get rid of the old heuristics around userns and
cgroupns detection, but given we are late in the v257 cycle this keeps
them in.
2024-11-25 14:13:36 +01:00
Daan De Meyer
4a346b779a test: Dump coredumps from journal in the integration test wrapper
Fixes #35277
2024-11-25 19:12:11 +09:00
Yu Watanabe
0e42004f3e networkd-test.py: disable IPv6AcceptRA= if not necessary
To speed up the test. Otherwise, it takes about few seconds interfaces
to enter the configured state. And may networkd-wait-online timeouts.
2024-11-25 10:07:26 +00:00
Yu Watanabe
675feaf521 TEST-17: add reproducer for issue #35329
Without the previous commit, the test case will fail.
2024-11-25 15:33:48 +09:00
Luca Boccassi
6fd3496cfd test: mask tmpfiles.d file shipped by selinux policy package in containers
This tmpfiles.d wants to write to sysfs, which is read-only in containers,
so systemd-tmpfiles --create fails in TEST-22-TMPFILES when ran in nspawn
if the selinux policy package is instealled. Mask it, as it's not our
config file, we don't need it in the test.
2024-11-25 15:25:55 +09:00
Daan De Meyer
ceca7c5005 test: Fix typing errors in integration-test-wrapper.py 2024-11-24 16:47:20 +01:00
Daan De Meyer
4f969b20b0 test: Format integration-test-wrapper.py 2024-11-24 16:47:20 +01:00
Daan De Meyer
6d2fd490cf integration-test-wrapper: Remove unneeded format strings 2024-11-24 16:47:20 +01:00
Yu Watanabe
9e05e33871 networkd-test.py: fix interface state checker
After 259125d53d, network interfaces
declared by .netdev files are created after systemd-networkd sends READY
notification. So, even when networkd is started, the netdevs may not
be created yet, and 'ip' command may fail. Let's also check the return
code of the command.

This also
- drops never worked stdout checks,
- makes the test fail if the interface is not created within the timeout.
2024-11-23 17:33:43 +09:00
Luca Boccassi
193bf42ab0 detect-virt: check the inode number of the pid namespace
The indoe number of root pid namespace is hardcoded in the kernel to
0xEFFFFFFC since 3.8, so check the inode number of our pid namespace
if all else fails. If it's not 0xEFFFFFFC then we are in a pid
namespace, hence a container environment.

Fixes https://github.com/systemd/systemd/issues/35249

[Reworked by Lennart, to make use of namespace_is_init()]
2024-11-23 00:14:20 +01:00
Yu Watanabe
2b397d43ab test-network: actually check metric and preference
Otherwise, nexthop ID may contain e.g. 300, then
===
AssertionError: '300' unexpectedly found in
'default nhid 3860882700 via fe80::1034:56ff:fe78:9a99 proto ra metric 512 expires 1798sec pref high\n
 default nhid 2639230080 via fe80::1034:56ff:fe78:9a98 proto ra metric 2048 expires 1798sec pref low'
===
2024-11-21 03:43:35 +09:00
Yu Watanabe
52b0351a15
core/exec-invoke: suppress placeholder home only in build_environment() (#35219)
Alternative to https://github.com/systemd/systemd/pull/34789
Closes #34789
2024-11-20 17:34:25 +09:00
Ivan Kruglov
3aa3f130c1 machine: add debug for systemd-nspawn@.service 2024-11-19 19:12:32 +01:00
Ivan Kruglov
df18408ac6 machine: increase timeouts in attempt to fix #35115 2024-11-19 18:04:27 +01:00
Mike Yuan
b718b86e1b
core/exec-invoke: suppress placeholder home only in build_environment()
Currently, get_fixed_user() employs USER_CREDS_SUPPRESS_PLACEHOLDER,
meaning home path is set to NULL if it's empty or root. However,
the path is also used for applying WorkingDirectory=~, and we'd
spuriously use the invoking user's home as fallback even if
User= is changed in that case.

Let's instead delegate such suppression to build_environment(),
so that home is proper initialized for usage at other steps.
shell doesn't actually suffer from such problem, but it's changed
too for consistency.

Alternative to #34789
2024-11-19 00:38:18 +01:00
Yu Watanabe
c295b558bf test-network: add test case for IPv6 Core Conformance test v6LC.2.2.23 2024-11-19 04:48:39 +09:00
Yu Watanabe
16ccdc3748 test-network: split out check_router_preference() from test_router_preference()
This also drop high2.network and low2.network, and edit high.network and
low.network during the test.
2024-11-19 04:44:59 +09:00
Frantisek Sumsal
238ddac165 test: ignore inconsistent coverage errors
lcov 2.1 introduced additional consistency checks [0] which make it trip
over our coverage results quite often:

Summary coverage rate:
  source files: 915
  lines.......: 36.9% (78950 of 214010 lines)
  functions...: 53.3% (6906 of 12949 functions)
Message summary:
  73 warning messages:
    inconsistent: 73
lcov: ERROR: (corrupt) unable to read trace file '/var/tmp/systemd-test-TEST-04-JOURNAL/coverage-info.new': lcov: ERROR: (inconsistent) "/build/src/shutdown/umount.c":298: function 'umount_with_timeout' is not hit but line 317 is.
        To skip consistency checks, see the 'check_data_consistency' section in man lcovrc(5).
        (use "lcov --ignore-errors inconsistent ..." to bypass this error)
        (use "lcov --ignore-errors corrupt ..." to bypass this error)

This is caused by coverage collected during shutdown which is a bit
unreliable, especially towards the final shutdown stage(s). Let's just
ignore the consistency errors for now.

[0] https://github.com/linux-test-project/lcov/releases/tag/v2.2
2024-11-15 15:54:28 +00:00
Luca Boccassi
893aa45886 test: skip TEST-84-STORAGETM if running with bugged libnvme
libnvme 1.11 appears to require a kernel built with NVME TLS
kconfigs, and fails hard if it is not, as the expected
privileged keyring '.nvme' is not present. We cannot just
create it from userspace, as privileged keyrings can only
be created by the kernel itself (those starting with '.').

Skip the test if the library exactly matches this version.

https://github.com/linux-nvme/nvme-cli/issues/2573

Fixes https://github.com/systemd/systemd/issues/35130
2024-11-14 18:00:35 +00:00
Yu Watanabe
3ea89c64c8
nspawn: several follow-ups for recent changes (#35146)
Closes #35116.
2024-11-15 00:12:40 +09:00
Yu Watanabe
360e59ed1c
network/ndisc: fix coalescing of ndisc routes when multiple router exists (#35119)
Fixes #33470.
2024-11-15 00:10:22 +09:00
Luca Boccassi
6a479f0d63
network/netdev: follow-ups for reloading .netdev files (#34979)
Follow-ups for #34909.
2024-11-14 11:36:26 +00:00
Yu Watanabe
a65f008784 TEST-13-NSPAWN: add test case for /dev/net/tun
For issue #35116.
2024-11-14 18:08:50 +09:00
Yu Watanabe
0f8afaf94d network/ndisc: dynamically configure nexthops when routes with gateway are requested
Previously, when multiple routers send RAs with the same preference,
then the kernel merges routes with the same gateway address:
===
default proto ra metric 1024 expires 595sec pref medium
        nexthop via fe80::200:10ff:fe10:1060 dev enp0s9 weight 1
        nexthop via fe80::200:10ff:fe10:1061 dev enp0s9 weight 1
===
This causes IPv6 Conformance Test v6LC.2.2.11 failure, as reported in #33470.

To avoid the coalescing issue, we can use nexthop, as suggested by Ido Schimmel:
https://lore.kernel.org/netdev/ZytjEINNRmtpadr_@shredder/
> BTW, you can avoid the coalescing problem by using the nexthop API.
> # ip nexthop add id 1 via fe80::200:10ff:fe10:1060 dev enp0s9
> # ip -6 route add default nhid 1 expires 600 proto ra
> # ip nexthop add id 2 via fe80::200:10ff:fe10:1061 dev enp0s9
> # ip -6 route append default nhid 2 expires 600 proto ra
> # ip -6 route
> fe80::/64 dev enp0s9 proto kernel metric 256 pref medium
> default nhid 1 via fe80::200:10ff:fe10:1060 dev enp0s9 proto ra metric 1024 expires 563sec pref medium
> default nhid 2 via fe80::200:10ff:fe10:1061 dev enp0s9 proto ra metric 1024 expires 594sec pref medium

Fixes #33470.

Suggested-by: Ido Schimmel <idosch@idosch.org>
2024-11-14 11:59:59 +09:00
Yu Watanabe
bbef21e4e5 test-network: update KeepConfiguration=dhcp -> dynamic 2024-11-14 10:24:27 +09:00
Yu Watanabe
f1ca3479ec networkd-test.py: show current status when wait-online failed
For easier debugging on failure.
2024-11-14 10:17:19 +09:00