1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-01 05:47:04 +03:00

433 Commits

Author SHA1 Message Date
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
Lennart Poettering
42a3f23cc1 test: also test nspawn system→service inheritance of creds 2022-04-22 11:32:47 +02:00
Lennart Poettering
6d085447fa test: make sure that SetCredential=/LoadCredential fallback won#t regress 2022-04-22 11:32:47 +02:00
Luca Boccassi
3603f15171 nspawn: fix --ephemeral with --machine
Follow-up for 2362fdde1b

When --machine is specified with --ephemeral, no random suffix is added, so
the recently added assert would fail.

Add a top-level variable with the expected file name for nspawn files, and
compute it when the rest of the names are computed.
2022-04-20 02:33:01 +09:00
Luca Boccassi
2362fdde1b nspawn: fix locating config files with --ephemeral
When --ephemeral is used, a random 16 characters suffix is added to the image
name, so matching on .nspawn files based on the image name no longer works.

Fixes https://github.com/systemd/systemd/issues/13297
2022-04-19 06:17:16 +09:00
Frantisek Sumsal
18161cf0ca test: partition the MD device
Also, loop the assemble/disassemble part couple of times to test udev
even harder.

Resolves: #23092
2022-04-17 21:53:12 +09:00
Frantisek Sumsal
6d49e0945f test: cleanup after the MD + LVM test case as well 2022-04-17 16:14:30 +09:00
Yu Watanabe
7be87278a3
Merge pull request #23021 from fbuihuu/tmpfiles-fix-precedence-with-plus-sign
Tmpfiles fix precedence with plus sign
2022-04-16 01:36:51 +09:00
Frantisek Sumsal
d3ce9bed68 test: add a test case for MD + LVM + ext4 2022-04-14 12:54:16 +02:00
Frantisek Sumsal
1bb3887595 test: extend testcase_mdadm_basic() with RAID 5 and 10 2022-04-14 12:45:23 +02:00
Lennart Poettering
4bcf5c11c8
Merge pull request #23011 from mrc0mmand/TEST-64-md
test: add MD-related tests to TEST-64
2022-04-13 22:26:50 +02:00
Michal Sekletar
b26f4f0028 tests: reflect that we can now handle devices with very long sysfs paths 2022-04-13 17:46:52 +02:00
Frantisek Sumsal
3c9af05cae test: add MD-related tests to TEST-64 2022-04-14 00:12:02 +09:00
Franck Bui
402f2b3ce8 test: add test checking tmpfiles conf file precedence 2022-04-11 11:22:39 +02:00
Franck Bui
9f55d48ba5 test tmpfiles: add a test for 'w+' 2022-04-11 11:22:39 +02:00
Michal Sekletar
2ef0101e0b tests: add test case for long unit names 2022-04-08 15:18:29 +02:00