6 test -z "$tmpdir" && tmpdir
=/tmp
7 out1
="${tmpdir}/bnch$$.1"
8 out2
="${tmpdir}/bnch$$.2"
9 logdir
="${tmpdir}/bnch$$.d"
11 nc
-q 1 2>&1 |
grep -q "illegal option" && nc
='nc -w 1' # workaround for older netcat
15 test -z "$bpid" ||
kill -9 $bpid
16 /bin
/true
# Somehow this gets rid of an unnessary shell message.
23 rm -rf "$logdir" "$out1" "$out2"
32 trap catch HUP INT QUIT TERM
34 if [ ! -x .
/beanstalkd
]; then
35 echo "Executable ./beanstalkd not found; do you need to compile first?"
41 .
/beanstalkd
-p $port -b "$logdir" >/dev
/null
2>/dev
/null
&
45 if ! ps
-p $bpid >/dev
/null
; then
46 echo "Could not start beanstalkd for testing (possibly port $port is taken)"
50 $nc $server $port <<EOF > "$out1"
77 test "$res" -eq 0 ||
exit $res
82 .
/beanstalkd
-p $port -b "$logdir" >/dev
/null
2>/dev
/null
&
86 if ! ps
-p $bpid >/dev
/null
; then
87 echo "Could not start beanstalkd for testing (possibly port $port is taken)"
91 $nc $server $port <<EOF > "$out2"