test/TEST-16: simplify how variables are set

The amount of lines doesn't change much, but I think it's much more
straightforward this way.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-12-12 21:06:58 +01:00
parent 2b5981b40a
commit e5b0aaaf56
8 changed files with 19 additions and 20 deletions

View File

@ -4,23 +4,15 @@ set -e
set -o pipefail
# sleep interval (seconds)
sleep_interval=1
: ${sleep_interval:=1}
# extend_timeout_interval second(s)
extend_timeout_interval=1
: ${extend_timeout_interval:=1}
# number of sleep_intervals before READY=1
start_intervals=10
: ${start_intervals:=10}
# number of sleep_intervals before exiting
stop_intervals=10
: ${stop_intervals:=10}
# run intervals, number of sleep_intervals to run
run_intervals=7
# service name
SERVICE=unknown
while [ $# -gt 0 ];
do
eval ${1%=*}=${1#*=}
shift
done
: ${run_intervals:=7}
# We convert to usec
extend_timeout_interval=$(( $extend_timeout_interval * 1000000 ))

View File

@ -8,4 +8,5 @@ Type=notify
TimeoutStartSec=4
TimeoutStopSec=4
RuntimeMaxSec=10
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=fail_runtime extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=2 stop_intervals=0
Environment=SERVICE=fail_runtime extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=2 stop_intervals=0
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh

View File

@ -9,4 +9,5 @@ Type=notify
TimeoutStartSec=10
TimeoutStopSec=4
RuntimeMaxSec=4
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=fail_start extend_timeout_interval=5 sleep_interval=7 start_intervals=2 run_intervals=0 stop_intervals=0
Environment=SERVICE=fail_start extend_timeout_interval=5 sleep_interval=7 start_intervals=2 run_intervals=0 stop_intervals=0
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh

View File

@ -8,7 +8,8 @@ Type=notify
TimeoutStartSec=4
TimeoutStopSec=10
RuntimeMaxSec=4
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=fail_stop extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=0 stop_intervals=2
Environment=SERVICE=fail_stop extend_timeout_interval=5 sleep_interval=7 start_intervals=0 run_intervals=0 stop_intervals=2
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh
# Due to 6041a7ee2c1bbff6301082f192fc1b0882400d42 SIGTERM isn't sent as the service shuts down with STOPPING=1
# This file makes the test assess.sh quicker by notifing it that this test has finished.
ExecStopPost=/bin/bash -c '[[ $SERVICE_RESULT == timeout && $EXIT_CODE == killed ]] && touch /fail_runtime.terminated'

View File

@ -10,4 +10,5 @@ Type=notify
TimeoutStartSec=4
TimeoutStopSec=4
RuntimeMaxSec=4
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=success_all extend_timeout_interval=4 sleep_interval=2 start_intervals=3 run_intervals=3 stop_intervals=3
Environment=SERVICE=success_all extend_timeout_interval=4 sleep_interval=2 start_intervals=3 run_intervals=3 stop_intervals=3
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh

View File

@ -9,4 +9,5 @@ Type=notify
TimeoutStartSec=4
TimeoutStopSec=4
RuntimeMaxSec=8
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=success_runtime extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=1 stop_intervals=0
Environment=SERVICE=success_runtime extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=1 stop_intervals=0
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh

View File

@ -8,4 +8,5 @@ Type=notify
TimeoutStartSec=8
TimeoutStopSec=4
RuntimeMaxSec=4
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=success_start extend_timeout_interval=4 sleep_interval=6 start_intervals=1 run_intervals=0 stop_intervals=0
Environment=SERVICE=success_start extend_timeout_interval=4 sleep_interval=6 start_intervals=1 run_intervals=0 stop_intervals=0
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh

View File

@ -8,4 +8,5 @@ Type=notify
TimeoutStartSec=4
TimeoutStopSec=8
RuntimeMaxSec=4
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh SERVICE=success_stop extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=0 stop_intervals=1
Environment=SERVICE=success_stop extend_timeout_interval=4 sleep_interval=6 start_intervals=0 run_intervals=0 stop_intervals=1
ExecStart=/usr/lib/systemd/tests/testdata/testsuite-16.units/extend-timeout.sh