clean up copyright notices
[beanstalkd.git] / sh-tests / binlog-read.sh
blob8b083336c8d2bbdf85d87c7cc93c1877e8d9d710
1 #!/usr/bin/env bash
3 . "sh-tests/common.functions"
5 server=localhost
6 tmpdir="$TMPDIR"
7 test -z "$tmpdir" && tmpdir=/tmp
8 out1="${tmpdir}/bnch$$.1"
9 out2="${tmpdir}/bnch$$.2"
10 logdir="${tmpdir}/bnch$$.d"
11 nc="sh-tests/netcat.py"
13 cleanup() {
14 killbeanstalkd
15 rm -rf "$logdir" "$out1" "$out2"
18 catch() {
19 echo '' Interrupted
20 exit 3
23 trap cleanup EXIT
24 trap catch HUP INT QUIT TERM
26 if [ ! -x ./beanstalkd ]; then
27 echo "Executable ./beanstalkd not found; do you need to compile first?"
28 exit 2
31 start_beanstalkd $logdir
33 $nc $server $port <<EOF > "$out1"
34 use test
35 put 0 0 120 4
36 test
37 put 0 0 120 4
38 tes1
39 watch test
40 reserve
41 release 1 1 1
42 reserve
43 delete 2
44 quit
45 EOF
47 diff - "$out1" <<EOF
48 USING test
49 INSERTED 1
50 INSERTED 2
51 WATCHING 2
52 RESERVED 1 4
53 test
54 RELEASED
55 RESERVED 2 4
56 tes1
57 DELETED
58 EOF
59 res=$?
60 test "$res" -eq 0 || exit $res
62 killbeanstalkd
64 sleep 1
65 start_beanstalkd $logdir
67 $nc $server $port <<EOF > "$out2"
68 watch test
69 reserve
70 delete 1
71 delete 2
72 quit
73 EOF
75 diff - "$out2" <<EOF
76 WATCHING 2
77 RESERVED 1 4
78 test
79 DELETED
80 NOT_FOUND
81 EOF