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

2042 Commits

Author SHA1 Message Date
Yegor Alexeyev
c95df5879e relay role implementation 2021-04-20 15:11:53 +02:00
Frantisek Sumsal
3f161ba9bc test: make the test entrypoint scripts shellcheck-compliant 2021-04-20 10:26:43 +02:00
Lennart Poettering
5a3b86404a test: add test for new repart features 2021-04-19 23:19:52 +02:00
Frantisek Sumsal
94009c27f4 test: rewrite kernel module handling
This code was partially broken, since the firmware directory was
undefined. Also, some of the parts were a dead code, since they relied
on code from the original dracut test suite.
2021-04-16 19:05:59 +02:00
Frantisek Sumsal
0f1947059b test: use arrays when applicable 2021-04-16 19:05:55 +02:00
Frantisek Sumsal
a33e2692e1 test: avoid using pipes in certain cases
`command -v <bin> | grep ...` can under certain conditions cause the
`command` to exit with SIGPIPE, which in combination with `set -o
pipefail` means that the tests sometimes randomly die during setup.
Let's avoid using pipes in such cases.
2021-04-16 19:05:42 +02:00
Frantisek Sumsal
96af59aabb test: use set -o pipefail
This breaks some existing loops which previously ignored if the piped
program exited with EC >0. Rewrite them to mitigate this (and also make
them more robust in some cases).
2021-04-16 19:05:37 +02:00
Frantisek Sumsal
1b8fcd9c63 test: shell code cleanup
Just some basic stuff, like double quotes around strings, using
predictable values for possibly unset variables, formatting, etc.
2021-04-16 18:49:37 +02:00
Luca Boccassi
cf9844ffab test: use systemd-run --wait in TEST-44-LOG-NAMESPACE
The test appears to be occasionally failing. It uses systemd-run to echo
'hello world' into a namespaced journal and then uses journalctl to look for it,
but it doesn't wait.
In the failed runs it can't find it, but the automated journal dump shows
the message at the end.

Use --wait to avoid races.
2021-04-15 08:16:19 +02:00
Zbigniew Jędrzejewski-Szmek
6634a39469
Merge pull request #19266 from mrc0mmand/testsuite-shellcheck
test: make the test scripts shellcheck-compliant
2021-04-14 13:58:01 +02:00
LetzteInstanz
70448bb1c1 test-network: test waiting for address family 2021-04-14 09:00:12 +09:00
LetzteInstanz
8430841b5e network: save IPv4/IPv6 address states into state file
This also introduces RequiredFamilyForOnline= setting to .network file,
and IPv4AddressState/IPv6AddressState DBus properties.
2021-04-14 08:51:02 +09:00
Yegor Alexeyev
21b6b87eb3 dhcp: Implemented BindToInterface= configuration option 2021-04-14 07:30:40 +09:00
Frantisek Sumsal
84031b5d6e test: bunch of assorted tweaks to make shellcheck happy 2021-04-13 19:14:35 +02:00
Frantisek Sumsal
4544002cae test: use arrays to make things a bit cleaner 2021-04-13 13:20:22 +02:00
Frantisek Sumsal
ea539ad297 test: replace the obsolete `` syntax with $() 2021-04-13 12:08:01 +02:00
Frantisek Sumsal
70ad107bdf test: use an explicit no-op for file truncation 2021-04-13 12:08:01 +02:00
Frantisek Sumsal
f794098356 test: tidy up arithmetic expressions 2021-04-13 12:08:01 +02:00
Frantisek Sumsal
3882526798 test: use quotes where necessary
to avoid possible word splitting.
2021-04-13 12:08:01 +02:00
Frantisek Sumsal
084575ff91 test: use set -eux and set -o pipefail everywhere
This should make the scripts more robust.
2021-04-13 12:08:01 +02:00
Zbigniew Jędrzejewski-Szmek
839eb4a458
Merge pull request #13496 from wat-ze-hex/custom-bpf-progs-parameterized-3
bpf: extend bpf cgroup program support
2021-04-12 14:31:42 +02:00
Yu Watanabe
37b7a716d3
Merge pull request #19164 from mmatsuya/main
tmpfiles: use a entry in hashmap as ItemArray in read_config_file()
2021-04-11 16:46:25 +09:00
Julia Kartseva
96734772a7 fuzz: add BPFProgram= to directives 2021-04-09 20:28:47 -07:00
Zbigniew Jędrzejewski-Szmek
8649ec4725
Merge pull request #19248 from keszybz/make-tests-test
Make tests test
2021-04-09 07:56:04 +02:00
Zbigniew Jędrzejewski-Szmek
b1e1e5ac25 TEST-17: make the test test
'! grep -v' does *not* test that there are no matching lines.
Instead, it checks that whether there are any non-matching lines.

