1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 03:25:31 +03:00
Commit Graph

2887 Commits

Author SHA1 Message Date
Yu Watanabe
74af762551 test: use timeout command to improve performance
c.f. #23723.
2022-07-08 07:02:13 +09:00
Yu Watanabe
d64c7623ab test: remove /failed and /testok before running test script 2022-07-08 07:00:02 +09:00
Yu Watanabe
0d6217efc1
Merge pull request #23937 from mrc0mmand/test-tweaks
Several ASan-related test suite tweaks
2022-07-08 06:25:57 +09:00
Frantisek Sumsal
8fec14a7d3 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).
2022-07-07 20:54:41 +02:00
Frantisek Sumsal
1e42972958 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.
2022-07-07 20:54:41 +02:00
Frantisek Sumsal
0a62b8f705 test: avoid overriding an already existing EXIT handler
TEST-70 specified its own EXIT handler, which replaced the
`cleanup_loopdev` handler, so the loop device was always hanging around
once this test was run. Let's use the new `add_at_exit_handler()` stuff
to mitigate this.
2022-07-07 20:17:34 +02:00
Frantisek Sumsal
b92c3df242 test: allow multiple handlers for the EXIT signal
Bash allows only one handler per signal, so let's overcome this
limitation by having one dedicated EXIT signal which runs all registered
handlers from all over the place.
2022-07-07 20:17:34 +02:00
Frantisek Sumsal
98b27937cb test: bump the data partition size if we don't strip binaries
so we can run TEST-24 under sanitizers as well.

Also, when at it, use the 'named-fields' sfdisk format to make the code
a bit more descriptive without needing a manual.
2022-07-07 19:17:05 +02:00
Frantisek Sumsal
fdb70dd922 test: create an ASan wrapper for getent and su
since they "suffer" from the same issue as `login` and other binaries
that load PAM stuff
2022-07-07 19:17:05 +02:00
Yu Watanabe
63663a0f0f test: several cleanups for TEST-35-LOGIN
- use test_append_files() to install additional commands
- drop use of expect
- include assert.sh and use assertions at several places
- use timeout command at several places
- always use logind-test-user
- etc
2022-07-07 13:15:00 +00:00
Michal Sekletar
bf40417c7c tests: add test for handling of background sessions 2022-07-07 10:11:43 +09:00
Yu Watanabe
948fce5118 test: fix typo 2022-07-07 09:33:11 +09:00
Yu Watanabe
99080ed3f0
Merge pull request #23396 from msekletar/fix-idle-action-lock
logind: remember our idle state and use it to detect idle level transitions
2022-07-07 07:42:51 +09:00
Yu Watanabe
917c6bb4b3
Merge pull request #23916 from keszybz/assorted-patches
Assorted patches
2022-07-06 14:15:50 +09:00
Zbigniew Jędrzejewski-Szmek
cec3e9a774 fuzz: rename samples to avoid long test names 2022-07-05 21:49:12 +02:00
nl6720
0e68582323 tree-wide: link to docs.kernel.org for kernel documentation
https://www.kernel.org/ links to https://docs.kernel.org/ for the documentation.
See https://git.kernel.org/pub/scm/docs/kernel/website.git/commit/?id=ebc1c372850f249dd143c6d942e66c88ec610520

