summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-10-26 07:43:48 +0200
committerGitHub <noreply@github.com>2022-10-26 07:43:48 +0200
commitbdc84a6fc9a166ac74cda8ebdb158a4ba51f3715 (patch)
treea97ce7ca0386c6921d0a99b836054bf277d2e1ac /test
parenthwdb: drop model specifier from general entries (diff)
parentgh actions: run a unit test iteration without machine-id (diff)
downloadsystemd-bdc84a6fc9a166ac74cda8ebdb158a4ba51f3715.tar.xz
systemd-bdc84a6fc9a166ac74cda8ebdb158a4ba51f3715.zip
Merge pull request #25120 from bluca/test_machineid
unit tests: do not fail when machine-id is missing
Diffstat (limited to 'test')
-rw-r--r--test/test-execute/exec-specifier.service1
-rw-r--r--test/test-execute/exec-specifier@.service1
-rwxr-xr-xtest/test-systemd-tmpfiles.py2
-rwxr-xr-xtest/udev-test.pl4
4 files changed, 3 insertions, 5 deletions
diff --git a/test/test-execute/exec-specifier.service b/test/test-execute/exec-specifier.service
index 321d0e338a..2b487bae8c 100644
--- a/test/test-execute/exec-specifier.service
+++ b/test/test-execute/exec-specifier.service
@@ -27,7 +27,6 @@ ExecStart=sh -c 'test %g = $$(id -gn)'
ExecStart=sh -c 'test %G = $$(id -g)'
ExecStart=test %h = /root
ExecStart=sh -c 'test -x %s'
-ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)'
ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')'
ExecStart=sh -c 'test %H = $$(uname -n)'
ExecStart=sh -c 'test %v = $$(uname -r)'
diff --git a/test/test-execute/exec-specifier@.service b/test/test-execute/exec-specifier@.service
index 46c8503f1d..69e969f716 100644
--- a/test/test-execute/exec-specifier@.service
+++ b/test/test-execute/exec-specifier@.service
@@ -24,7 +24,6 @@ ExecStart=sh -c 'test %g = $$(id -gn)'
ExecStart=sh -c 'test %G = $$(id -g)'
ExecStart=test %h = /root
ExecStart=sh -c 'test -x %s'
-ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)'
ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')'
ExecStart=sh -c 'test %H = $$(uname -n)'
ExecStart=sh -c 'test %v = $$(uname -r)'
diff --git a/test/test-systemd-tmpfiles.py b/test/test-systemd-tmpfiles.py
index 4b3bdf3364..af9ff9bf93 100755
--- a/test/test-systemd-tmpfiles.py
+++ b/test/test-systemd-tmpfiles.py
@@ -87,7 +87,7 @@ def test_content(line, expected, *, user, extra={}, subpath='/arg', path_cb=None
def test_valid_specifiers(*, user):
test_content('f {} - - - - two words', 'two words', user=user)
- if id128:
+ if id128 and os.path.isfile('/etc/machine-id'):
try:
test_content('f {} - - - - %m', '{}'.format(id128.get_machine().hex), user=user)
except AssertionError as e:
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 985968d120..3099b5746f 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -1980,8 +1980,8 @@ EOF
not_exp_links => ["notthere"],
}],
rules => <<EOF
-TEST=="/etc/machine-id", SYMLINK+="there"
-TEST!="/etc/machine-id", SYMLINK+="notthere"
+TEST=="/etc/passwd", SYMLINK+="there"
+TEST!="/etc/passwd", SYMLINK+="notthere"
EOF
},
{