1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-09 12:58:26 +03:00

3502 Commits

Author SHA1 Message Date
David Tardon
e7f5525fb0 test: also test client-side operation if applicable 2023-04-12 17:14:06 +02:00
Yu Watanabe
19279652c0
Merge pull request #27013 from fbuihuu/test-fixlets
Test fixlets
2023-03-28 13:45:24 +09:00
Yu Watanabe
1d4f517bba
Merge pull request #26993 from mrc0mmand/TEST-46-tweaks
test: explicitly pull in systemd-userdbd.service
2023-03-28 13:39:08 +09:00
Franck Bui
04ef5d1bd7 test: don't export $TOOLS_DIR
It's not (and shouldn't be) used by any test scripts.
2023-03-27 17:20:18 +02:00
Franck Bui
256a835f1c test: clean up $STATEDIR too 2023-03-27 17:20:18 +02:00
Franck Bui
0c566150c8 test: $STATEDIR should not point to /usr/lib/systemd/tests when NO_BUILD=1
When testing the binaries from the host, make sure to not store the state data
below /usr but use a dedicated directory in /var/tmp/ instead.

The working directories of the tests, initially located in /var/tmp, are also
moved in a dedicated directory /var/tmp/systemd-tests.
2023-03-27 17:20:15 +02:00
Frantisek Sumsal
98fa6c7210 test: explicitly pull in systemd-userdbd.socket
Since we don't run preset-all on the test image, the
systemd-userdbd.socket remains disabled. Let's pull it in explicitly
to give systemd-userdbd some coverage as well.
2023-03-27 13:29:12 +02:00
Dmitry V. Levin
ebb00082d8 udev-rules: fix grammar in diagnostics about lines that have no effect
Fixes: 25de7aa7b90c ("udev: modernize udev-rules.c")
2023-03-27 10:00:30 +00:00
Dmitry V. Levin
860e2a1115 udev-rules: extend the check for conflicting expressions
Log an error when a rule line contains the following kind of conflicting
match expressions:

  KEY=="foo*", KEY=="bar*"
2023-03-27 10:00:30 +00:00
Dmitry V. Levin
acc1954a03 udev-rules: check token delimiters
When udev_rules_parse_file() is called by udevadm verify, issue warnings
about the following conditions in udev rules:
* the first token in the rule is preceded with a comma
* the last token in the rule is followed by a comma
* there is no comma between tokens
* there is no whitespace between tokens
* there is more than a single comma between tokens
* there is whitespace between a token and a comma
* there is no whitespace after comma
2023-03-27 10:00:30 +00:00
Dmitry V. Levin
d656c49604 testsuite-17.11.sh: add commas between tokens 2023-03-27 10:00:30 +00:00
Luca Boccassi
8e1a129136
Merge pull request #26870 from fbuihuu/move-unit-tests-in-a-dedicated-subdir
Move unit tests in a dedicated subdir
2023-03-27 09:38:15 +01:00
Zbigniew Jędrzejewski-Szmek
957b934f82
Merge pull request #26294 from yuwata/locale-verify-conf
locale: verify loaded keymap or friends
2023-03-27 10:26:24 +02:00
Franck Bui
f8d527aa9a test: install symlinks with valid targets on SUSE and Debian 2023-03-26 10:44:09 +02:00
Yu Watanabe
cccc14c5a8
Merge pull request #26973 from mrc0mmand/userdbctl-tests
test: add a couple of tests for userdbctl
2023-03-26 09:49:27 +09:00
Yu Watanabe
6fc0d6b5ac
Merge pull request #26983 from mrc0mmand/coredump-test-followup
test: don't expand the subshell expression prematurely
2023-03-26 09:47:49 +09:00
Frantisek Sumsal
237d81fdb3 test: filter the merged coverage report instead
So we don't have to do this twice - once for the base report and then
for each "real" one.

