Commit Graph

1803 Commits

Author SHA1 Message Date
Yu Watanabe faa73d4e0c license: LGPL-2.1+ -> LGPL-2.1-or-later
Follow-up for db9ecf0501.
2020-11-12 10:50:23 +01:00
Lennart Poettering 394131d5be
Merge pull request #17497 from anitazha/randomizeonce
timer: add new feature FixedRandomDelay=
2020-11-10 13:29:04 +01:00
Zbigniew Jędrzejewski-Szmek b8aac5014c
Merge pull request #17431 from msekletar/udev-link-update-race
udev: make algorithm that selects highest priority devlink less susceptible to race conditions
2020-11-10 09:41:57 +01:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Kristijan Gjoshev acf24a1a84 timer: add new feature FixedRandomDelay=
FixedRandomDelay=yes will use
`siphash24(sd_id128_get_machine() || MANAGER_IS_SYSTEM(m) || getuid() || u->id)`,
where || is concatenation, instead of a random number to choose a value between
0 and RandomizedDelaySec= as the timer delay.
This essentially sets up a fixed, but seemingly random, offset for each timer
iteration rather than having a random offset recalculated each time it fires.

Closes #10355

Co-author: Anita Zhang <the.anitazha@gmail.com>
2020-11-05 10:59:33 -08:00
Martin Wilck dec8e6cfb4 test/sys-script.py: add missing DEVNAME entries to uevents 2020-11-02 11:43:15 +01:00
Martin Wilck cbeb23d863 test/udev_test.pl: add "expected good" count
Since 'test/udev-test.pl: count "good" results', we know how many
checks succeeded. Add an "expected good" count to make that number
more meaningful.
2020-11-02 11:43:15 +01:00
Martin Wilck f1cb086054 test/udev-test.pl: suppress umount error message at startup
umount emits an error message "no mount point specified" if the
tmpfs isn't mounted yet, which is the normal case.
Suppress that by redirecting stderr.
2020-11-02 11:43:15 +01:00
Martin Wilck 0ed1b64469 test/sd-script.py: new helper script for udev testing
Script for generating LOTS of SCSI disk and partition devices in
the fake sysfs we use for udev testing.

This script is supposed to be run after sys-script.py. It uses
code from sys-script.py as template to generate additional SCSI disk data
structures. Together with the "generator" code in udev-test.pl
added in the previous patch, it allows to run udev tests with almost
arbitrarily many devices, and thus to do performance scaling tests.
2020-11-02 11:43:15 +01:00
Martin Wilck eb44d715eb test/udev-test.pl: generator for large list of block devices
Manually listing all devices in the test definition becomes cumbersome with
lots of devices. Add a function that scans on all block devices in
the test sysfs and generates a list of devices to test.
2020-11-02 11:43:15 +01:00
Martin Wilck 2ab0a8d00b test/udev-test.pl: add repeat count
for easier reproduction of sporadic test failures.
2020-11-02 11:43:15 +01:00
Martin Wilck 4a0ec82daf tests/udev-test.pl: add multiple device test
Add 4 new tests using multiple devices. Number 2-4 use many
devices claiming the same symlink, where only one device has
a higher priority thatn the others. They fail sporadically with
the current code, if a race condition causes the symlink to point
to the wrong device. Test 4 is like test 2 with sleeps in between,
it's much less likely to fail.
2020-11-02 11:43:15 +01:00
Martin Wilck b95c43982a test/udev-test.pl: count "good" results
This is helpful to catch possible regressions in the test.
Also, don't count wait() errors, they are likely not udev errors.
2020-11-02 11:43:15 +01:00
Martin Wilck a96cd21d31 test/udev-test.pl: merge import parent tests into one
As we can test multiple devices and multiple links per device
in one test now, these two tests can be merged into one.
2020-11-02 11:43:15 +01:00
Martin Wilck 2084fe0d32 test/udev-test.pl: merge "space and var with space" tests
As we can check multiple links in a single test now, these 3
tests can be merged into one.
2020-11-02 11:43:15 +01:00
Martin Wilck 86634df43b test/udev-test.pl: remove bogus rules from magic subsys test
These rules have survived from an ancient version of the code
and save no purpose any more.
2020-11-02 11:43:14 +01:00
Martin Wilck 06d4d4e24e test/udev-test.pl: Make some tests a little harder
Add some rules that make it a bit harder to pass, mainly the
non-existence checks.
2020-11-02 11:43:14 +01:00
Martin Wilck 17cce03153 test/udev-test.pl: last_rule is unsupported
the "last_rule" option hasn't been supported for some time.
Therefore this test fails if a "not_exp_links" attribute is added,
as it should be. Mark it appropriately.
2020-11-02 11:43:14 +01:00
Martin Wilck 46bc71b2b7 test/udev-test.pl: fix wrong test descriptions
udev hasn't supported renaming device nodes for some time.
2020-11-02 11:43:14 +01:00
Martin Wilck e62acc3159 test/udev-test.pl: allow checking multiple symlinks
Instead of testing the existence or non-exisitence of just a single
symlink, allow testing of several links per device.

