diff options
Diffstat (limited to 'tests/startup.at')
-rw-r--r-- | tests/startup.at | 67 |
1 files changed, 23 insertions, 44 deletions
diff --git a/tests/startup.at b/tests/startup.at index 440c249..22ad25b 100644 --- a/tests/startup.at +++ b/tests/startup.at | |||
@@ -19,65 +19,44 @@ AT_SETUP([Startup components]) | |||
19 | AT_CHECK([ | 19 | AT_CHECK([ |
20 | PIES_XFAIL_CHECK | 20 | PIES_XFAIL_CHECK |
21 | PIES_CONTROL_INIT | 21 | PIES_CONTROL_INIT |
22 | comp_pid_file=$PWD/comp.pid | ||
23 | 22 | ||
24 | cat > pies.conf <<_EOT | 23 | cat > pies.conf <<_EOT |
25 | component b1 { | 24 | component b1 { |
26 | mode startup; | 25 | mode startup; |
27 | command "$auxdir/touchfile $PWD 1 b1"; | 26 | command "$auxdir/touchfile b1 1"; |
28 | } | 27 | } |
29 | 28 | ||
30 | component b2 { | 29 | component b2 { |
31 | mode startup; | 30 | mode startup; |
32 | command "$auxdir/touchfile $PWD 2 b2"; | 31 | command "$auxdir/touchfile b2 2"; |
33 | } | 32 | } |
34 | 33 | ||
35 | component test { | 34 | component test { |
36 | mode respawn; | 35 | mode respawn; |
37 | command "$auxdir/respawn -append -pid $comp_pid_file"; | 36 | command "$auxdir/startcheck b1 b2"; |
37 | chdir $PWD; | ||
38 | stdout file "log.out"; | ||
39 | stderr file "log.err"; | ||
40 | return-code * { | ||
41 | action disable; | ||
42 | exec "piesctl --url unix:///$PWD/pies.ctl shutdown"; | ||
43 | } | ||
38 | } | 44 | } |
39 | _EOT | 45 | _EOT |
40 | 46 | ||
41 | pies --config-file control.conf --config-file pies.conf | 47 | set -e |
48 | to 5 \ | ||
49 | pies --foreground --stderr \ | ||
50 | --config-file control.conf --config-file pies.conf 2>errlog | ||
42 | 51 | ||
43 | n=0 | 52 | cat log.out |
44 | res= | 53 | cat log.err >&2 |
45 | b1= | ||
46 | b2= | ||
47 | while : | ||
48 | do | ||
49 | echo "n=$n" >> tracefile | ||
50 | if test -z "$b1" && test -f b1; then | ||
51 | res="${res}b1" | ||
52 | b1=1 | ||
53 | echo "got b1" >> tracefile | ||
54 | fi | ||
55 | if test -z "$b2" && test -f b2; then | ||
56 | res="${res}b2" | ||
57 | b2=1 | ||
58 | echo "got b2" >> tracefile | ||
59 | fi | ||
60 | if test -f $comp_pid_file; then | ||
61 | echo "got pidfile" >> tracefile | ||
62 | res="${res}pid" | ||
63 | break | ||
64 | fi | ||
65 | sleep 1 | ||
66 | n=$(($n + 1)) | ||
67 | if test $n -gt 10; then | ||
68 | echo >&2 "timed out" | ||
69 | break | ||
70 | fi | ||
71 | done | ||
72 | |||
73 | PIES_STOP | ||
74 | case $res in | ||
75 | b1b2pid|b2b1pid) echo b1b2pid;; | ||
76 | *) echo $res | ||
77 | esac | ||
78 | ], | 54 | ], |
79 | [0], | 55 | [0], |
80 | [b1b2pid | 56 | [# b1 |
57 | b1 | ||
58 | # b2 | ||
59 | b2 | ||
81 | ]) | 60 | ]) |
82 | 61 | ||
83 | AT_CLEANUP | 62 | AT_CLEANUP |