summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2023-05-15 14:41:29 +0800
committerMike Yuan <me@yhndnzj.com>2023-05-15 15:04:38 +0800
commitb5b1351317db64de1f2c944ec153208ba8174079 (patch)
tree58829cff86441ad5ce0978ed591f1fd5e85b7795 /test
parent38f901791f3c4b1cbd04b71323bbef2fdab65f83 (diff)
downloadsystemd-b5b1351317db64de1f2c944ec153208ba8174079.tar.gz
test: add tests for UpheldBy= in [Install] section
Diffstat (limited to 'test')
-rw-r--r--test/fuzz/fuzz-unit-file/directives-all.service2
-rw-r--r--test/testsuite-23.units/testsuite-23-upheldby-install.service9
-rwxr-xr-xtest/units/testsuite-23.Upholds.sh5
3 files changed, 15 insertions, 1 deletions
diff --git a/test/fuzz/fuzz-unit-file/directives-all.service b/test/fuzz/fuzz-unit-file/directives-all.service
index 8450d024e6..818fb28dbf 100644
--- a/test/fuzz/fuzz-unit-file/directives-all.service
+++ b/test/fuzz/fuzz-unit-file/directives-all.service
@@ -269,6 +269,8 @@ Type=
USBFunctionDescriptors=
USBFunctionStrings=
Unit=
+UpheldBy=
+Upholds=
User=
WakeSystem=
WantedBy=
diff --git a/test/testsuite-23.units/testsuite-23-upheldby-install.service b/test/testsuite-23.units/testsuite-23-upheldby-install.service
new file mode 100644
index 0000000000..a4562077db
--- /dev/null
+++ b/test/testsuite-23.units/testsuite-23-upheldby-install.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Unit]
+Description=Unit that sets UpheldBy= through [Install]
+
+[Service]
+ExecStart=/bin/sleep infinity
+
+[Install]
+UpheldBy=testsuite-23-retry-uphold.service
diff --git a/test/units/testsuite-23.Upholds.sh b/test/units/testsuite-23.Upholds.sh
index 21db258e1d..bce4d7205b 100755
--- a/test/units/testsuite-23.Upholds.sh
+++ b/test/units/testsuite-23.Upholds.sh
@@ -30,6 +30,8 @@ done
systemctl stop testsuite-23-uphold.service
+systemctl enable testsuite-23-upheldby-install.service
+
# Idea is this:
# 1. we start testsuite-23-retry-uphold.service
# 2. which through Uphold= starts testsuite-23-retry-upheld.service
@@ -42,12 +44,13 @@ systemctl stop testsuite-23-uphold.service
rm -f /tmp/testsuite-23-retry-fail
systemctl start testsuite-23-retry-uphold.service
+systemctl is-active testsuite-23-upheldby-install.service
while ! systemctl is-failed testsuite-23-retry-fail.service ; do
sleep .5
done
-systemctl is-active testsuite-23-retry-upheld.service && { echo 'unexpected success'; exit 1; }
+(! systemctl is-active testsuite-23-retry-upheld.service)
touch /tmp/testsuite-23-retry-fail