diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-06-02 11:57:42 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-06-02 11:57:42 +0300 |
commit | 685600d72b0c300f94c0c69dc0a16c4ebb230a21 (patch) | |
tree | 3a3ea6f43a8cdc543118e2cf81d29628dc82f61f /tests/shell.at | |
parent | cc298a11a131b162f291d6ee27ba1d7598a1b6c4 (diff) | |
download | pies-685600d72b0c300f94c0c69dc0a16c4ebb230a21.tar.gz pies-685600d72b0c300f94c0c69dc0a16c4ebb230a21.tar.bz2 |
Rewrite the testsuite
The aim is to run pies in foreground if possible. Limit execution time
using external wrapper.
* src/pies.c: (_cb_redir): Consistently return 1 on errors.
* tests/aux/sleepexit: New file.
* tests/aux/startcheck: New file.
* tests/aux/touchfile: Change arguments.
* tests/aux/respawn: Rewrite.
* tests/lines.c: New noinst program.
* tests/to.c: New noinst program.
* tests/.gitignore: Add new programs.
* tests/Makefile.am: Update.
* tests/env.at: Use to to avoid hanging forever.
Add missing popdef.
* tests/redirect.at: Use echo as component program.
* tests/respawn.at: Run pies in foreground. Use to to limit execution
time.
* tests/shell.at: Likewise.
* tests/shutdown.at: Likewise.
* tests/startup.at: Likewise.
* tests/ret-exec.at: Use sleepexit as component program.
* tests/ret-notify.at: Likewise.
Diffstat (limited to 'tests/shell.at')
-rw-r--r-- | tests/shell.at | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/tests/shell.at b/tests/shell.at index 2f06f62..e3d104b 100644 --- a/tests/shell.at +++ b/tests/shell.at | |||
@@ -21,2 +21,3 @@ PIES_XFAIL_CHECK | |||
21 | PIES_CONTROL_INIT | 21 | PIES_CONTROL_INIT |
22 | statefile=$PWD/state | ||
22 | outfile=$PWD/respawn.out | 23 | outfile=$PWD/respawn.out |
@@ -24,5 +25,10 @@ cat > pies.conf <<_EOT | |||
24 | component test { | 25 | component test { |
25 | mode respawn; | 26 | mode respawn; |
26 | flags shell; | 27 | flags shell; |
27 | command "$auxdir/respawn -tag respawn >> $outfile"; | 28 | command "if $auxdir/respawn $statefile 3; then echo pass; else exit 1; fi >> $outfile"; |
29 | chdir $PWD; | ||
30 | return-code 1 { | ||
31 | action disable; | ||
32 | exec "piesctl --url unix:///$PWD/pies.ctl shutdown"; | ||
33 | } | ||
28 | } | 34 | } |
@@ -30,27 +36,19 @@ _EOT | |||
30 | 36 | ||
31 | pies --config-file control.conf --config-file pies.conf | 37 | set -e |
38 | to 5 \ | ||
39 | pies --foreground --stderr \ | ||
40 | --config-file control.conf --config-file pies.conf --debug 1 2>errlog | ||
32 | 41 | ||
33 | n=0 | 42 | echo state: |
34 | while : | 43 | cat $statefile |
35 | do | 44 | echo log: |
36 | if test -f $outfile; then | 45 | cat $outfile |
37 | lines=`wc -l $outfile | awk '{print $1}'` | ||
38 | if test "$lines" -ge 2 ; then | ||
39 | break | ||
40 | fi | ||
41 | fi | ||
42 | sleep 1 | ||
43 | n=$(($n + 1)) | ||
44 | if test $n -gt 35; then | ||
45 | echo >&2 "timed out" | ||
46 | break | ||
47 | fi | ||
48 | done | ||
49 | |||
50 | PIES_STOP | ||
51 | head -n2 $outfile | ||
52 | ], | 46 | ], |
53 | [0], | 47 | [0], |
54 | [respawn: start | 48 | [state: |
55 | respawn: stop | 49 | 3 |
50 | log: | ||
51 | pass | ||
52 | pass | ||
53 | pass | ||
56 | ]) | 54 | ]) |