]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-07-PID1: add test case for #38320 38323/head
authorMike Yuan <me@yhndnzj.com>
Thu, 24 Jul 2025 14:29:41 +0000 (16:29 +0200)
committerMike Yuan <me@yhndnzj.com>
Thu, 24 Jul 2025 14:35:45 +0000 (16:35 +0200)
test/units/TEST-07-PID1.issue-38320.sh [new file with mode: 0755]

diff --git a/test/units/TEST-07-PID1.issue-38320.sh b/test/units/TEST-07-PID1.issue-38320.sh
new file mode 100755 (executable)
index 0000000..96f1ff6
--- /dev/null
@@ -0,0 +1,36 @@
+#!/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
+
+UNIT_NAME="TEST-07-PID1-issue-38320-$RANDOM"
+
+at_exit() {
+    systemctl stop "$UNIT_NAME".{socket,service}
+    rm -f /run/systemd/system/"$UNIT_NAME".{socket,service}
+}
+
+trap at_exit EXIT
+
+cat >/run/systemd/system/"$UNIT_NAME.socket" <<EOF
+[Socket]
+ListenStream=/tmp/$UNIT_NAME
+EOF
+
+cat >/run/systemd/system/"$UNIT_NAME.service" <<EOF
+[Service]
+ExecStart=true
+EOF
+
+(! systemd-analyze fdstore "$UNIT_NAME.socket")
+
+systemctl restart "$UNIT_NAME.socket"
+(! systemd-analyze fdstore "$UNIT_NAME.socket")
+
+systemctl daemon-reload
+(! systemd-analyze fdstore "$UNIT_NAME.socket")
+
+systemctl is-active "$UNIT_NAME.socket"