Add integration test for service "restart" function.
[oweals/dinit.git] / src / igr-tests / restart / run-test.sh
1 #!/bin/sh
2
3 rm -f ./basic-ran
4
5 ../../dinit -d sd -u -p socket -q \
6         parent &
7 DINITPID=$!
8
9 # give time for socket to open
10 while [ ! -e socket ]; do
11     sleep 0.1
12 done
13
14 # wait until parent (and therefore 'basic') has fully started
15 ../../dinitctl --quiet -p socket start parent
16
17 sleep 0.1 # time for file to be written
18
19 STATUS=FAIL
20 if [ -e basic-ran ]; then
21    if [ "$(cat basic-ran)" = "ran" ]; then
22        STATUS=PASS
23    fi
24 fi
25
26 if [ $STATUS != PASS ]; then
27     ../../dinitctl --quiet -p socket shutdown
28     exit 1;
29 fi
30
31 rm basic-ran 
32
33 STATUS=FAIL
34 ../../dinitctl --quiet -p socket restart basic
35 sleep .1 # time for file write
36 if [ -e basic-ran ]; then
37    if [ "$(cat basic-ran)" = "ran" ]; then
38        STATUS=PASS
39    fi
40 fi
41
42 ../../dinitctl --quiet -p socket shutdown
43 wait $DINITPID
44
45 if [ $STATUS = PASS ]; then exit 0; fi
46 exit 1