1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00
systemd/test/TEST-16-EXTEND-TIMEOUT/assess.sh
Daniel Black a327431bd1 core: add EXTEND_TIMEOUT_USEC={usec} - prevent timeouts in startup/runtime/shutdown (#7214)
With Type=notify services, EXTEND_TIMEOUT_USEC= messages will delay any startup/
runtime/shutdown timeouts.

A service that hasn't timed out, i.e, start time < TimeStartSec,
runtime < RuntimeMaxSec and stop time < TimeoutStopSec, may by sending
EXTEND_TIMEOUT_USEC=, allow the service to continue beyond the limit for
the execution phase (i.e TimeStartSec, RunTimeMaxSec and TimeoutStopSec).

EXTEND_TIMEOUT_USEC= must continue to be sent (in the same way as
WATCHDOG=1) within the time interval specified to continue to reprevent
the timeout from occuring.

Watchdog timeouts are also extended if a EXTEND_TIMEOUT_USEC is greater
than the remaining time on the watchdog counter.

Fixes #5868.
2017-12-14 12:17:43 +01:00

56 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -v -x
rm -f /test.log
TL=/test.log.XXXXXXXX
function wait_for()
{
service=${1}
result=${2:-success}
time=${3:-45}
while [[ ! -f /${service}.terminated && ! -f /${service}.success && $time -gt 0 ]]
do
sleep 1
time=$(( $time - 1 ))
done
if [[ ! -f /${service}.${result} ]]
then
journalctl -u testsuite-${service/_/-}.service >> "${TL}"
fi
}
# This checks all stages, start, runtime and stop, can be extended by
# EXTEND_TIMEOUT_USEC
wait_for success_all
# These check that EXTEND_TIMEOUT_USEC that occurs at greater than the
# extend timeout interval but less then the stage limit (TimeoutStartSec,
# RuntimeMaxSec, TimeoutStopSec) still succeed.
wait_for success_start
wait_for success_runtime
wait_for success_stop
# These ensure that EXTEND_TIMEOUT_USEC will still timeout in the
# approprate stage, after the stage limit, when the EXTEND_TIMEOUT_USEC
# message isn't sent within the extend timeout interval.
wait_for fail_start startfail
wait_for fail_stop stopfail
wait_for fail_runtime runtimefail
if [[ -f "${TL}" ]]
then
# no mv
cp "${TL}" /test.log
exit 1
else
touch /testok
exit 0
fi