diff options
Diffstat (limited to 'tests/aux')
-rwxr-xr-x | tests/aux/mailer | 7 | ||||
-rwxr-xr-x | tests/aux/respawn | 63 | ||||
-rwxr-xr-x | tests/aux/retcode | 9 | ||||
-rwxr-xr-x | tests/aux/startup | 7 |
4 files changed, 86 insertions, 0 deletions
diff --git a/tests/aux/mailer b/tests/aux/mailer new file mode 100755 index 0000000..f832ff5 --- /dev/null +++ b/tests/aux/mailer @@ -0,0 +1,7 @@ +#! /bin/sh + +exec >${1:?} +shift +echo $* +cat - + diff --git a/tests/aux/respawn b/tests/aux/respawn new file mode 100755 index 0000000..11d59f6 --- /dev/null +++ b/tests/aux/respawn @@ -0,0 +1,63 @@ +#! /bin/sh + +# usage: respawn [-append] [-stderr FILE] [-stdout FILE] [-sleep TIME] +# [-pid FILE] [-tag STRING] [-exit CODE] + +append=0 +unset name +time=10 +tag=$0 +code=0 + +while [ $# -ne 0 ] +do + arg=$1 + shift + case $arg in + -append) + append=1;; + -stderr) + name=${1:?missing argument for -stderr} + shift + if [ $append -eq 1 ]; then + exec 2>>$name + append=0 + else + exec 2>$name + fi;; + -stdout) + name=${1:?missing argument for -stdout} + shift + if [ $append -eq 1 ]; then + exec >>$name + append=0 + else + exec >$name + fi;; + -sleep) + time=${1:?missing argument for -sleep} + shift;; + -pid) + name=${1:?missing argument for -pid} + shift + if [ $append -eq 1 ]; then + echo $$ >>$name + append=0 + else + echo $$ >$name + fi;; + -tag) + tag=${1:?missing argument for -tag} + shift;; + -exit) + code=${1:?missing argument for -exit} + shift;; + *) echo >&2 "$tag: invalid argument: $arg" + exit 1 + esac +done + +echo "$tag: start" +sleep $time +echo "$tag: stop" +exit $code diff --git a/tests/aux/retcode b/tests/aux/retcode new file mode 100755 index 0000000..b827ba9 --- /dev/null +++ b/tests/aux/retcode @@ -0,0 +1,9 @@ +#! /bin/sh + +exec >${1:?} + +echo $PIES_VERSION +echo $PIES_COMPONENT +echo $PIES_PID +echo $PIES_STATUS +echo ${PIES_SIGNAL:-No signal} 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 @@ +#!/bin/sh +dir=${1:?} +time=${2:?} +tag=${3:?} + +touch $dir/$tag +sleep $time |