1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-20 14:03:39 +03:00

448 Commits

Author SHA1 Message Date
Luca Boccassi
0887c972c8 TEST-55-OOMD: use swap file instead of partition
The partition seems not to work on Ubuntu for some reason, use a
swap file instead

(cherry picked from commit f434f182ccfd17a214e4b07cec033318e6c4f7b2)
(cherry picked from commit 39459a5d8065ea5ce45dbca39561bd078d801aa0)
(cherry picked from commit 79bfbb0163bd587057e7d5af74b4c1ea97f2a1f4)
2023-07-10 22:01:38 +01:00
Luca Boccassi
1ec8632cad TEST-55-OOMD: use 'stress' to create high pressure
The test fails on my machine, running Debian stable, because
testsuite-55-testbloat.service just swaps and never goes over the
limit, so it's not killed. Use 'stress' instead which seems to be
able to overwhelm the swap too.

(cherry picked from commit 937e82cb7d82dbdbd287d82f4708f15d6032eb9f)
(cherry picked from commit 9654140f342df74b8572da1fa4d5969f3d9b4617)
(cherry picked from commit cad0dba2f824ebc26eb44f674955e3cfe9ef2e35)
2023-07-10 22:01:38 +01:00
Frantisek Sumsal
56575054bd test: test transactions with cycles
Provides coverage for systemd/systemd#26872.

With systemd/systemd#26875 reverted:

[16444.287652] testsuite-03.sh[71]: + for i in {0..19}
[16444.287652] testsuite-03.sh[71]: + systemctl start transaction-cycle0.service
[16444.359503] systemd[1]: =================================================================
[16444.360321] systemd[1]: ==1==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6180002e578e at pc 0x7f73b25ec7a6 bp 0x7ffc5531c6f0 sp 0x7ffc5531be68
[16444.360798] systemd[1]:
[16444.361044] systemd[1]: READ of size 783 at 0x6180002e578e thread T0 (systemd)
[16444.391684] systemd[1]:     #0 0x7f73b25ec7a5  (/lib64/libasan.so.5+0x557a5)
[16444.392167] systemd[1]:     #1 0x7f73b260a1d5 in __interceptor_vasprintf (/lib64/libasan.so.5+0x731d5)
[16444.392442] systemd[1]:     #2 0x7f73afa1d1e1 in log_format_iovec ../src/basic/log.c:996
[16444.392750] systemd[1]:     #3 0x7f73afa1e7b6 in log_struct_internal ../src/basic/log.c:1058
[16444.393101] systemd[1]:     #4 0x7f73b1979136 in transaction_verify_order_one ../src/core/transaction.c:392
[16444.393540] systemd[1]:     #5 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
[16444.393946] systemd[1]:     #6 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
[16444.394262] systemd[1]:     #7 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
[16444.394532] systemd[1]:     #8 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
[16444.394812] systemd[1]:     #9 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
...

(cherry picked from commit 0651e717496aed30bcec7740286d719860995625)
(cherry picked from commit fdc6ce1d00387320b81e1a27d9bb8d5dea0171f9)
(cherry picked from commit 4ac2071192de55e4a35d89ed1e61ae8b5eb201f0)
2023-07-10 22:01:38 +01:00
Luca Boccassi
0478336785 TEST-55-OOMD: improve ephemeral configuration readability
(cherry picked from commit 6acbb3f2fb234d9903c15571472d95afee9d08c1)
(cherry picked from commit 3cbc30f3096aa880d57fd7f7a8960fa7f7958085)
(cherry picked from commit d0bdac53cb370f5d64cd271ee29314fc6b3d0ca6)
2023-07-10 22:01:38 +01:00
Luca Boccassi
1326a91215 TEST-55-OOMD: use /run/ for configuration instead of /etc/
Make sure configuration is ephemeral if the image is reused

