1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-16 22:50:13 +03:00

484 Commits

Author SHA1 Message Date
Franck Bui
eabc948bd5 test: install /etc/hosts
Needed for resolving the "localhost" hostname.

(cherry picked from commit a09825ce9fb3bd315f35654b6e6ee4f92c675cde)
(cherry picked from commit 4f7d6885a12c0e5e27a9d29f9ef09fb2fa53d6ef)
(cherry picked from commit 58205cfea853a049f79e47ca336c320c881328d8)
(cherry picked from commit a5735d3653287ebea8e4dbdfa36b13b13ee06ec3)
2024-07-07 00:15:21 +02:00
Yu Watanabe
cdc86e4578 test: install modinfo to test image
Follow-up for 6c2d47d6d3ad25ffd7527c7f4de31457ee1b25d8.

Fixes the following unexpected skip:
```
[    6.163670] TEST-64-UDEV-STORAGE.sh[596]: + modinfo btrfs
[    6.164102] TEST-64-UDEV-STORAGE.sh[726]: /usr/lib/systemd/tests/testdata/units/TEST-64-UDEV-STORAGE.sh: line 726: modinfo: command not found
[    6.164683] TEST-64-UDEV-STORAGE.sh[727]: + echo 'This test requires the btrfs kernel module but it is not installed, skipping the test'
[    6.165069] TEST-64-UDEV-STORAGE.sh[728]: + tee --append /skipped
[    6.166801] TEST-64-UDEV-STORAGE.sh[728]: This test requires the btrfs kernel module but it is not installed, skipping the test
[    6.167177] TEST-64-UDEV-STORAGE.sh[596]: + exit 77
```

