]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: rename TEST-53-ISSUE-16347 to TEST-53-TIMER
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 23 Sep 2025 12:28:33 +0000 (14:28 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 13 Oct 2025 14:59:40 +0000 (16:59 +0200)
And split the existing test into a separate subtest.

(cherry picked from commit 953c347fb6f293acbd6da009646bfc071b68ddd7)

test/integration-tests/TEST-53-TIMER/meson.build [moved from test/integration-tests/TEST-53-ISSUE-16347/meson.build with 100% similarity]
test/integration-tests/meson.build
test/units/TEST-53-TIMER.issue-16347.sh [moved from test/units/TEST-53-ISSUE-16347.sh with 82% similarity]
test/units/TEST-53-TIMER.sh [new file with mode: 0755]

index f28be9e24ea71cd82decb8ff0aeb350dfa1cd6ed..5965f6646cbae49f80f5be36dadacd61e9039935 100644 (file)
@@ -70,7 +70,7 @@ foreach dirname : [
         'TEST-46-HOMED',
         'TEST-50-DISSECT',
         'TEST-52-HONORFIRSTSHUTDOWN',
-        'TEST-53-ISSUE-16347',
+        'TEST-53-TIMER',
         'TEST-54-CREDS',
         'TEST-55-OOMD',
         'TEST-58-REPART',
similarity index 82%
rename from test/units/TEST-53-ISSUE-16347.sh
rename to test/units/TEST-53-TIMER.issue-16347.sh
index 84cd66129d007e40c166bf8b772e26161a5a7b14..8b266145cd0df6031e96f80b57fa32fb4c40727e 100755 (executable)
@@ -3,10 +3,9 @@
 set -eux
 set -o pipefail
 
-: >/failed
-
 # Reset host date to current time, 3 days in the past.
 date -s "-3 days"
+trap 'date -s "+3 days"' EXIT
 
 # Run a timer for every 15 minutes.
 systemd-run --unit test-timer --on-calendar "*:0/15:0" true
@@ -17,15 +16,12 @@ now=$(date +%s)
 time_delta=$((next_elapsed - now))
 
 # Check that the timer will elapse in less than 20 minutes.
-((0 < time_delta && time_delta < 1200)) || {
+if [[ "$time_delta" -lt 0 || "$time_delta" -gt 1200 ]]; then
     echo 'Timer elapse outside of the expected 20 minute window.'
     echo "  next_elapsed=${next_elapsed}"
     echo "  now=${now}"
     echo "  time_delta=${time_delta}"
-    echo ''
-} >>/failed
+    echo
 
-if test ! -s /failed ; then
-    rm -f /failed
-    touch /testok
+    exit 1
 fi
diff --git a/test/units/TEST-53-TIMER.sh b/test/units/TEST-53-TIMER.sh
new file mode 100755 (executable)
index 0000000..9c2a033
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+set -o pipefail
+
+# shellcheck source=test/units/test-control.sh
+. "$(dirname "$0")"/test-control.sh
+
+run_subtests
+
+touch /testok