(cherry picked from commit 565b13f8b2895a2656fac677fe4ed3f6344e66b2)
(cherry picked from commit 622c1774508f3f1434b0b732860f76972460030f)
(cherry picked from commit 38677da70062e1440e2a1ddd8640ef9170f13584)
2023-07-10 22:01:38 +01:00
Frantisek Sumsal
44ae33e03c test: make sure ping works for unprivileged users
(cherry picked from commit f087837c46d77745425fd9b84f1de9e5703836af)
(cherry picked from commit bcd2cf893281c927c33c3d0ff5ea04aab22b16c8)
(cherry picked from commit eb914ee546049a4cde144c5930a8369a0fc3067d)
2023-07-10 22:01:38 +01:00
Frantisek Sumsal
821e138706 test: drop the --recursive=no test
As the outcome also depends on availability of the PID namespace, so
the test might (and does) unexpectedly pass in some environments.

(cherry picked from commit d99e099fb45ad71988e22d3a0d081725d1b6e653)
(cherry picked from commit 398cb5005bfdb41ae2f8f8031505b6511279b6c4)
(cherry picked from commit d934e0d097bf660f9c46fc82cd606b45b32108d5)
2023-07-10 22:01:38 +01:00
Zbigniew Jędrzejewski-Szmek
7920dd23ba tests: drop unnecessary redirection of stderr
command -v doesn't print anything to stderr, let's use the canonical
form with just >/dev/null.

(cherry picked from commit e80444729fbfc05d4b22e775072165eba72fae72)
(cherry picked from commit fdef50b998bc2e9f30fba5df2a4e48f2d9947353)
(cherry picked from commit 9ff887b8620f8df121b273ebe15e6dfaca9d1aa4)
2023-07-10 22:01:38 +01:00
Frantisek Sumsal
5162256e5d test: check if we can use --merge with --follow
Provides coverage for #24565.

(cherry picked from commit c11c50a53f677f3977f3144b9fc5f02a3516de9f)
(cherry picked from commit debce7c1849877f233c105bffb509bc5902c4748)
(cherry picked from commit 420944320ce07b13b4701b9117d05ea34f8e0885)
2023-06-02 22:45:46 +01:00
Frantisek Sumsal
caab3233e4 test: make the stress test slightly less stressful on slower machines
Without acceleration this part of the test takes over 10 minutes (!),
which feels quite unnecessary. Let's cut down the number of stuff we
dump to the journal in such case, but keep the original value if we run
with acceleration (since in that case it takes less than 10 seconds).

(cherry picked from commit ff40235b9bd2a944131c36b1c7ccfd88f49a194e)
(cherry picked from commit 6a4c05c61558961ded25d4e1faaed5fdf4692265)
(cherry picked from commit d4cea5d5f54d0df5cf7715141af4e0cf1eeb1a0d)
2023-06-02 22:45:46 +01:00
Yu Watanabe
11c53ec3b1 test: create temporary units under /run
(cherry picked from commit 2e701a7946b492cc5f1e56307c4e94110b4c650c)
(cherry picked from commit c1542a967ba8c63ab3faf73db97f42405d99184e)
(cherry picked from commit 63aab858638726bf561fd5b46b3e12a27c48f4e1)
2023-05-02 23:43:17 +01:00
Thomas Blume
f8bd6cd7d6 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)
(cherry picked from commit 43d194392fd36151c339fa7a1a9eebe30490bddb)
(cherry picked from commit 9cd2f2c31f0291a865f1ae26f2754211e9437300)
2023-04-29 11:36:49 +01:00
Zbigniew Jędrzejewski-Szmek
3776e1f2ee test: drop uses of "&& { echo 'unexpected success'; exit 1; }"
Brief is sweet.

(cherry picked from commit 128db0aa0098b58b415065c2955f9abc7fc967e1)
(cherry picked from commit f3abd451dde25086e06c56ba0b8388f64c1d306e)
(cherry picked from commit 3626aabecb8a8682caa466de711e8f6509f954ec)
2023-04-29 11:36:49 +01:00
Frantisek Sumsal
47bbd034c3 test: prefix the transient unit with test- to make coverage runs happy
See 9fd8226312 for more details.

