Add integration test for gentle stop/force stop.
[oweals/dinit.git] / src / igr-tests / force-stop / run-test.sh
1 #!/bin/sh
2
3 ../../dinit -d sd -u -p socket -q &
4 DINITPID=$!
5
6 # give time for socket to open
7 while [ ! -e socket ]; do
8     sleep 0.1
9 done
10
11 DINITCTLOUT="$(../../dinitctl -p socket list)"
12 if [ "$DINITCTLOUT" != "$(cat expected-1)" ]; then
13     kill $DINITPID; wait $DINITPID
14     exit 1
15 fi
16
17 DINITCTLOUT="$(../../dinitctl -p socket stop critical 2>&1)"
18 if [ "$DINITCTLOUT" != "$(cat expected-2.err)" ]; then
19     kill $DINITPID; wait $DINITPID
20     exit 1
21 fi
22
23 DINITCTLOUT="$(../../dinitctl -p socket stop --force critical 2>&1)"
24 if [ "$DINITCTLOUT" != "$(cat expected-3)" ]; then
25     kill $DINITPID; wait $DINITPID
26     exit 1;
27 fi
28
29 # Note dinit should shutdown since all services stopped.
30 wait $DINITPID
31
32 # Passed:
33 exit 0