These URLs are shorter and nicer looking.
2022-07-04 19:56:53 +02:00
Yu Watanabe
7c38952e68
Merge pull request #23104 from mrc0mmand/resolved-tests
Introduce systemd-resolved test suite
2022-07-04 23:46:16 +09:00
Michal Sekletar
181656fc0f tests: verify that Lock D-Bus signal is sent when IdleAction=lock 2022-07-04 14:22:15 +02:00
Frantisek Sumsal
fb6f25d7b9 test: Introduce systemd-resolved test suite
Resolves: #19599
2022-07-04 12:21:55 +02:00
Frantisek Sumsal
17082e8ac1 test: resize the terminal automagically with INTERACTIVE_DEBUG=yes 2022-07-04 09:41:06 +02:00
Frantisek Sumsal
8afe2f53b2 test: install /usr/libexec/vi as well
since `/bin/vi` (at least on Fedora) is a shell wrapper which runs
either `/bin/vim` or `/usr/libexec/vi` based on availability.
2022-07-04 09:41:06 +02:00
Nick Rosbrook
ddbc88188c test: copy libgcc_s.so.1 to TPM2 test image on Debian-like systems
On Ubuntu, cryptsetup does not link against libgcc_s.so.1 which leads to
the following test failure in TEST-70-TPM2:

 systemd[1]: Starting testsuite-70.service...
 systemd[329]: testsuite-70.service: Executing: /usr/lib/systemd/tests/testdata/units/testsuite-70.sh
 testsuite-70.sh[329]: + export SYSTEMD_LOG_LEVEL=debug
 testsuite-70.sh[329]: + SYSTEMD_LOG_LEVEL=debug
 testsuite-70.sh[329]: + img=/var/tmp/test.img
 testsuite-70.sh[329]: + dd if=/dev/zero of=/var/tmp/test.img bs=1024k count=20 status=none
 testsuite-70.sh[329]: + echo -n passphrase
 testsuite-70.sh[329]: + cryptsetup luksFormat -q --use-urandom /var/tmp/test.img /tmp/passphrase
 testsuite-70.sh[333]: libgcc_s.so.1 must be installed for pthread_exit to work
 testsuite-70.sh[329]: /usr/lib/systemd/tests/testdata/units/testsuite-70.sh:
     line 12: 333 Aborted (core dumped) cryptsetup luksFormat -q --use-urandom $img /tmp/passphrase

To fix this, manually install libgcc_s.so.1 to the test image if running
on Debian-like systems.
2022-07-02 15:01:30 +01:00
Frantisek Sumsal
d1b1bbfbfa test: add a simple test for daemon-reexec 2022-07-02 05:23:03 +09:00
Michael Biebl
41d6f3bf4d Use https for freedesktop.org
grep -l -r http:// | xargs sed -E -i s'#http://(.*).freedesktop.org#https://\1.freedesktop.org#'
2022-06-28 13:10:05 +02:00
Frantisek Sumsal
53008d0714 test: drop unnecessary || :
since we use `set +e` in the cleanup handler.
2022-06-26 22:06:02 +02:00
Frantisek Sumsal
eda0e525d3 test: run TEST-21 in nspawn only if $TEST_PREFER_NSPAWN is set
so we can run it under nspawn in CIs which don't support nested KVM, but
avoid running it twice (both under nspawn and qemu) in CIs which support
both methods.
2022-06-26 22:06:02 +02:00
Frantisek Sumsal
71cde065b5 test: make TEST-21-DFUZZER work in containers
by avoiding fuzzing networkd and timesyncd when running in a container.
2022-06-26 22:06:02 +02:00
Yu Watanabe
a32badc5a6 Revert "networkd: NetLabel integration"
This reverts PR #23269 and its follow-up commit. Especially,
2299b1cae3 (partially), and
3cf63830ac.

The PR was merged without final approval, and has several issues:
- The NetLabel for static addresses are not assigned, as labels are
  stored in the Address objects managed by Network, instead of Link.
- If NetLabel is specified for a static address, then the address
  section will be invalid and the address will not be configured,
- It should be implemented with Request object,
- There is no test about the feature.
2022-06-22 22:34:26 +09:00
Yu Watanabe
b48ed70c79 Revert NFTSet feature
This reverts PR #22587 and its follow-up commit. More specifically,
2299b1cae3 (partially),
e176f85527,
ceb46a31a0, and
51bb9076ab.

The PR was merged without final approval, and has several issues:
- OSS fuzz reported issues in the conf parser,
- It calls synchrnous netlink call, it should not be especially in PID1,
- The importance of NFTSet for CGroup and DynamicUser may be
  questionable, at least, there was no justification PID1 should support
  it.
- For networkd, it should be implemented with Request object,
- There is no test for the feature.

Fixes #23711.
Fixes #23717.
Fixes #23719.
Fixes #23720.
Fixes #23721.
Fixes #23759.
2022-06-22 22:23:58 +09:00
Frantisek Sumsal
dc350e78fe test: allow overriding $QEMU_MEM when running w/ ASan 2022-06-21 14:03:57 +02:00
Frantisek Sumsal
56e8ee55d5 test: make the shutdown routine a bit more "robust"
Replace the call to the `end.service` with `systemctl poweroff`, since
it seems to cause issues no matter what `--job-mode=` is used:

```
[  129.070993] testsuite-21.sh[380]: ++ systemctl start --job-mode=flush end.service
[  129.154985] testsuite-21.sh[912]: Failed to start end.service: Transaction for end.service/start is destructive (sysinit.target has 'stop' job queued, but 'start' is included in transaction).
[  129.159636] testsuite-21.sh[912]: See system logs and 'systemctl status end.service' for details.
```

Also, add a "safety net" which bypasses the manager and does the
poweroff directly, since sometimes the D-Bus call performed by
`systemctl` might timeout (as the manager might be still processing data
from the fuzzing):

```
[  115.776778] sh[894]: + systemctl poweroff --no-block
[  166.164242] testsuite-21.sh[893]: Failed to start transient service unit: Connection timed out
[  166.269289] sh[894]: Call to PowerOff failed: Connection timed out
```
2022-06-21 12:11:43 +02:00
Frantisek Sumsal
5309b56505 test: drop the at_exit() coredump check
since we don't truncate the journal anymore.
2022-06-21 10:13:48 +02:00
Frantisek Sumsal
d3eb4159c9 test: make dfuzzer less verbose
Otherwise it oversaturates the journal, which in some cases can't keep
up with the load of messages (due to the performance penalty caused by
sanitizers), and gets killed by a watchdog.
2022-06-21 10:04:03 +02:00
Frantisek Sumsal
5dffa6b032 test: always force a new image for dfuzzer
Otherwise we might end up with an image containing broken service
symlinks and other things, which break certain parts of the test.
2022-06-21 10:01:30 +02:00
Frantisek Sumsal
0897048500 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
```
2022-06-20 17:56:09 +00:00
Frantisek Sumsal
d768243a95 test: skip TEST-21-DFUZZER without ASan
as the test is quite time consuming and it yields more useful reports
when the target app is built with sanitizers.
2022-06-19 16:22:35 +02:00
Frantisek Sumsal
354b3364aa test: fuzz our dbus interfaces with dfuzzer 2022-06-19 16:22:35 +02:00
Frantisek Sumsal
508a7f04b3 test: make masking of supplementary services configurable 2022-06-19 11:27:41 +02:00
Yu Watanabe
297cc64bfb
Merge pull request #23771 from mrc0mmand/test-tweaks
A couple of test-output-related tweaks
2022-06-18 10:45:22 +09:00
Frantisek Sumsal
8cda7b91ff test: check journal directly instead of capturing console output 2022-06-17 17:32:41 +02:00
Frantisek Sumsal
35d2d2e61c test: run the custom check hooks before common checks
since we delete the guest journals as part of the save_journal() step in
check_result_common(), making journal inaccessible from the custom check
hooks.
2022-06-17 17:28:13 +02:00
Frantisek Sumsal
4b9a0c3aeb test: pass the initdir to check_result_{qemu,nspawn} hooks 2022-06-17 17:14:45 +02:00
Frantisek Sumsal
72f0e89c0d test: fix a couple of issues found by shellcheck 2022-06-17 15:28:17 +02:00
Frantisek Sumsal
c84d1c9822 test: don't flush debug logs to the console
Let's keep the debug logs in the journal, while logging only
testsute-*.sh stdout/stderr to the console (ba7abf7). This should make
the test output log a bit more readable and potentially the tests itself
a bit faster by avoiding console oversaturation.

Also, it should significantly reduce the size of artifacts kept by CIs.
2022-06-17 15:06:59 +02:00
Frantisek Sumsal
94850fb956 test: always wrap useradd/userdel when running w/ ASan
since they dlopen() PAM modules, including systemd ones.
2022-06-17 14:51:52 +02:00
Frantisek Sumsal
582547cbd3 test: make the busy loop in TEST-02 less verbose
as it unnecessarily clogs the logs.
2022-06-17 14:51:52 +02:00
Luca Boccassi
9dd98db27d
Merge pull request #23756 from yuwata/analyze-seccomp-filter
analyze: fix seccomp filter handling in security command
2022-06-17 09:58:14 +01:00
Frantisek Sumsal
ba7abf79a5 test: send stdout/stderr of testsuite units to journal & console
to make debugging in CIs slightly easier.
2022-06-17 12:54:50 +09:00
Yu Watanabe
cf906beaef test: add syscall filter tests for analyze security 2022-06-17 12:45:45 +09:00
Yu Watanabe
75176c7914
Merge pull request #23741 from mrc0mmand/more-asan-tweaks
test: wrap certain uninstrumented binaries to make them work w/ ASan
2022-06-16 12:10:56 +09:00