Follow-up to c9210b7470.

(cherry picked from commit 574d09bad079cfc19e0dd142fd6fe23d4b251878)
(cherry picked from commit 14eb49b5eb48a73a77baafc63aa3e46c524aeaf2)
(cherry picked from commit d5ad512709f70180b1614e675c8a225227a5c6ef)
2023-04-29 11:36:49 +01:00
Luca Boccassi
48b9984e64 creds: make available to all ExecStartPre= and ExecStart= processes
Fixes https://github.com/systemd/systemd/issues/27275

(cherry picked from commit c9210b74701d749c5b684cc4de517be42baa9c57)
(cherry picked from commit d37f06f96f7ddaa447b01077a4024473a02c7ba8)
(cherry picked from commit f55ffedc69c36d256fb66c4e9d3f857a89910946)
2023-04-29 11:36:49 +01:00
Frantisek Sumsal
78e20624b2 test: stop the test unit when it's not needed anymore
Otherwise it keeps printing stuff to the journal/console, adding
unnecessary noise.

(cherry picked from commit 3a8b7e8b5f72a940a07938a8ed33f2c3283dd52b)
(cherry picked from commit eab75a859117206352f4c8d2928631c42e9b3541)
(cherry picked from commit e33487408347a041f6b27b4145cd94fae345846a)
2023-04-29 11:36:49 +01:00
Nick Rosbrook
4e9ed04401 test: add some tests for RuntimeMaxSec
Make sure the RuntimeMaxSec is applied correctly to service and scope
units when they are started, and also on coldplug.

(cherry picked from commit af4688398f55b110c9d7d57be5cd0199b06e18c8)
(cherry picked from commit f152cdabaed160c767de2857b9c22513e8518b3e)
(cherry picked from commit 6da4d102e1a37011bb7c897e492268bb71bc069d)
2023-04-29 11:36:49 +01:00
Luca Boccassi
db89c44f82 Uphold/StopWhenUnneeded/BindsTo: requeue when job finishes
When a unit is upheld and fails, and there are no state changes in
the upholder, it will not be retried, which is against what the
documentation suggests.

Requeue when the job finishes. Same for the other two queues.

(cherry picked from commit 4c7a0fc8d061b41fdd63eb19b6fc0a5c94668dde)
(cherry picked from commit fa8d33bb3704f7b14c1c51e1d0e48e0e5042a98c)
(cherry picked from commit dd7a821b5f15265047a14a4bd76f0761bb563d9f)
2023-04-29 11:36:49 +01:00
Frantisek Sumsal
83a29385fa test: bump the timeout for non-qemu runs to 90s
When Ubuntu CI is oversaturated, 60s doesn't seem to be enough.

(cherry picked from commit cb58571a1193122a5c20e8f6587115382d281002)
(cherry picked from commit 93ac024b7e568fe65b2e8f55ef13a32880239e95)
(cherry picked from commit 59982fbe8d7e4e8c906e4909f2b1b766f323dd6e)
2023-04-29 11:36:49 +01:00
Frantisek Sumsal
6e77261d25 test: add a couple of tests for userdbctl
(cherry picked from commit 93fe228bb16afdb7c450af26b4d2e5771016a833)
(cherry picked from commit e1ddc48ff934209db70d4de0f3fa6fcf5225b359)
(cherry picked from commit 7eca133c1d60b8823ecb49d1cef9943006a70b80)
2023-03-31 08:51:57 +02:00
Frantisek Sumsal
234308b264 test: fall back to /sys/fs/cgroup/systemd if necessary
Necessary for some CI setups where we boot an nspawn container on a host
with older systemd with legacy hierarchy, so systemd mounts its stuff
under /sys/fs/cgroup/systemd.

