From fc53809803cd2bc2434e312b19a18fa36776da12 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:40 +0200 Subject: Adding upstream version 256. Signed-off-by: Daniel Baumann --- test/units/TEST-59-RELOADING-RESTART.sh | 168 ++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100755 test/units/TEST-59-RELOADING-RESTART.sh (limited to 'test/units/TEST-59-RELOADING-RESTART.sh') diff --git a/test/units/TEST-59-RELOADING-RESTART.sh b/test/units/TEST-59-RELOADING-RESTART.sh new file mode 100755 index 0000000..0e04403 --- /dev/null +++ b/test/units/TEST-59-RELOADING-RESTART.sh @@ -0,0 +1,168 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -eux +set -o pipefail + +fail() { + systemd-analyze log-level info + exit 1 +} + +# Wait for a service to enter a state within a timeout period, if it doesn't +# enter the desired state within the timeout period then this function will +# exit the test case with a non zero exit code. +wait_on_state_or_fail() { + service=$1 + expected_state=$2 + timeout=$3 + + state=$(systemctl show "$service" --property=ActiveState --value) + while [ "$state" != "$expected_state" ]; do + if [ "$timeout" = "0" ]; then + fail + fi + timeout=$((timeout - 1)) + sleep 1 + state=$(systemctl show "$service" --property=ActiveState --value) + done +} + +systemd-analyze log-level debug + + +cat >/run/systemd/system/testservice-fail-59.service </run/systemd/system/testservice-fail-restart-59.service </run/systemd/system/testservice-abort-restart-59.service </run/systemd/system.conf.d/50-test-59-reload.conf </run/notify-reload-test.sh <