From 7c194bb93ce3740b6c1db2d76112bc61fc2474c3 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Mon, 30 Dec 2024 23:35:32 +0100 Subject: [PATCH] TEST-07-PID1: add test case for #35635 --- test/units/TEST-07-PID1.socket-on-failure.sh | 73 ++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 test/units/TEST-07-PID1.socket-on-failure.sh diff --git a/test/units/TEST-07-PID1.socket-on-failure.sh b/test/units/TEST-07-PID1.socket-on-failure.sh new file mode 100755 index 00000000000..affcec44ff2 --- /dev/null +++ b/test/units/TEST-07-PID1.socket-on-failure.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +# shellcheck disable=SC2016 +set -eux +set -o pipefail + +# shellcheck source=test/units/util.sh +. "$(dirname "$0")"/util.sh + +UNIT_NAME="TEST-07-PID1-socket-$RANDOM" + +at_exit() { + systemctl stop "$UNIT_NAME.socket" + rm -f /run/systemd/system/"$UNIT_NAME".{socket,service} \ + /run/systemd/system/TEST-07-PID1-socket-OnFailure.service +} + +trap at_exit EXIT + +# Test triggering OnFailure= when fails to listen on socket (#35635) + +mkdir -p "/tmp/$UNIT_NAME" + +cat >/run/systemd/system/"$UNIT_NAME.socket" </run/systemd/system/"$UNIT_NAME.service" </run/systemd/system/TEST-07-PID1-socket-OnFailure.service <