aboutsummaryrefslogtreecommitdiff
path: root/tests/shell.at
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-06-02 11:57:42 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-06-02 11:57:42 +0300
commit685600d72b0c300f94c0c69dc0a16c4ebb230a21 (patch)
tree3a3ea6f43a8cdc543118e2cf81d29628dc82f61f /tests/shell.at
parentcc298a11a131b162f291d6ee27ba1d7598a1b6c4 (diff)
downloadpies-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.at48
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
@@ -19,40 +19,38 @@ AT_SETUP([flags shell])
19AT_CHECK([ 19AT_CHECK([
20PIES_XFAIL_CHECK 20PIES_XFAIL_CHECK
21PIES_CONTROL_INIT 21PIES_CONTROL_INIT
22statefile=$PWD/state
22outfile=$PWD/respawn.out 23outfile=$PWD/respawn.out
23cat > pies.conf <<_EOT 24cat > pies.conf <<_EOT
24component test { 25component 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}
29_EOT 35_EOT
30 36
31pies --config-file control.conf --config-file pies.conf 37set -e
38to 5 \
39 pies --foreground --stderr \
40 --config-file control.conf --config-file pies.conf --debug 1 2>errlog
32 41
33n=0 42echo state:
34while : 43cat $statefile
35do 44echo log:
36 if test -f $outfile; then 45cat $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
48done
49
50PIES_STOP
51head -n2 $outfile
52], 46],
53[0], 47[0],
54[respawn: start 48[state:
55respawn: stop 493
50log:
51pass
52pass
53pass
56]) 54])
57 55
58AT_CLEANUP 56AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.