blob: 9f3a843da612be21326379a36a74114352ac9b8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/usr/bin/env bash
set -eux
set -o pipefail
rm -f /test.log
TESTLOG=/test.log.XXXXXXXX
function wait_for()
{
local service="${1:-wait_for: missing service argument}"
local result="${2:-success}"
local 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 "${service/_/-}.service" >>"$TESTLOG"
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
# appropriate 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 "$TESTLOG" ]]; then
# no mv
cp "$TESTLOG" /test.log
exit 1
fi
touch /testok
exit 0
|