Change the test definitions accordingly.
2020-11-02 11:43:14 +01:00
Martin Wilck 997683c8f1 test/udev-test.pl: test correctness of symlink targets
Test if symlinks are created correctly by comparing the symlink
targets to the devnode path. This implies (for the symlink) that
major/minor numbers and permissions are correct, as we have tested
that on the devnode already.
2020-11-02 11:43:14 +01:00
Martin Wilck f0dccf01a7 test/udev-test.pl: use computed devnode name
More often than not, the created devnode is the basename of the
sysfs entry. The "devnode" device may be used to override the
auto-detected node name.

Permissions and major/minor number are now verified on the devnode
itself, not on symlinks.

For those tests where exp_name is set to the computed devnode name,
the explicit "exp_name" can be removed. "exp_name" is only required for
symlinks.

This allows separate testing for devnodes and symlinks an a follow-up
patch.
2020-11-02 11:43:14 +01:00
Martin Wilck 09a4062d70 test/udev-test.pl: allow concurrent additions and removals
Allow testing cases where multiple devices are added and removed
simultaneously. Tests are started as synchronously as possible using a
semaphore, in order to test possible race conditions. If this isn't desired,
the test parameter "sleep_us" can be set to the number of microseconds to wait
between udev invocations.
2020-11-02 11:43:14 +01:00
Martin Wilck af7ee3eae6 test/udev-test.pl: create rules only once
It's not necessary to write the rules for every udev run, as we
now may have many (rather than just 2) per test.
2020-11-02 11:43:14 +01:00
Martin Wilck 255c05b724 test/udev-test.pl: allow multiple devices per test
Allow testing cases where multiple devices are added and removed.
This implies a change of the data structure: every test allows
for multiple devices to be added, and "exp_name" etc. are now properties
of the device, not of the test.
2020-11-02 11:43:14 +01:00
Zbigniew Jędrzejewski-Szmek c37a43d2dd
Merge pull request #17438 from anitazha/systoomd_quick
Additional fix ups from #17417
2020-10-27 18:43:34 +01:00
Yu Watanabe 80762cccdc test-network: add a test case for DNSSL in RA
Closes #4590.
2020-10-24 14:08:51 +02:00
Anita Zhang 311e3d4637 test: make TEST-56-OOMD service unit files static 2020-10-23 15:59:00 -07:00
Yu Watanabe 43d4bc9f56 test-network: add tests for routes managed by Manager 2020-10-23 23:07:12 +09:00
Zbigniew Jędrzejewski-Szmek 15a6c4bf8b
Merge pull request #17417 from anitazha/more_systoomd
More systemd-oomd tweaks
2020-10-23 13:06:51 +02:00
Yu Watanabe 9c914c0401
Merge pull request #17357 from yuwata/network-dhcp6-pd-announce-17353
network: add an option to control announcement of delegated prefix
2020-10-23 12:57:58 +09:00
Anita Zhang e4ff80404a test: add basic memory pressure extended test for oomd
Simple test to generate a lot of pressure in one unit and assert that
systemd-oomd kills the right one.
2020-10-22 17:04:22 -07:00
Zbigniew Jędrzejewski-Szmek 4cce6f2524 test-path: start infinite sleep instead of a short command
The test sometimes fails, e.g. in bionic-s390x ci. I think it might be because
the service binary exits before we get a chance to notice that it is running:
13:59:31 --- Listing only the last 100 lines from a long log. ---
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4639845)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4539608)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4439376)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4338946)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4238702)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4138424)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 4038116)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3937835)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3837553)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3737250)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3636934)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3536622)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3436318)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3336021)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3235730)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3135468)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 3035158)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2934855)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2834541)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2732511)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2632255)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2532014)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2431746)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2331438)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2231213)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2130952)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 2030663)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1930428)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1830172)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1729906)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1629652)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1529368)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1429110)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1328852)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1228593)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1128320)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 1028083)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 927824)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 827564)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 724935)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 624664)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 524411)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 424124)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 323853)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 223585)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 120356)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: 18053)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 line 293: path-unit.path: state = running; result = success (left: -82385)
13:59:31 line 293: path-mycustomunit.service: state = exited; result = success
13:59:31 Test timeout when testing path-unit.path