And of course, for the test to fail, '! grep' cannot be part of
an expression with &&.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
68bb821e21 TEST-46: simplify lossy diff invocation 2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
b9bfa250f2 homectl,TEST-46: fix test and fix homectl return value, update docs
The usual: the test wasn't testing, so we didn't notice that the
command wasn't returning as expected.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
f49467b959 TEST-44: fix test
We were grepping for 'hello world', and in the namespace we would
match on 'hello world', and outside, on 'echo "hello world"'. When
the condition check was fixed, the test gave a false positive.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
d933ccd30b TEST-43: fix exit condition testing
We were invoking 'systemd-run bash', but the test invoked by bash
was not effective. When the result of that check is propagated, the
outer command fails.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
0ee994836c TEST-*: use spacing before redirection operator, but not after
<< EOF → <<EOF
> foo < bar → >foo <bar
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
4e20fe2795 TEST-*: make failure tests actually fail on failure
Here the intent was actually correct, and the tests still pass when the check
is made effective.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
61494724ee TEST-42-EXECSTOPPOST: un-invert test
Since we test for the file right below, it seems we expected the
command to succeed.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
b88ba6c761 tmpfiles: make handling of existing-but-different targets more consistent
create_fifo() was added in a2fc2f8dd3, and
would always ignore failure. The test was trying to fail in this case, but
we actually don't fail, which seems to be correct. We didn't notice before
because the test was ineffective.

To make things consistent, generally log at warning level, but don't propagate
the error. For symlinks, log at debug level, as before.

For 'e', failure is not propagated now. The test is adjusted to match.

I think warning is appropriate in most cases: we do not expect a device node to
be replaced by a different device node or even a non-device file. This would
most likely be an error somewhere. An exception is made for symlinks, which are
mismatched on purpose, for example /etc/resolv.conf. With this patch, we don't
get any warnings with the any of the 74 tmpfiles.d files, which suggests that
increasing the warning levels will not cause too many unexpected warnings. If
it turns out that there are valid cases where people have expected mismatches
for non-symlink types, we can always decrease the log levels again.
2021-04-08 20:16:37 +02:00
Luca Boccassi
9f519e491f tests: allow for os-release quote variability in TEST-50-DISSECT
Quoting of values differs between distros: Fedora doesn't quote the ID_
fields, but CentOS does.
Adjust the test checks to account for this.

Fixes #19242
2021-04-08 16:16:55 +02:00
Zbigniew Jędrzejewski-Szmek
b065dfc8ed TEST-33-CLEAN-UNIT: fix broken test exposed by condition check fix 2021-04-08 11:46:07 +02:00
Zbigniew Jędrzejewski-Szmek
4e324ce42c TEST-22-TMPFILES: fix broken test exposed by condition check fix 2021-04-08 11:46:07 +02:00
Zbigniew Jędrzejewski-Szmek
ffa328f060 tests: make inverted tests actually count
"! test ..." does not cause the script to fail, even with set -e.
IIUC, bash treats this command as part of an expression line, as it
would if 'test ... && ...' was used. Failing expression lines do not
terminate the script.

