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/startup.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/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 @@ -21,3 +21,2 @@ PIES_XFAIL_CHECK PIES_CONTROL_INIT -comp_pid_file=$PWD/comp.pid @@ -25,4 +24,4 @@ cat > pies.conf <<_EOT component b1 { - mode startup; - command "$auxdir/touchfile $PWD 1 b1"; + mode startup; + command "$auxdir/touchfile b1 1"; } @@ -30,4 +29,4 @@ component b1 { component b2 { - mode startup; - command "$auxdir/touchfile $PWD 2 b2"; + mode startup; + command "$auxdir/touchfile b2 2"; } @@ -35,4 +34,11 @@ component b2 { component test { - mode respawn; - command "$auxdir/respawn -append -pid $comp_pid_file"; + mode respawn; + command "$auxdir/startcheck b1 b2"; + chdir $PWD; + stdout file "log.out"; + stderr file "log.err"; + return-code * { + action disable; + exec "piesctl --url unix:///$PWD/pies.ctl shutdown"; + } } @@ -40,42 +46,15 @@ _EOT -pies --config-file control.conf --config-file pies.conf +set -e +to 5 \ + pies --foreground --stderr \ + --config-file control.conf --config-file pies.conf 2>errlog -n=0 -res= -b1= -b2= -while : -do - echo "n=$n" >> tracefile - if test -z "$b1" && test -f b1; then - res="${res}b1" - b1=1 - echo "got b1" >> tracefile - fi - if test -z "$b2" && test -f b2; then - res="${res}b2" - b2=1 - echo "got b2" >> tracefile - fi - if test -f $comp_pid_file; then - echo "got pidfile" >> tracefile - res="${res}pid" - break - fi - sleep 1 - n=$(($n + 1)) - if test $n -gt 10; then - echo >&2 "timed out" - break - fi -done - -PIES_STOP -case $res in -b1b2pid|b2b1pid) echo b1b2pid;; -*) echo $res -esac +cat log.out +cat log.err >&2 ], [0], -[b1b2pid +[# b1 +b1 +# b2 +b2 ]) |