Follow-up to 7fdd6e157a.
2023-03-25 17:55:41 +01:00
Frantisek Sumsal
93fe228bb1 test: add a couple of tests for userdbctl 2023-03-25 14:13:00 +01:00
Frantisek Sumsal
7fdd6e157a test: do an initial coverage capture
I noticed that our coverage reports miss some files completely - this
happens when the test doesn't touch the code in them at all, so the
generated coverage data (and resulting reports) have no information
about them. Let's fix this by doing an initial zero coverage capture
that contains a zeroed counter for every instrumented line in every
file, so when we later merge it with a capture from the test, it shows up
with a missing coverage instead of not showing at all.
2023-03-25 12:29:40 +00:00
Frantisek Sumsal
91c031f169 test: drop unnecessary return
Return code of the EXIT trap handler is ignored in bash.
2023-03-25 12:17:11 +01:00
Frantisek Sumsal
370fa624f5 test: don't touch the /failed marker in the subtest scripts
As it is already handled by the "main" script (testsuite-74.sh).
2023-03-25 12:15:33 +01:00
Frantisek Sumsal
0b189ac84c test: don't expand the subshell expression prematurely
We need to expand the subshell expression during the `bash -c`
invocation, not before, to take the desired effect, as now it expands to:

timeout 30 bash -c 'while [[ 0 -eq 0 ]]; do sleep 1; done'

instead of the expected:

timeout 30 bash -c 'while [[ $(coredumpctl list -q --no-legend 770 | wc -l) -eq 0 ]]; do sleep 1; done'

Follow-up to aadbd81f7f.
2023-03-25 12:10:58 +01:00
Yu Watanabe
fcf8b80d1d test: add test for invalid keymap setting 2023-03-25 15:36:53 +09:00
Franck Bui
fa2745a3e1 test: on openSUSE install the collection of unit test binaries in the target only for TEST-02-UNITTESTS 2023-03-24 14:10:04 +01:00
Franck Bui
c18cc7f7fb meson: make sure the unit test scripts find testdata/ even if they are not installed in the same directory
testdata/ is shared by both the unit tests and the integration tests. Hence it
makes sense to place them right under /usr/lib/systemd/tests/ while the tests
themself are located under dedicated sub-directories:

     /usr/lib/systemd/tests/
     ├── integration-tests
     ├── testdata
     └── unit-tests
         ├── testdata -> ../testdata

However the unit tests implemented as shell scripts (such as
test-fstab-generator.sh) expect to find testdata/ where the scripts are
installed, ie they do something like:

  src="$(dirname "$0")/testdata/test-fstab-generator"

This patch installs a symlink in 'unitestsdir' named "testdata" and that points
to whatever value 'testdata_dir' is set.
2023-03-24 14:10:04 +01:00
Franck Bui
539ee7ab11 meson: define testdata_dir globally 2023-03-24 14:10:02 +01:00
Franck Bui
26c2b30277 test: install unit tests in a dedicated subdirectory below '$testsdir'
/usr/lib/systemd/tests may contain more than the unit tests. For example on
SUSE we also install the integration tests there.

Putting the unit tests in a dedicated directory named 'unit-tests' makes the
layout cleaner.

Note that `run-unit-tests.py` has not been moved so we don't need to adjust
(Fedora) packaging and users also don't need to descend into the subdirectory.
2023-03-24 14:08:57 +01:00
Frantisek Sumsal
aadbd81f7f test: add a couple of tests for systemd-coredump 2023-03-24 11:56:33 +01:00
Zbigniew Jędrzejewski-Szmek
2f809d29e8 test-coredump-util: add tests for parse_aux()
The test files are /proc//auxv files copies from various architecutres
signified by the file name suffix.

Those tests are fairly simple, but when we run them on n architectures, we do
~n² cross-arch tests.
2023-03-23 18:06:46 +01:00
Mike Yuan
f1710073c7
Merge pull request #26214 from YHNdnzj/sd-notify-change-notifyaccess
core: support overriding NOTIFYACCESS= through sd-notify during runtime
2023-03-24 00:11:29 +08:00
Mike Yuan
b64f5ddaca
test: add tests for NOTIFYACCESS override through sd_notify 2023-03-22 19:22:10 +08:00
Thomas Blume
c5ba7a2a4d udev-rules: fix nvme symlink creation on namespace changes
The nvme by-id symlink changes to the latest namespace when a new namespace gets
added, for example by connecting multiple NVMe/TCP host controllers via nvme
connect-all.
That is incorrect for persistent device links.
The persistent symbolic device link should continue to point to the same NVMe
namespace throughout the lifetime of the current boot.
Therefore the namespace id needs to be added to the link name.
2023-03-21 15:46:45 +01:00
Dmitry V. Levin
f0a16c9ae8 udev-rules: add another check for conflicting expressions
Log an error when a rule line contains the following kind of conflicting
match expressions:

  KEY=="foo", KEY=="bar"