(cherry picked from commit 715b4c26dc9f447a8d7b8cab33c243e15386ce2c)
(cherry picked from commit ff746117083e7418e378e46868aad601db57d920)
(cherry picked from commit 35f3b83cd60fb5eb56a1da753b45431ce0cbe865)
2023-03-31 08:51:56 +02:00
Frantisek Sumsal
b22bd6de9e test: force mkfs.btrfs to overwrite any existing file systems
mkfs.btrfs (unlike mkfs.ext4) checks if the target already contains
a file system and refuses to continue if so. This causes spurious fails
in case the random garbage on the temporary device matches a valid FS
header:

[   19.723806] testsuite-64.sh[355]: + udevadm lock --device=/dev/mapper/encbtrfs0 --device=/dev/mapper/encbtrfs1 --device=/dev/mapper/encbtrfs2 --device=/dev/mapper/encbtrfs3 mkfs.btrfs -M -d raid1 -m raid1 -L btrfs_mencdisk -U deadbeef-dead-dead-beef-000000000003 /dev/mapper/encbtrfs0 /dev/mapper/encbtrfs1 /dev/mapper/encbtrfs2 /dev/mapper/encbtrfs3
[   19.918934] testsuite-64.sh[2494]: ERROR: /dev/mapper/encbtrfs0 appears to contain an existing filesystem (hfsplus)
[   19.920490] testsuite-64.sh[2494]: ERROR: use the -f option to force overwrite of /dev/mapper/encbtrfs0

Let's force mkfs.btrfs to overwrite the file system in such case.

(cherry picked from commit b3ba7d6274aff864a80dc9b1ff7d88ad376da451)
(cherry picked from commit 12c3b1980b47a87139c3f4406161df69e7515873)
(cherry picked from commit b67fad80e048ab4d8f0f39e40302b41f6161fe75)
2023-03-31 08:51:56 +02:00
Nick Rosbrook
7a7427db77 test: handle Debian's /etc/default/locale in testsuite-74.firstboot.sh
This handles a Debian-specific quirk where /etc/default/locale is used
instead of /etc/locale.conf. There is currently special handling for
this in testsuite-73.sh, so the quirk should be handled here too for
consistency.

(cherry picked from commit bb59fdc1e3a7119f3680d309147020fce9bf67b5)
(cherry picked from commit 9b42646b2292decd874c6efb4a9e21b11c8f3c7f)
2023-01-27 09:46:47 +00:00
Frantisek Sumsal
26fdfb0279 test: re-enable skipped systemd-firstboot --locale-messages= test
Since the original issue should be resolved by #25253.

(cherry picked from commit 59377dbef288bff2e9df1254f9cbccd3c7d726a5)
(cherry picked from commit ddc1898ebdd19b754f80f4c51450cda2039c57b7)
2023-01-27 09:46:47 +00:00
Nick Rosbrook
bd32bbebd5 test: make sure mount point exists in testsuite-64.sh
(cherry picked from commit 84e5b9225d12f8a1a7d414ef01f97fcd6881c14f)
(cherry picked from commit 07e4787106fb0a551f73d0a0ec4c6c8e7c958c7d)
2023-01-27 09:46:47 +00:00
Luca Boccassi
ffa329c45c core: ensure init.scope is realized after drop-ins have been loaded
If we add a drop-in for init.scope (e.g.: to set some memory limit),
it will be loaded long after the cgroup has already been realized.
Do it again when creating the special unit.

(cherry picked from commit 020b2e41ea776cff73392da8084a0725b590d245)
(cherry picked from commit 786b7a7208cfb585b70659a8e3ac5180e85d0647)
2023-01-27 09:46:47 +00:00
Michal Koutný
d11c3a2a06 test: Add tests for systemd-cgtop args parsing
(cherry picked from commit d4e32838e875539ad6991b75b083c9563eddc3ed)
(cherry picked from commit 4b885f3591eecc2672b9504bd75a7473d94af9f6)
2022-12-14 17:51:24 +01:00
Yu Watanabe
9243b88b55 test: wait for loop device to be removed
Follow-up for bca762ce1abafd24016eba7310fdd38c758419f8.

