diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 9 | ||||
-rw-r--r-- | tests/atlocal.in | 2 | ||||
-rwxr-xr-x | tests/aux/mailer (renamed from tests/mailer) | 0 | ||||
-rwxr-xr-x | tests/aux/respawn (renamed from tests/respawn) | 0 | ||||
-rwxr-xr-x | tests/aux/retcode (renamed from tests/retcode) | 0 | ||||
-rwxr-xr-x | tests/aux/startup | 7 | ||||
-rw-r--r-- | tests/redirect.at | 2 | ||||
-rw-r--r-- | tests/respawn.at | 2 | ||||
-rw-r--r-- | tests/ret-exec.at | 4 | ||||
-rw-r--r-- | tests/ret-notify.at | 6 | ||||
-rw-r--r-- | tests/startup.at | 84 | ||||
-rw-r--r-- | tests/testsuite.at | 1 |
12 files changed, 108 insertions, 9 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 447104b..b2f2719 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am | |||
@@ -14,7 +14,13 @@ | |||
14 | # You should have received a copy of the GNU General Public License | 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/>. | 15 | # along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 respawn retcode mailer | 17 | AUXTOOLS = \ |
18 | aux/respawn\ | ||
19 | aux/retcode\ | ||
20 | aux/mailer\ | ||
21 | aux/startup | ||
22 | |||
23 | EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 $(AUXTOOLS) | ||
18 | DISTCLEANFILES = atconfig $(check_SCRIPTS) | 24 | DISTCLEANFILES = atconfig $(check_SCRIPTS) |
19 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) | 25 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) |
20 | 26 | ||
@@ -46,6 +52,7 @@ TESTSUITE_AT = \ | |||
46 | redirect.at\ | 52 | redirect.at\ |
47 | ret-exec.at\ | 53 | ret-exec.at\ |
48 | ret-notify.at\ | 54 | ret-notify.at\ |
55 | startup.at\ | ||
49 | version.at | 56 | version.at |
50 | 57 | ||
51 | TESTSUITE = $(srcdir)/testsuite | 58 | TESTSUITE = $(srcdir)/testsuite |
diff --git a/tests/atlocal.in b/tests/atlocal.in index 9069bbd..1992b80 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | PATH=@abs_builddir@:@abs_top_builddir@/src:$srcdir:$PATH | 5 | PATH=@abs_builddir@:@abs_top_builddir@/src:$srcdir:$PATH |
6 | XFAILFILE=$abs_builddir/.badversion | 6 | XFAILFILE=$abs_builddir/.badversion |
7 | 7 | auxdir="$abs_srcdir/aux" | |
8 | trimws() { | 8 | trimws() { |
9 | sed 's/[ ][ ]*$//' | 9 | sed 's/[ ][ ]*$//' |
10 | } | 10 | } |
diff --git a/tests/mailer b/tests/aux/mailer index f832ff5..f832ff5 100755 --- a/tests/mailer +++ b/tests/aux/mailer | |||
diff --git a/tests/respawn b/tests/aux/respawn index 11d59f6..11d59f6 100755 --- a/tests/respawn +++ b/tests/aux/respawn | |||
diff --git a/tests/retcode b/tests/aux/retcode index b827ba9..b827ba9 100755 --- a/tests/retcode +++ b/tests/aux/retcode | |||
diff --git a/tests/aux/startup b/tests/aux/startup new file mode 100755 index 0000000..b9d92a3 --- /dev/null +++ b/tests/aux/startup | |||
@@ -0,0 +1,7 @@ | |||
1 | #!/bin/sh | ||
2 | dir=${1:?} | ||
3 | time=${2:?} | ||
4 | tag=${3:?} | ||
5 | |||
6 | touch $dir/$tag | ||
7 | sleep $time | ||
diff --git a/tests/redirect.at b/tests/redirect.at index 9e53ba2..3a8cca7 100644 --- a/tests/redirect.at +++ b/tests/redirect.at | |||
@@ -24,7 +24,7 @@ outfile=$PWD/out | |||
24 | cat > pies.conf <<_EOT | 24 | cat > pies.conf <<_EOT |
25 | component test { | 25 | component test { |
26 | mode respawn; | 26 | mode respawn; |
27 | command "$abs_srcdir/respawn -tag respawn -append -pid $comp_pid_file"; | 27 | command "$auxdir/respawn -tag respawn -append -pid $comp_pid_file"; |
28 | stdout file "$outfile"; | 28 | stdout file "$outfile"; |
29 | } | 29 | } |
30 | _EOT | 30 | _EOT |
diff --git a/tests/respawn.at b/tests/respawn.at index 8d72c40..4a8e3a7 100644 --- a/tests/respawn.at +++ b/tests/respawn.at | |||
@@ -23,7 +23,7 @@ comp_pid_file=$PWD/comp.pid | |||
23 | cat > pies.conf <<_EOT | 23 | cat > pies.conf <<_EOT |
24 | component test { | 24 | component test { |
25 | mode respawn; | 25 | mode respawn; |
26 | command "$abs_srcdir/respawn -append -pid $comp_pid_file"; | 26 | command "$auxdir/respawn -append -pid $comp_pid_file"; |
27 | } | 27 | } |
28 | _EOT | 28 | _EOT |
29 | 29 | ||
diff --git a/tests/ret-exec.at b/tests/ret-exec.at index bf2c1a4..0b3d716 100644 --- a/tests/ret-exec.at +++ b/tests/ret-exec.at | |||
@@ -26,10 +26,10 @@ cat > pies.conf <<_EOT | |||
26 | component test { | 26 | component test { |
27 | mode respawn; | 27 | mode respawn; |
28 | return-code 10 { | 28 | return-code 10 { |
29 | exec "$abs_srcdir/retcode $report_file"; | 29 | exec "$auxdir/retcode $report_file"; |
30 | action disable; | 30 | action disable; |
31 | } | 31 | } |
32 | command "$abs_srcdir/respawn -sleep 2 -pid $comp_pid_file -exit 10"; | 32 | command "$auxdir/respawn -sleep 2 -pid $comp_pid_file -exit 10"; |
33 | } | 33 | } |
34 | _EOT | 34 | _EOT |
35 | 35 | ||
diff --git a/tests/ret-notify.at b/tests/ret-notify.at index d1a7f39..a7768aa 100644 --- a/tests/ret-notify.at +++ b/tests/ret-notify.at | |||
@@ -22,15 +22,15 @@ PIES_XFAIL_CHECK | |||
22 | PIES_CONTROL_INIT | 22 | PIES_CONTROL_INIT |
23 | report_file=$PWD/report | 23 | report_file=$PWD/report |
24 | cat > pies.conf <<_EOT | 24 | cat > pies.conf <<_EOT |
25 | mailer-program "$abs_srcdir/mailer"; | 25 | mailer-program "$auxdir/mailer"; |
26 | mailer-command-line "$abs_srcdir/mailer $report_file"; | 26 | mailer-command-line "$auxdir/mailer $report_file"; |
27 | component test { | 27 | component test { |
28 | mode respawn; | 28 | mode respawn; |
29 | return-code 10 { | 29 | return-code 10 { |
30 | notify root; | 30 | notify root; |
31 | action disable; | 31 | action disable; |
32 | } | 32 | } |
33 | command "$abs_srcdir/respawn -sleep 2 -exit 10"; | 33 | command "$auxdir/respawn -sleep 2 -exit 10"; |
34 | } | 34 | } |
35 | _EOT | 35 | _EOT |
36 | 36 | ||
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 | |||
17 | AT_SETUP([Startup components]) | ||
18 | |||
19 | AT_CHECK([ | ||
20 | PIES_XFAIL_CHECK | ||
21 | PIES_CONTROL_INIT | ||
22 | comp_pid_file=$PWD/comp.pid | ||
23 | |||
24 | cat > pies.conf <<_EOT | ||
25 | component b1 { | ||
26 | mode startup; | ||
27 | command "$auxdir/startup $PWD 1 b1"; | ||
28 | } | ||
29 | |||
30 | component b2 { | ||
31 | mode startup; | ||
32 | command "$auxdir/startup $PWD 2 b2"; | ||
33 | } | ||
34 | |||
35 | component test { | ||
36 | mode respawn; | ||
37 | command "$auxdir/respawn -append -pid $comp_pid_file"; | ||
38 | } | ||
39 | _EOT | ||
40 | |||
41 | pies --config-file control.conf --config-file pies.conf | ||
42 | |||
43 | n=0 | ||
44 | res= | ||
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 | ], | ||
79 | [0], | ||
80 | [b1b2pid | ||
81 | ]) | ||
82 | |||
83 | AT_CLEANUP | ||
84 | |||
diff --git a/tests/testsuite.at b/tests/testsuite.at index 03ddd50..2a1167d 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at | |||
@@ -65,3 +65,4 @@ m4_include([respawn.at]) | |||
65 | m4_include([redirect.at]) | 65 | m4_include([redirect.at]) |
66 | m4_include([ret-exec.at]) | 66 | m4_include([ret-exec.at]) |
67 | m4_include([ret-notify.at]) | 67 | m4_include([ret-notify.at]) |
68 | m4_include([startup.at]) | ||