test: rename TEST-53-ISSUE-16347 to TEST-53-TIMER

And split the existing test into a separate subtest.
This commit is contained in:
Frantisek Sumsal
2025-09-23 14:28:33 +02:00
parent 64376936c7
commit 953c347fb6
4 changed files with 16 additions and 9 deletions

View 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',

View File

@@ -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

11
test/units/TEST-53-TIMER.sh Executable file
View File

@@ -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