(cherry picked from commit 2569e790f6352797f8e326ed472f49479791a2ac)
(cherry picked from commit 0868f29eae4e1577eb494808a7875df69845f50c)
(cherry picked from commit 911a5934d7d871ff1ef9a4ce9b34251185a03247)
2024-05-28 02:05:13 +02:00
Frantisek Sumsal
f48e92be14 test: replace Europe/Kiev with Europe/Kyiv
As the former is deprecated and might not be available (i.e. on Ubuntu
Noble it's only available after installing the tzdata-legacy package).

(cherry picked from commit 568d97953b77fef4cb698894f567d08dfed453c9)
(cherry picked from commit 6e778d4b5fdb741e52fac7151d9789e24eb03648)
(cherry picked from commit 80643bc40fc730297d42711fa42e2e8759d26101)
2024-05-09 17:44:12 +02:00
Franck Bui
858146d0cd test: make sure to install the filesystem package in the test image on SUSE
Othewise test images are missing the tmpfiles snippets used to create the very
basic files at boot, which can be useful when a test wants to reuse the OS tree
(is already running in) for spawning a new container in pristine state.

(cherry picked from commit 08abfd0b8c8e50e6be411ed9c909e6ccc893f223)
(cherry picked from commit f16f33d5e1e0e0f1ea469931d929a7647ae2d5b1)
(cherry picked from commit 1b690849b06b439eca60a64ea9ce1de2f35ea966)
2024-02-28 10:29:35 +00:00
Franck Bui
c74f29b0e1 test: install systemd-boot in openSUSE test images
Needed since 87282a337d1ba7dc7d755f53b46c64b43718dcf7.

(cherry picked from commit 03b1e10fc8c3d85e98c38df642158076e97025fa)
(cherry picked from commit 048639c653c88905852ef3f4d710fde173916cfd)
(cherry picked from commit 52eaa1b7201cb92eca696959a7a995b5d898adb9)
2024-02-28 10:29:35 +00:00
David Tardon
8d6787dc76 test: add a test for #31384
(cherry picked from commit dfdcc7c987bf9d66ecdb7e4a88e8abdb342df299)
(cherry picked from commit 0f78bd6367f2e406c51d2c39aaa455e4b2aec366)
(cherry picked from commit d5404dc2e668c622a8653d9fcae13b535431346c)
2024-02-28 10:29:35 +00:00
Frantisek Sumsal
7989c46a17 test: don't check for -Dinstall-tests=true with NO_BUILD=1
(cherry picked from commit 58bcbad86cc910e007fae3c66c3a5cfc17046801)
(cherry picked from commit 44420128b81582eed79eba7672605a11720668c4)
(cherry picked from commit 94726df1d20756dfa410e4b11a1c9918fbb68f62)
2024-02-28 10:29:35 +00:00
Frantisek Sumsal
ec2d0d691e test: fix dbus installation on Arch
Arch finally made dbus-broker the default dbus daemon [0], but unlike
Fedora they don't use Alias=dbus.service to make the dbus.symlink under
/etc, instead they create the symlink manually under /usr/lib, so let's
account for that.

[0] b24d15795a

(cherry picked from commit ec6c7bac5c92b26fc17ad165d2defc85da324391)
(cherry picked from commit 7b80fc2587d542b65e0ebc5cece9fca7cf83432a)
(cherry picked from commit 3129beaf0ccb9f9f34737f54ca50e1d0d873bde3)
2024-01-26 19:53:42 +00:00
Yu Watanabe
1f392470cb test: mask mdmonitor when building image
Follow-up for 22e31655f3f9f54d932d4f48b92b36698e701729.

(cherry picked from commit 0f236e8cd6309cdc392d9e62bc545dcd497a9c50)
(cherry picked from commit 374a0f678817c1ab054587def008e65806f9c437)
(cherry picked from commit 74978b25bc686509c4f89ef6fa0e15453ad4362b)
2024-01-26 19:53:42 +00:00
Yu Watanabe
5938ba1251 test: make install_mdadm() also install relevant kernel modules
Installing mdadm without kernel modules is mostly meaningless.

(cherry picked from commit 4ed943e97bb7ef4227837f7a6f607cd313cae70b)
(cherry picked from commit 570766c8b612c734fed642b74218bf1be142ebb1)
(cherry picked from commit 17f7d8d8003fc517d4c49ab0308fe97127a04465)
2024-01-26 19:53:42 +00:00
Yu Watanabe
b17e7fca35 test: split out host_has_{btrfs,mdadm}() from TEST-64-UDEV-STORAGE
(cherry picked from commit 5b4fa6f13cf860afa53c71b52e4ceca25f8f13a5)
(cherry picked from commit a40677469af941118a2d86a386cc7a7ad8ff17ca)
(cherry picked from commit a5ebe751c78cf7fc8af5060b981555adaa5ff34d)
2024-01-26 19:53:42 +00:00
Frantisek Sumsal
a0ab92d470 test: install correct kpartx udev rules on Debian
Resolves: #30703
(cherry picked from commit 519f0074cf87391b17a82ea983daed6183d62fb6)
(cherry picked from commit 44b9b9aca8019866d509f8770401acd5dde5f328)
(cherry picked from commit 4a08f3bde06c141f4eae7452c30ca93e6b035d94)
2024-01-26 19:53:42 +00:00
Frantisek Sumsal
850d3d70bc test: install all necessary units & generators for LVM on Debian
And derivates.

Replaces: #30458
(cherry picked from commit f9ba9d3eb7c350f31132ccd9ed1ee3c0c693f5c5)
(cherry picked from commit b1dba6bcaae70849394f34be8850f2e5e2559633)
(cherry picked from commit dc7bc3d34e1cf87e6cf93ba901bd21af24b1ae71)
2023-12-23 20:42:40 +01:00
Franck Bui
0a48f8ac7b test: install af_packet kernel module on openSUSE
Currently needed by test-dhcp-server unit test, af_packet is not built-in on
openSUSE distributions.

(cherry picked from commit a1af99df8e29ffb55b0c698eeda2c9bf795fc0e1)
(cherry picked from commit db2193609e554732c0288ccf27d5e58083f9219c)
2023-11-09 21:05:51 +00:00
Frantisek Sumsal
bf449d79bb test: wait for the swtpm socket to appear
On slower/overloaded systems it may take a bit for the swtpm socket
to show up:

I: Started swtpm as PID 189419 with state dir /tmp/tmp.pWqUutuGUj
I: Configured emulated TPM2 device tpm-spapr
+ tee /var/tmp/systemd-test-TEST-70-TPM2_1/console.log
+ timeout --foreground 1200 /bin/qemu-system-ppc64le -smp 4 ...
qemu-system-ppc64le: -chardev socket,id=chrtpm,path=/tmp/tmp.pWqUutuGUj/sock: Failed to connect to '/tmp/tmp.pWqUutuGUj/sock': No such file or directory
E: qemu failed with exit code 1

Spotted regularly in the ppc64le cron job and in some Ubuntu CI/CentOS CI
pr runs [0].

[0] https://github.com/systemd/systemd/pull/29183#issuecomment-1721727927

(cherry picked from commit 18c3ffbfcc2d4d6d1a4680092123e510945f7a78)
(cherry picked from commit 2171f689b8596458e21ac75766326431c7d151cc)
2023-09-28 14:40:43 +01:00
Frantisek Sumsal
4dfce10b12 test: don't panic on soft lockups
We can't do anything about them anyway, and most importantly this seems
to alleviate systemd/systemd-centos-ci#660, which should make the CIs
a bit less angry (at least until the issue is addressed properly).

(cherry picked from commit 3a89904e45cbbd96fb1c5d0768de5e5fcdaaa508)
(cherry picked from commit af7d007f897818068965a6500798815cc1335b72)
2023-09-28 14:40:43 +01:00
Franck Bui
8541307b23 test: install systemd-homed for openSUSE
This new sub-package has been recently introduced.

(cherry picked from commit 33ce0a899258ed8dfb4a234a9f67e678127d41f9)
(cherry picked from commit 65d5b3561c2692e947327e9a77d3b1b4d932c828)
2023-08-09 23:04:43 +01:00
Franck Bui
c65270ef5f test: console fonts are located in /usr/share on openSUSE
(cherry picked from commit ba0ff9fc0fa657024edd7a4a0aab01aa95b39ff5)
(cherry picked from commit ca0c8adf9d6d348cd59e12282e1effab4a39c5f3)
2023-08-09 23:04:43 +01:00
Frantisek Sumsal
7977cbd830 test: make the root/data partition size configurable per test
(cherry picked from commit 0334afe4d01b0f24d06995bb3ee4f5c2ff7d58c6)
2023-07-09 20:41:50 +01:00
Frantisek Sumsal
5a29fbba6c test: enable LSan for certain wrapped binaries
So we're able to detect memory leaks in our NSS modules.

An example after introducing a memory leak in nss-myhostname.c:

testsuite-71.sh[2881]: =================================================================
testsuite-71.sh[2881]: ==2880==ERROR: LeakSanitizer: detected memory leaks
testsuite-71.sh[2881]: Direct leak of 2 byte(s) in 1 object(s) allocated from:
testsuite-71.sh[2881]:     #0 0x7fa28907243b in strdup (/usr/lib64/libasan.so.8.0.0+0x7243b)
testsuite-71.sh[2881]:     #1 0x7fa286a7bc10 in gethostname_full ../src/basic/hostname-util.c:67
testsuite-71.sh[2881]:     #2 0x7fa286a74af9 in gethostname_malloc ../src/basic/hostname-util.h:24
testsuite-71.sh[2881]:     #3 0x7fa286a756f4 in _nss_myhostname_gethostbyname4_r ../src/nss-myhostname/nss-myhostname.c:79
testsuite-71.sh[2881]:     #4 0x7fa288f17588 in getaddrinfo (/lib64/libc.so.6+0xf4588)
testsuite-71.sh[2881]:     #5 0x7fa2890a4d93 in __interceptor_getaddrinfo.part.0 (/usr/lib64/libasan.so.8.0.0+0xa4d93)
testsuite-71.sh[2881]:     #6 0x55a54b2b7159 in ahosts_keys_int.part.0 (/usr/bin/getent.orig+0x4159)
testsuite-71.sh[2881]: SUMMARY: AddressSanitizer: 2 byte(s) leaked in 1 allocation(s).

(cherry picked from commit 2b5e786005d8854600bb43335fd0c4067ce8da08)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
68c7905d9c test: make sure we get PID1's stack trace on ASan/UBSan errors
As hitting an ASan/UBSan error in PID1 results in a crash (and a kernel
panic when running under qemu), we usually lose the stack trace which
makes debugging quite painful. Let's mitigate this by forwarding the
stack trace to multiple places - namely to a file and the syslog.

(cherry picked from commit 88c98cb2614a2893ec2ae7197a1f234b579da7a7)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
aaa436c2d7 test: wrap curl when running with ASan
Necessary (unfortunately) for curl on C8S.

(cherry picked from commit 033601b79ae00784bfaab9ea91fe70ecff83d645)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
c35624663b test: set $PATH to something predictable in the ASan wrapper
This is still necessary when running with clang's ASan, as it uses an
external binary to symbolize the stack traces.

Follow-up to ba79e8c2ccd.

(cherry picked from commit 3bba91ef44f58ed98ed46c76fbf16db21cef5c25)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
984104ce29 test: copy file xattrs (if any) as well
(cherry picked from commit a6695a431fec4291c956bbbecda19c468ccccb1d)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
622311c25b test: wrap agetty & getfacl when running with sanitizers
The list is getting slightly ridiculous.

(cherry picked from commit 8e81885531b23b3f6787cfe29d952469b31976ed)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
7405e06205 test: drop $SKIP_INITRD
It's pointless nowadays, since we always need an initrd for the test VMs
as we require modules that are usually not compiled in the kernel.

(cherry picked from commit 93b896e90e6da99c0436ab69dfaf384784358605)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
3909cb2133 test: rebuild the ldconfig cache after changing its configuration
Follow-up to ba79e8c2cc.

(cherry picked from commit 25bc4697275ba5ef395160c716ca3e7f63d3eaba)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
49a356f9d6 test: add a reasoning why we don't use the SELinux-provided units
(cherry picked from commit 8c0ace5739789a971b8591f53eb94200aeec2c66)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
c608d7ca85 test: make check_result_*() set -e friendly
(cherry picked from commit 71d7f02cc7dc1bf5b8506c90571cb980ec706def)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
1194822aa2 test: minor cleanup
No functional change.

(cherry picked from commit 00c2676972b62edff09ae612286e814bf9d4a574)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
b02be950c4 test: introduce test_require_bin() and use it
No functional change.

(cherry picked from commit 70bdf6e661f67dfbfd6a198f7d1ebc6fdf0dce62)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
4dad36bca8 test: move TPM2-related setup stuff into test-functions
And hide it all behind $TEST_SETUP_SWTPM.

(cherry picked from commit 18fa5c8283528253a9a4d8af42ceac61cd23c42b)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
91f08ecca3 test: split the ASan wrapper into smaller blocks and tidy it up a bit
No functional change (hopefully), just making it easier on the eyes.

(cherry picked from commit ba79e8c2ccdea132c2c0a820deb27c66a5aa6956)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
93b3bd12ac test: don't mount /sys & /proc if already mounted
(cherry picked from commit 0d4519dd84878ff1f94ba8f08d4a81350c3b1d08)
2023-06-01 16:37:09 +02:00
Thomas Blume
43d194392f test: use setpriv instead of su for user switch from root
systemd-repart needs to find mkfs.ext4 for the test.
This is located in the directory /usr/sbin on openSUSE Tumbleweed.
But since the variable ALWAYS_SET_PATH in /etc/login.defs is set to yes,
su re-initializes the $PATH variable and removes /usr/sbin.
Hence, mkfs.ext4 is not found and the test fails.
Using setpriv instead of su fixes this issue and is more appropriate to
do the switch user task from root.

[zjs: move setpriv to $BASICTOOLS and force-push to retrigger CI]

(cherry picked from commit c7bf1959d7580e1b7e918b75f852b3bf3fb6eb3c)
2023-04-27 21:30:38 +01:00
Frantisek Sumsal
ba683eb48c test: wrap mkfs.*/mksquashfs/mkswap binaries when running w/ ASan
(cherry picked from commit e912bef85d4d5a47b474a66555200cbee094f865)
2023-04-27 21:30:38 +01:00
Frantisek Sumsal
fdcd1807ff test: bump the D-Bus related timeouts to 120s
Let's attempt to reduce the amount of flakes further when the AWS region
we run in is under heavy load and the hypervisor stars stealing our CPU
time.

Follow-up to e0cbb73911 and c78d18215b.

(cherry picked from commit 72f6d0e556d29b695369493a909562ff1325f8cd)
2023-04-27 21:30:38 +01:00
Thomas Blume
4c65c644d6 test/test-functions: fix typo in install_suse_systemd()
(cherry picked from commit d6d06616319ef41ae2f6fcc4812764de2295cd7e)
2023-04-27 21:30:38 +01:00
Franck Bui
fca5a45a59 test: install symlinks with valid targets on SUSE and Debian
(cherry picked from commit f8d527aa9a9c724199aeafab45714a94eea2caf3)
2023-04-27 21:30:38 +01:00
Frantisek Sumsal
0d9c2c270b test: set ReadWritePaths= for test-.services when built w/ coverage
Let's make the dropin, to make the build dir writable for gcov, a bit
more generic, so it can be used by all units starting with prefix test-.
This should help with a bunch of recent reports about missing coverage I
got, as well as with existing test units using DynamicUser=true.

This might feel a bit like a magic trick from behind the curtains, but I
want to touch the actual tests as little as possible, since it makes them
unnecessarily messy (see the various workarounds for sanitizers), and
the coverage reports are generated only in a specific CI job anyway.

(cherry picked from commit e660c590a5222bc72f7aea8912806aa48b0fb126)
2023-04-27 21:30:38 +01:00
Luca Boccassi
dbb1b9c2c8 test: do not remove state directory on failure
The test log is in the state directory, and we want to keep it around
when a test fails.

Follow-up for: 256a835f1c6c646a55039659aa2db186fbeb5c5d

(cherry picked from commit 49e8342965649503a537beacb77dd0fafc71debe)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
7a17e41dcf test: drop whitespace after shell redirection operators
(The one case that is left unchanged is '< <(subcommand)'.)

This way, the style with no gap was already dominant. This way, the reader
immediately knows that ' < ' is a comparison operator and ' << ' is a shift.

In a few cases, replace custom EOF replacement by just EOF. There is no point
in using someting like "_EOL" unless "EOF" appears in the text.
2023-02-06 09:19:04 +01:00
Frantisek Sumsal
42262f3e1b test: wrap delv & dig when running with sanitizers
On Arch both delv and dig pull in libnss_resolve:

```
$ grep resolve /etc/nsswitch.conf
hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
```
2023-01-27 16:40:52 +01:00
Frantisek Sumsal
e0cbb73911 test: bump the client-side timeout in sd-bus as well
Since c78d18215b D-Bus services now have 60s to start, but the client
side (sd-bus) still waits only for 25s before giving up:

```
[  226.196380] testsuite-71.sh[556]: + assert_in 'Static hostname: H' ''
[  226.332965] testsuite-71.sh[576]: + set +ex
[  226.332965] testsuite-71.sh[576]: FAIL: 'Static hostname: H' not found in:
[  228.910782] sh[577]: + systemctl poweroff --no-block
[  232.255584] hostnamectl[565]: Failed to query system properties: Connection timed out
[  236.827514] systemd[1]: end.service: Consumed 2.131s CPU time.
[  237.476969] dbus-daemon[566]: [system] Successfully activated service 'org.freedesktop.hostname1'
[  237.516308] systemd[1]: system-modprobe.slice: Consumed 1.533s CPU time.
[  237.794635] systemd[1]: testsuite-71.service: Main process exited, code=exited, status=1/FAILURE
[  237.818469] systemd[1]: testsuite-71.service: Failed with result 'exit-code'.
[  237.931415] systemd[1]: Failed to start testsuite-71.service.
[  238.000833] systemd[1]: testsuite-71.service: Consumed 5.651s CPU time.
[  238.181030] systemd[1]: Reached target testsuite.target.
```

Let's override the timeout in sd-bus as well to mitigate this.

Follow-up to c78d18215b3e5b0f0896ddb1d0d72c666b5e830b.
2023-01-23 18:44:55 +01:00
Frantisek Sumsal
c78d18215b test: bump D-Bus service start timeout if we run without accel
The default (25s) doesn't seem to be enough in some cases (especially
in VMs without acceleration), causing spurious timeouts:

