summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh14
-rwxr-xr-xtest/units/TEST-23-UNIT-FILE.ExtraFileDescriptors.sh13
2 files changed, 25 insertions, 2 deletions
diff --git a/test/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh b/test/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh
new file mode 100755
index 0000000000..8b182955b5
--- /dev/null
+++ b/test/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+set -o pipefail
+
+# shellcheck source=test/units/util.sh
+. "$(dirname "$0")"/util.sh
+
+assert_eq "$LISTEN_FDS" "$1"
+assert_eq "$LISTEN_FDNAMES" "$2"
+
+for ((i = 3; i < 3 + LISTEN_FDS; i++)); do
+ assert_eq "$(cat /proc/self/fd/"$i")" "${!i}" # Dereference $i to get i'th arg
+done
diff --git a/test/units/TEST-23-UNIT-FILE.ExtraFileDescriptors.sh b/test/units/TEST-23-UNIT-FILE.ExtraFileDescriptors.sh
index cf5c240908..eaeee635db 100755
--- a/test/units/TEST-23-UNIT-FILE.ExtraFileDescriptors.sh
+++ b/test/units/TEST-23-UNIT-FILE.ExtraFileDescriptors.sh
@@ -31,8 +31,8 @@ busctl call \
org.freedesktop.systemd1.Manager StartTransientUnit \
"ssa(sv)a(sa(sv))" "$TEST_UNIT" replace 4 \
ExecStart "a(sasb)" 1 \
- /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-openfile-child.sh \
- 5 /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-openfile-child.sh 2 "test:other" "Hello" "Extra" \
+ /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh \
+ 5 /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh 2 "test:other" "Hello" "Extra" \
true \
RemainAfterExit "b" true \
Type "s" oneshot \
@@ -51,6 +51,15 @@ timeout 10s bash -xec 'while [[ "$(systemctl show -P SubState test-23-extra-fd.s
assert_eq "$(systemctl show -P Result "$TEST_UNIT")" "success"
assert_eq "$(systemctl show -P ExecMainStatus "$TEST_UNIT")" "0"
+# Verify extra file descriptors stay accessible even after service manager re-executes
+systemctl daemon-reexec
+
+systemctl restart "$TEST_UNIT"
+
+assert_eq "$(systemctl show -P SubState "$TEST_UNIT")" "exited"
+assert_eq "$(systemctl show -P Result "$TEST_UNIT")" "success"
+assert_eq "$(systemctl show -P ExecMainStatus "$TEST_UNIT")" "0"
+
systemctl stop "$TEST_UNIT"
systemctl log-level info