Fixes #24450.

(cherry picked from commit 1a0e065e9f154f46fd68cd45f46310bc7df7a51c)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
f5c2be99bc test: wait for the lodev to get properly initialized
Otherwise we might start writing to one of its partition before the
respective node is created under /dev, resulting in... interesting
stuff.

Resolves: #24390
(cherry picked from commit bca762ce1abafd24016eba7310fdd38c758419f8)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
fd082f335e test: lower the # of mpath devices to 16
to make the test suitable for slower machines.

(cherry picked from commit 1678bd2f81096b3b2b7c09f335e9c5cc8da96dca)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
d17a45340b test: make TEST-64 a bit more ASan friendly
Reduce the number of iterations in some of the test cases, since they
generate a huge amount of uevents and basically DoS udev (which can't
keep up while being slowed down by ASan). To avoid this, let's reduce
the number of iterations and bump the timeout when running under ASan,
since we're not interested in performance in such cases.

(cherry picked from commit 1e429729589e0e17158727694c8d1e9c3d42466b)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
68b4f10f82 test: use PBKDF2 with capped iterations instead of Argon2
to reduce the amount of resources the test needs (similarly to TEST-24
where we do the same thing).

(cherry picked from commit 8fec14a7d397f52b93024bf3417de8f77b0d85e6)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
c3b22515b9 test: introduce sanity coverage for auxiliary utils
(cherry picked from commit d1020334fd15e0cffe68cb4d7e862a36253cc481)
(cherry picked from commit 85cf0a962e8b9e3a687bd22e52c3d6333d19a8f8)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
293c006789 test: further extend systemctl's sanity coverage
Also, fix a race condition introduced by d16684fe13:
```
[   16.904218] H testsuite-26.sh[394]: + systemd-run --unit failed.service /bin/false
[   16.964783] H systemd[845]: failed.service: Executing: /bin/false
[   16.965062] H systemd[1]: Started failed.service.
[   16.965462] H testsuite-26.sh[844]: Running as unit: failed.service
[   16.966390] H testsuite-26.sh[394]: + systemctl is-failed failed.service
[   16.977970] H testsuite-26.sh[846]: active
[   16.978403] H systemd[1]: failed.service: Main process exited, code=exited, status=1/FAILURE
[   16.978478] H systemd[1]: failed.service: Failed with result 'exit-code'.
```

(cherry picked from commit 23f3a6f5ff864fd26063c6c35fdaa6d85de566c7)
(cherry picked from commit 30ec52a92aa8672e8345855dd5a92181a4beedc1)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
f48e6576a2 test: add a couple of sanity tests for systemctl
(cherry picked from commit d16684fe13e1d56e55df19b57b6c01b9a9303086)
(cherry picked from commit 77860d006da0289801cb464a28b10974dd1decc7)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
3d5e379808 test: rename TEST-26-SETENV to TEST-26-SYSTEMCTL
(cherry picked from commit c5c258ae0a4a0cfc829ed07ff96c7fab79b6ca71)
(cherry picked from commit bcf30f9170261c7bd8a2232e5b7b03573ae7b57f)
2022-11-08 00:09:18 +01:00
Frantisek Sumsal
7b6fa1d3e6 test: add a couple of sanity tests for journalctl
(cherry picked from commit ca46781c5ffa3aaa7a8fb6f09976357d003c4aae)
(cherry picked from commit 0508cd3b00a2c629c72c0c0e64f7aed7016e8794)
2022-11-08 00:09:18 +01:00
Luca Boccassi
833ad5f950 Revert "Fix issue with system time set back (#24131)"
This fix unfortunately introduced a much worse regression that
is affecting many users, so let's revert it for now and rework
it in the next release.

This reverts commit 5ded3917a161d87984d74d70b5eb2a254e54b44e.

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

