7 test -z "$tmpdir" && tmpdir
=/tmp
8 out1
="${tmpdir}/bnch$$.1"
9 out2
="${tmpdir}/bnch$$.2"
10 logdir
="${tmpdir}/bnch$$.d"
12 nc
-q 1 2>&1 |
grep -q option
&& nc
='nc -w 1' # workaround for older netcat
16 test -z "$bpid" ||
kill -9 $bpid
17 /bin
/true
# Somehow this gets rid of an unnessary shell message.
24 rm -rf "$logdir" "$out1" "$out2"
33 trap catch HUP INT QUIT TERM
35 if [ ! -x .
/beanstalkd
]; then
36 echo "Executable ./beanstalkd not found; do you need to compile first?"
42 .
/beanstalkd
-p $port -b "$logdir" -s $size >/dev
/null
2>/dev
/null
&
46 if ! ps
-p $bpid >/dev
/null
; then
47 echo "Could not start beanstalkd for testing (possibly port $port is taken)"
51 # Check that the first binlog file is the proper size.
52 test "$(stat --printf=%s "$logdir"/binlog.1)" -eq $size ||
exit 1
54 # Insert enough jobs to create a second binlog file
55 $nc $server $port <<EOF > "$out1"
57 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
59 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
61 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
65 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
67 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
69 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
71 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
73 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
75 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
77 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
79 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
81 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
83 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
85 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
87 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
89 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
91 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
93 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
95 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
121 test "$res" -eq 0 ||
exit $res
123 # Check that the first binlog file is still the proper size.
124 test "$(stat --printf=%s "$logdir"/binlog.1)" -eq $size ||
exit 1
126 # Check that the second binlog file is the proper size.
127 test "$(stat --printf=%s "$logdir"/binlog.2)" -eq $size ||
exit 1