2023-03-21 09:34:50 +09:00
Dmitry V. Levin
5004aa84ac udev-rules: fix check for conflicting and duplicate expressions
Fix check for conflicting and duplicate expressions of types that
support alternative patterns.

Fixes: 3ec58d0cd8f6 ("udev-rules: check for conflicting and duplicate expressions")
2023-03-19 11:32:09 +00:00
Yu Watanabe
458e8d6dd0 test-systemd-tmpfiles.py: create global temporary directory
For some unknown reasons, the temporary directory created by the test
below is not removed:
```
 # Test the case that a valid symlink is in the path.
 label = 'valid_symlink-deep'
 test_content('f= {} - - - - ' + label, label, user=user, subpath='/deep/1/2', path_cb=valid_symlink)
```
To keep /tmp clean, let's create the global temprary directory.
2023-03-18 22:27:41 +09:00
Yu Watanabe
015ddd4bf0 test-systemd-tmpfiles.py: use test_content() at one more place 2023-03-18 22:27:41 +09:00
Daan De Meyer
6742397921
Merge pull request #26783 from yuwata/loop-ref-follow-up
udev: slightly extend comment and add more tests
2023-03-17 10:00:43 +01:00
Yu Watanabe
77c6bb895a
Merge pull request #26803 from yuwata/udevadm-verify-summary
udevadm-verify: print a short summary
2023-03-17 12:14:04 +09:00
Frantisek Sumsal
e912bef85d test: wrap mkfs.*/mksquashfs/mkswap binaries when running w/ ASan 2023-03-16 12:56:40 +00:00
Yu Watanabe
7b4cae904b test: add tests for summary output of udevadm verify 2023-03-16 14:54:46 +09:00
Yu Watanabe
f99deb1e94 test: reindent testsuite-17.11.sh 2023-03-16 14:54:46 +09:00
Yu Watanabe
cb6ff2a42c
Merge pull request #26771 from YHNdnzj/machinectl-edit
machinectl: add verb edit and cat to operate on .nspawn files
2023-03-16 04:02:11 +09:00
Dmitry V. Levin
f5b28e6bd8 test: fix testsuite-17.10.sh
Make sure /etc/udev/hwdb.d/ exists before creating a file inside it.

Fixes: 95cf8cae77f7 ("test: add coverage test for udevadm")
2023-03-16 03:59:01 +09:00
Dmitry V. Levin
3ec58d0cd8 udev-rules: check for conflicting and duplicate expressions
Log an error when a rule line contains conflicting match expressions, e.g.
  NAME=="value", NAME!="value"

Log a warning when a rule line contains duplicate expressions, e.g.
  NAME=="value", NAME=="value"
2023-03-16 03:49:57 +09:00
Mike Yuan
af0292844d
test: add testsuite-74.machinectl 2023-03-15 19:56:19 +08:00
Luca Boccassi
1be50af42e
Merge pull request #26804 from fbuihuu/fixes-for-test-58-repart
Fixes for test 58 repart
2023-03-15 10:56:07 +00:00
Luca Boccassi
d4b6ec980d core: make the memory pressure cgroup path writable when ProtectControlGroups=yes
The interface requires services to write to the cgroup file to activate notifications,
but with ProtectControlGroups=yes we make it read-only. Add a writable bind mount.

Follow-up for 6bb0084204bd93122c9f04391b80aea5a8a0ff08
2023-03-15 09:23:17 +01:00
Franck Bui
693c3e1a59 test: assume run-unit-tests.py and unit tests are installed in the same directory
This avoids hard coding the path of the directory where the unit tests are
installed.
2023-03-15 09:19:33 +01:00
Daan De Meyer
3a36d19938
Merge pull request #26662 from yuwata/test-execute-network-namespace-path
test-execute: add tests for NetworkNamespacePath=
2023-03-14 11:16:15 +01:00
Yu Watanabe
91ea97356c test-50-dissect: add test for long reference name 2023-03-14 18:53:55 +09:00