[  174.297658] dbus-daemon[647]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.0' (uid=0 pid=645 comm="hostnamectl " label="kernel")
[  184.202313] systemd[1]: systemd-update-utmp-runlevel.service: Consumed 1.253s CPU time.
[  197.335422] systemd[1]: Started dbus.service.
[  199.211468] testsuite-71.sh[639]: + assert_in 'Static hostname: H' ''
[  199.347192] dbus-daemon[647]: [system] Failed to activate service 'org.freedesktop.hostname1': timed out (service_start_timeout=25000ms)
[  199.394879] testsuite-71.sh[657]: + set +ex
[  199.438918] testsuite-71.sh[657]: FAIL: 'Static hostname: H' not found in:
[  200.966006] systemd-logind[631]: Watching system buttons on /dev/input/event0 (Power Button)
[  201.008178] systemd-logind[631]: Watching system buttons on /dev/input/event1 (AT Translated Set 2 keyboard)
[  201.034106] systemd-logind[631]: New seat seat0.
[  201.238267] sh[658]: + systemctl poweroff --no-block
[  201.329890] systemd[1]: Starting systemd-hostnamed.service...
[  202.156622] systemd[1]: systemd-update-utmp-runlevel.service: Deactivated successfully.
[  204.818913] hostnamectl[645]: Failed to query system properties: Connection timed out
[  205.195583] systemd[1]: testsuite-71.service: Main process exited, code=exited, status=1/FAILURE
[  205.227237] systemd[1]: testsuite-71.service: Failed with result 'exit-code'.
[  205.712780] systemd[1]: Failed to start testsuite-71.service.
2023-01-17 23:09:34 +00:00
Luca Boccassi
da035a3a24 p11kit: switch to dlopen() 2022-12-19 14:49:01 +01:00
Zbigniew Jędrzejewski-Szmek
a7eed3eca3 TEST-65: check cat-config operation in chroot
This verifies the fix in 2075b6dd394e09a0f203b9cc7e3253908397f933.
2022-12-07 12:38:10 +01:00
Luca Boccassi
de28dd77c1 test: double default image size
I am now hitting the 500MB limit on Debian stable.
2022-12-05 15:17:57 +00:00
Yu Watanabe
8077dc9657
Merge pull request #25389 from fbuihuu/update-test-for-opensuse
Update test/ for openSUSE
2022-11-19 05:58:51 +09:00
Franck Bui
4e8172c88a tests: update install_suse_systemd()
- Use inst_recursive() and image_install() helpers where appropriate

- Update comments to explain why we need to install the test data manually in
  $initdir

- Install manual/ in $initdir as TEST-35-LOGIN relies on
  manual/test-session-properties
2022-11-18 11:03:22 +01:00