aboutsummaryrefslogtreecommitdiff
path: root/tests/startup.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/startup.at')
-rw-r--r--tests/startup.at84
1 files changed, 84 insertions, 0 deletions
diff --git a/tests/startup.at b/tests/startup.at
new file mode 100644
index 0000000..72017ce
--- /dev/null
+++ b/tests/startup.at
@@ -0,0 +1,84 @@
1# This file is part of GNU pies testsuite. -*- Autotest -*-
2# Copyright (C) 2019 Sergey Poznyakoff
3#
4# GNU pies is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# GNU pies is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with GNU pies. If not, see <http://www.gnu.org/licenses/>.
16
17AT_SETUP([Startup components])
18
19AT_CHECK([
20PIES_XFAIL_CHECK
21PIES_CONTROL_INIT
22comp_pid_file=$PWD/comp.pid
23
24cat > pies.conf <<_EOT
25component b1 {
26 mode startup;
27 command "$auxdir/startup $PWD 1 b1";
28}
29
30component b2 {
31 mode startup;
32 command "$auxdir/startup $PWD 2 b2";
33}
34
35component test {
36 mode respawn;
37 command "$auxdir/respawn -append -pid $comp_pid_file";
38}
39_EOT
40
41pies --config-file control.conf --config-file pies.conf
42
43n=0
44res=
45b1=
46b2=
47while :
48do
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
71done
72
73PIES_STOP
74case $res in
75b1b2pid|b2b1pid) echo b1b2pid;;
76*) echo $res
77esac
78],
79[0],
80[b1b2pid
81])
82
83AT_CLEANUP
84

Return to:

Send suggestions and report system problems to the System administrator.