This fixes the obvious cases by changing '! test' → 'test !'.
Then the inversion happens internally in test and bash will propagate
the failure.
2021-04-08 11:45:59 +02:00
Zbigniew Jędrzejewski-Szmek
1672be8602 TEST-22-TMPFILES: add reproducer for bug with X 2021-04-08 11:01:29 +02:00
Zbigniew Jędrzejewski-Szmek
71d1e58309 core: fix memleak of ipc_namespace_path
Fixup for a70581ffb5.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32991
2021-04-07 22:12:50 +01:00
Frantisek Sumsal
34fde9f898 test: check if the unit file fuzzer corpora is up to date
This follows a similar pattern we already have in place for
networkd-related directives.
2021-04-05 14:41:05 +01:00
Frantisek Sumsal
080a602771 fuzzer: add a test case for #19178 2021-04-03 10:38:06 +01:00
Luca Boccassi
907952bbc9 portabled: add --extension parameter for layered images support
Add an --extension parameter to portablectl, and new DBUS methods
to attach/detach/reattach/inspect.
Allows to append separate images on top of the root directory (os-release
will be searched in there) and mount the images using an overlay-like
setup (unit files will be searched in there) using the new ExtensionImages
service option.
2021-03-31 09:56:44 +01:00
Zbigniew Jędrzejewski-Szmek
a2dc3adef2
Merge pull request #18990 from yuwata/network-dhcpv6-use-domains
network: also introduce UseDomains= for [DHCPv6] section
2021-03-31 10:38:37 +02:00
Zbigniew Jędrzejewski-Szmek
b880ac2c15
Merge pull request #18958 from poettering/dissect-no-root
dissect-image: support images without rootfs but with /usr partition + support simple partition versioning via strverscmp() on part label
2021-03-31 10:31:32 +02:00
Henri Chain
cb0e818f7c Introduce ExitType 2021-03-31 10:26:07 +02:00
Zbigniew Jędrzejewski-Szmek
129cb6e249 shared/calendarspec: when mktime() moves us backwards, jump forward
When trying to calculate the next firing of 'Sun *-*-* 01:00:00', we'd fall
into an infinite loop, because mktime() moves us "backwards":

Before this patch:
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
tm_within_bounds: good=0 2021-03-29 01:00:00 → 2021-03-29 00:00:00
...

We rely on mktime() normalizing the time. The man page does not say that it'll
move the time forward, but our algorithm relies on this. So let's catch this
case explicitly.

With this patch:
$ TZ=Europe/Dublin faketime 2021-03-21 build/systemd-analyze calendar --iterations=5 'Sun *-*-* 01:00:00'
Normalized form: Sun *-*-* 01:00:00
    Next elapse: Sun 2021-03-21 01:00:00 GMT
       (in UTC): Sun 2021-03-21 01:00:00 UTC
       From now: 59min left
       Iter. #2: Sun 2021-04-04 01:00:00 IST
       (in UTC): Sun 2021-04-04 00:00:00 UTC
       From now: 1 weeks 6 days left           <---- note the 2 week jump here
       Iter. #3: Sun 2021-04-11 01:00:00 IST
       (in UTC): Sun 2021-04-11 00:00:00 UTC
       From now: 2 weeks 6 days left
       Iter. #4: Sun 2021-04-18 01:00:00 IST
       (in UTC): Sun 2021-04-18 00:00:00 UTC
       From now: 3 weeks 6 days left
       Iter. #5: Sun 2021-04-25 01:00:00 IST
       (in UTC): Sun 2021-04-25 00:00:00 UTC
       From now: 1 months 4 days left

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1941335.
2021-03-23 00:35:02 +01:00
Lennart Poettering
1474d7ac2d dissect: show partition label in table
We nowadays pick up the partition label while dissecting, let's show it
if we have it.
2021-03-16 14:57:53 +01:00
Yu Watanabe
f225a338c3 network: also introduce UseDomains= for [DHCPv6] section
When we split [DHCP] section into [DHCPv4] and [DHCPv6], UseDomains=
setting was forgot to be introduced in [DHCPv6] section.
2021-03-14 00:28:19 +09:00
Frantisek Sumsal
5acfe54e98 test: fix permissions of the ASan udev workaround
otherwise udev complains about the file being world-writable:
systemd-udevd[228]: Configuration file /etc/udev/rules.d/00-set-LD_PRELOAD.rules is marked world-writable. Please remove world writability permission bits. Proceeding anyway.

Fixes: systemd/systemd-centos-ci#354
2021-03-11 00:28:13 +09:00
Frantisek Sumsal
4b252eaa31 test: disable nss-systemd for TEST-22 under ASan
When running TEST-22 under ASan, there's a chain of events which causes
`stat` to output an extraneous ASan error message, causing following
fail:

```
+ test -d /tmp/d/1
++ stat -c %U:%G:%a /tmp/d/1
==82==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
+ test = daemon:daemon:755
.//usr/lib/systemd/tests/testdata/units/testsuite-22.02.sh: line 24: test: =: unary operator expected
```

This is caused by `stat` calling nss which in Arch's configuration calls
the nss-systemd module, that pulls in libasan which causes the $LD_PRELOAD
error message, since `stat` is an uninstrumented binary.

The $LD_PRELOAD variable is explicitly unset for all testsuite-* services
since it causes various issues when calling uninstrumented libraries, so
setting it globally is not an option. Another option would be to set
$LD_PRELOAD for each `stat` call, but that would unnecessarily clutter
the test code.
2021-03-10 11:59:43 +01:00