It seems test/test-path/path-service.service wasn't actually used for anything.
2020-10-22 11:05:17 +02:00
Zbigniew Jędrzejewski-Szmek 28c48f4d78 tests: replace the few remaining Type=simple with Type=exec
Except for the places where we explicitly want to test Type=simple,
we should use Type=exec.
2020-10-22 11:05:17 +02:00
Zbigniew Jędrzejewski-Szmek 333d102c64 test-path: use Type=exec
In general, Type=exec is superior to Type=simple. Let's not assume that
the service is started before it was really started.
2020-10-22 11:05:17 +02:00
Zbigniew Jędrzejewski-Szmek 515736d0f3 tree-wide: update web link to logind description
https://www.freedesktop.org/wiki/Software/systemd/multiseat/ says that it
is obsoleted by sd-login(3), so it doesn't make much sense to link to the former.
2020-10-19 15:23:37 +02:00
Yu Watanabe 610e747748 test-network: use new IPv6SendRA= setting 2020-10-19 14:55:21 +09:00
Yu Watanabe 99e1ab06b4 fuzz: move DNSDefaultRoute= setting to [Network] section 2020-10-19 14:55:21 +09:00
Yu Watanabe 27ff0490e6 network: rename IPv6PrefixDelegation= to IPv6SendRA= 2020-10-19 14:55:18 +09:00
Yu Watanabe 4afd986753 network: introduce Announce= in [DHCPv6PrefixDelegation]
When disabled, the delegated prefixes are not emit by RA.

Closes #17353.
2020-10-19 12:09:36 +09:00
Yu Watanabe e502f94dcf network: introduce DHCPv6PrefixDelegation= setting
Then, the link can configure prefix delegated by DHCPv6 without emitting
RA.
2020-10-19 10:09:38 +09:00
Luca Boccassi 9198752738 test: account for non-x86-64 archs in TEST-50-DISSECT 2020-10-18 15:41:34 +01:00
Luca Boccassi 7580a64766 test: increase size of verity partition in TEST-50-DISSECT GPT image
On Ubuntu it seems there's some padding added
2020-10-18 11:44:18 +01:00
Luca Boccassi 964523e6c2 test/README: notes about Ubuntu CI logs and dependencies
Add a note about where to find the full journal, and how to add
packages/dependencies for the Ubuntu CI.
2020-10-17 17:58:40 +01:00
Luca Boccassi d888cd4cfc test: fix TEST-50-DISSECT build on Ubuntu CI
Ubuntu CI's just got the dependencies require dto run this test added,
and it seems the build is different enough from other platforms
that it fails to create the required directories:

cp: cannot create regular file '/var/tmp/systemd-test.JJMOBY/minimal/usr/lib/os-release': No such file or directory
2020-10-17 17:58:40 +01:00
Luca Boccassi 1bac565641 Revert "Block TEST-50-DISSECT on Ubuntu CI temporarily"
This reverts commit 329315b29f.
2020-10-17 17:58:40 +01:00
Luca Boccassi 329315b29f Block TEST-50-DISSECT on Ubuntu CI temporarily
It looks like we need to do some whack-a-mole before it will fully pass,
so disable for now. It was skipped until today anyway due to missing
dependencies.
2020-10-17 09:05:31 +02:00
Yu Watanabe 9087e3d609 test-network: do not use deprecated value 2020-10-15 07:08:27 +09:00
Yu Watanabe c27abcf4fb network: when Gateway=_dhcp4, set several properties based on lease if they are not explicitly specified
Before this commit, event when Gateway=_dhcp4 or _ra is set, the
route was configured with 'protocol static', and other properties
specified by RouteTable=, RouteMTU=, or etc, were ignored.

This commit makes set the route protocol based on the protocol the
gateway address is obtained, and apply other settings if it is not
explicitly specified in the [Route] section.
2020-10-15 07:06:23 +09:00
Lennart Poettering fc8bc57f6b
Merge pull request #16968 from yuwata/remove-old-device-on-move-event
core, udev: remove old device on move event
2020-10-14 17:49:37 +02:00