]> git.proxmox.com Git - systemd.git/blame - test/units/testsuite-16.sh
New upstream version 249~rc1
[systemd.git] / test / units / testsuite-16.sh
CommitLineData
46cdbd49 1#!/usr/bin/env bash
8b3d4ff0
MB
2set -eux
3set -o pipefail
52ad194e
MB
4
5rm -f /test.log
6
8b3d4ff0 7TESTLOG=/test.log.XXXXXXXX
52ad194e
MB
8
9function wait_for()
10{
8b3d4ff0
MB
11 local service="${1:-wait_for: missing service argument}"
12 local result="${2:-success}"
13 local time="${3:-45}"
52ad194e 14
8b3d4ff0 15 while [[ ! -f /${service}.terminated && ! -f /${service}.success && $time -gt 0 ]]; do
52ad194e 16 sleep 1
8b3d4ff0 17 time=$((time - 1))
52ad194e
MB
18 done
19
8b3d4ff0
MB
20 if [[ ! -f /${service}.${result} ]]; then
21 journalctl -u "${service/_/-}.service" >>"$TESTLOG"
52ad194e
MB
22 fi
23}
24
25# This checks all stages, start, runtime and stop, can be extended by
26# EXTEND_TIMEOUT_USEC
27
28wait_for success_all
29
30# These check that EXTEND_TIMEOUT_USEC that occurs at greater than the
31# extend timeout interval but less then the stage limit (TimeoutStartSec,
32# RuntimeMaxSec, TimeoutStopSec) still succeed.
33
34wait_for success_start
35wait_for success_runtime
36wait_for success_stop
37
38# These ensure that EXTEND_TIMEOUT_USEC will still timeout in the
3a6ce677 39# appropriate stage, after the stage limit, when the EXTEND_TIMEOUT_USEC
52ad194e
MB
40# message isn't sent within the extend timeout interval.
41
42wait_for fail_start startfail
43wait_for fail_stop stopfail
44wait_for fail_runtime runtimefail
45
8b3d4ff0 46if [[ -f "$TESTLOG" ]]; then
52ad194e 47 # no mv
8b3d4ff0 48 cp "$TESTLOG" /test.log
52ad194e 49 exit 1
52ad194e 50fi
8b3d4ff0
MB
51
52touch /testok
53exit 0