Consistent formatting.
[beanstalkd.git] / shell_tests / run_one.sh
blob49285cd40c4237da8100dd7701169a4dcd7f023b
1 #!/bin/bash
3 SERVER='localhost'
4 PORT=11400
5 ./beanstalkd -p $PORT >/dev/null 2>/dev/null &
6 bg=$!
8 sleep .1
9 if ! ps $bg >/dev/null; then
10 echo "Could not start beanstalkd for testing, port $PORT is taken"
11 exit 1
14 clean_exit() {
15 kill -9 $1
16 rm .tmp_test
17 exit $2
20 fgrep -v "#" $1 | nc -q 1 $SERVER $PORT > .tmp_test
22 # diff is "false" if they match
23 if diff $2 .tmp_test; then
24 clean_exit $bg 0 2>/dev/null
27 clean_exit $bg 1 2>/dev/null