(cherry picked from commit 0bf1d0ff049dd257dc5b6efc6b3f5864dc8bee6e)
2022-10-24 20:52:23 +02:00
Yu Watanabe
40053e60f5 test: add more tests for StateDirectory= with DynamicUser=
This also moves the check for writable paths from test-execute to TEST-34.

Closes #10337.

(cherry picked from commit f01f70a9a3f3609c0c8bdbaa4b0b4abbb2b43993)
2022-10-13 22:59:07 +02:00
João Loureiro
37b54927d3 Fix issue with system time set back (#24131)
Fixes #6036

(cherry picked from commit 5ded3917a161d87984d74d70b5eb2a254e54b44e)
2022-09-30 17:46:54 +02:00
Luca Boccassi
a27b694453 integritysetup: do not use crypt_init_data_device after crypt_init
crypt_init_data_device() replaces the crypt_device struct with a
new allocation, losing the old one, which we get from crypt_init().
Use crypt_set_data_device() instead.

Enhance the test to cover this option too.

(cherry picked from commit 872f9da4d8b67b012f1b1b227416d0c99bcdf43c)
2022-08-08 10:59:36 +02:00
Frantisek Sumsal
9facc51e2f test: use saved process PID instead of %%
As the `%%` specifier might fail if the current job (i.e. the last
background job) already finished:

```
[   61.692196] testsuite-04.sh[656]: ++ systemd-id128 new
[   61.705407] testsuite-04.sh[263]: + ID=912cb8f8ef304153a123f772bb0fe9e0
[   61.706318] testsuite-04.sh[657]: + systemd-cat -t 912cb8f8ef304153a123f772bb0fe9e0 bash -c 'echo parent; (echo child) & wait'
[   61.720940] testsuite-04.sh[263]: + PID=657
[   61.721126] testsuite-04.sh[263]: + wait %%
[   61.723014] testsuite-04.sh[263]: /usr/lib/systemd/tests/testdata/units/testsuite-04.sh: line 96: wait: %%: no such job
```

(cherry picked from commit 08970485003c25ce2c4adfaeea2d58558d311d42)
2022-07-13 12:57:39 +02:00
Yu Watanabe
1f97c2da0c test: add test for bus introspection of portable1
Follow-up for #23454.
2022-05-21 06:31:19 +09:00
Luca Boccassi
7b2e763242 portable: reject root directories without an ID field in os-release
We always require at least ID to be set in os-release, reject
and propagate error to the caller instead of asserting later
2022-05-20 13:08:45 +01:00
Zbigniew Jędrzejewski-Szmek
d7ff524039 tree-wide: drop manually-crafted message for missing variables
Bash will generate a very nice message for us:
/tmp/ff.sh: line 1: SOMEVAR: parameter null or not set

Let's save some keystrokes by not replacing this with our own inferior
messages.
2022-05-04 20:53:46 +09:00
Lennart Poettering
41be3b099f
Merge pull request #23170 from poettering/creds-copy
import system credentials from sd-stub + qemu fw_cfg + kernel cmdline explicitly in PID 1
2022-05-02 16:32:21 +02:00
Luca Boccassi
6a59dfa108 analyze security: print DeviceAllow list
Many sandboxing options add implicit DeviceAllow rules, which might be confusing
for users running systemd-analyze security and not expecting it.
Print the list.

Fixes https://github.com/systemd/systemd/issues/23185
2022-05-01 13:43:01 +09:00
Luca Boccassi
444d9abd06 analyze: fix crash with online security check
1449b0f8a96b27 fixed seccomp arch check for the offline case,
but broke it for the normal case, as when coming from D-Bus the
list of seccomp architectures is already converted to string.

Fixes https://github.com/systemd/systemd/issues/23224
2022-05-01 11:47:44 +09:00
Lennart Poettering
93a1f57db8 test: test new credential features 2022-04-28 18:12:00 +02:00
Frantisek Sumsal
98f8c31638 test: extend the "hashed" unit names coverage a bit
Follow-up to #22759.
2022-04-23 08:45:25 +09:00