#!/bin/sh
-# $Id: stop01.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
+# $Id: stop01.sh,v 1.5 2003-05-24 22:34:48 adam Exp $
# test start and stop of the server with -1
-echo "initializing"
+LOG=stop01.log
+
+rm -f $LOG
+echo "initializing" >>$LOG
mkdir -p reg
-rm -f idx.log srv.log
-../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg init || exit 1
#create a base to test on
-../../index/zebraidx -l idx.log -c zebra1.cfg update records || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg update records || exit 1
#kill old server (if any)
test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
-rm -f zebrasrv.pid
-rm -f srv.log
-echo "Starting server with -1 (one shot)..."
-../../index/zebrasrv -1 -c zebra1.cfg -l srv.log tcp:@:9901 &
+echo "Starting server with -1 (one shot)..." >>$LOG
+../../index/zebrasrv -1 -c zebra1.cfg -l $LOG tcp:@:9901 &
sleep 1
-echo " checking that it runs... "
+echo " checking that it runs... " >>$LOG
test -f zebrasrv.pid || exit 1
PID=`cat zebrasrv.pid`
ps -p $PID |grep $PID >/dev/null || exit 1
-echo " connecting to it..."
-../api/testclient localhost:9901 utah > log || exit 1
+echo " connecting to it..." >>$LOG
+../api/testclient localhost:9901 utah >>$LOG || exit 1
sleep 1
-echo " checking that server does not run any more"
+echo " checking that server does not run any more" >>$LOG
ps -p $PID | grep $PID >/dev/null && exit 1
# clean up
-rm -rf reg idx.log srv.log zebrasrv.pid
+rm -rf reg zebrasrv.pid
#!/bin/sh
-# $Id: stop02.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
+# $Id: stop02.sh,v 1.5 2003-05-24 22:34:48 adam Exp $
# test start and stop of the server with -S
-#
-# FIXME - this test does not currently pass (H 22-oct-2002)
-# Something rotten with signals and threads and mutexes...
-echo "initializing"
+LOG=stop02.log
+
+rm -f $LOG
+echo "initializing" >>$LOG
mkdir -p reg
-rm -f idx.log srv.log
-../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg init || exit 1
#create a base to test on
-../../index/zebraidx -l idx.log -c zebra1.cfg update records || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg update records || exit 1
#kill old server (if any)
test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
-rm -f zebrasrv.pid
-rm -f srv.log
-echo "Starting server with -S (static)..."
-../../index/zebrasrv -S -c zebra1.cfg -l srv.log tcp:@:9901 &
+echo "Starting server with -S (static)..." >>$LOG
+../../index/zebrasrv -S -c zebra1.cfg -l $LOG tcp:@:9901 &
sleep 1
-echo " checking that it runs... "
+echo " checking that it runs... " >>$LOG
test -f zebrasrv.pid || exit 1
PID=`cat zebrasrv.pid`
ps -p $PID |grep $PID >/dev/null || exit 1
-echo " connecting to it..."
-../api/testclient localhost:9901 utah > log || exit 1
+echo " connecting to it..." >>$LOG
+../api/testclient localhost:9901 utah >>$LOG || exit 1
sleep 1
-echo " checking that it still runs..."
+echo " checking that it still runs..." >>$LOG
ps -p $PID | grep $PID >/dev/null || exit 1
-echo " connecting again, with a delay..."
-../api/testclient -d 5 localhost:9901 utah > log &
+echo " connecting again, with a delay..." >>$LOG
+../api/testclient -d 5 localhost:9901 utah >>$LOG &
sleep 1 # let the client connect
-echo " killing it..."
-kill $PID
+echo " killing it..." >>$LOG
+kill $PID
sleep 1
-echo " checking that it is dead..."
+echo " checking that it is dead..." >>$LOG
ps -p $PID | grep $PID >/dev/null && exit 1
# clean up
-rm -rf reg idx.log srv.log zebrasrv.pid
+rm -rf reg zebrasrv.pid
#!/bin/sh
-# $Id: stop03.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
+# $Id: stop03.sh,v 1.5 2003-05-24 22:34:48 adam Exp $
# test start and stop of the threaded server (-T)
-#
-# FIXME - this test does not currently pass (H 22-oct-2002)
-# When the client exits, the process dies with a segfault
-echo "initializing"
+LOG=stop03.log
+
+rm -f $LOG
+echo "initializing" >>$LOG
mkdir -p reg
-rm -f idx.log srv.log servercrash
-../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg init || exit 1
#create a base to test on
-../../index/zebraidx -l idx.log -c zebra1.cfg update records || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg update records || exit 1
#kill old server (if any)
test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
-rm -f zebrasrv.pid
-rm -f srv.log
-echo "Starting server with -T (threaded)..."
+echo "Starting server with -T (threaded)..." >>$LOG
(
- ../../index/zebrasrv -T -c zebra1.cfg -l srv.log tcp:@:9901 ||
- echo "server failed with $?" > servercrash
+ ../../index/zebrasrv -T -c zebra1.cfg -l $LOG tcp:@:9901 ||
+ echo "server failed with $?" > $LOG
)&
sleep 1
-echo " checking that it runs... "
+echo " checking that it runs... " >>$LOG
test -f zebrasrv.pid || exit 1
PID=`cat zebrasrv.pid`
ps -p $PID | grep $PID >/dev/null || exit 1
-echo " connecting to it..."
-../api/testclient localhost:9901 utah > log || exit 1
+echo " connecting to it..." >>$LOG
+../api/testclient localhost:9901 utah >>$LOG || exit 1
sleep 1
-echo " checking that it still runs..."
+echo " checking that it still runs..." >>$LOG
ps -p $PID >/dev/null || exit 1
-echo " connecting again, with a delay..."
-../api/testclient localhost:9901 utah 5 > log &
+echo " connecting again, with a delay..." >>$LOG
+../api/testclient localhost:9901 utah 5 >>$LOG &
sleep 1 # let the client connect
-echo " killing it..."
-kill $PID
+echo " killing it..." >>$LOG
+kill $PID
sleep 1
-echo " checking that it is dead"
+echo " checking that it is dead" >>$LOG
ps -p $PID | grep $PID >/dev/null && exit 1
# clean up
-rm -rf reg idx.log srv.log zebrasrv.pid servercrash
+rm -rf reg zebrasrv.pid
#!/bin/sh
-# $Id: stop04.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
+# $Id: stop04.sh,v 1.5 2003-05-24 22:34:48 adam Exp $
# test start and stop of the forked server
-#
-echo "initializing"
+LOG=stop04.log
+
+rm -f $LOG
+echo "initializing" >>$LOG
mkdir -p reg
-rm -f idx.log srv.log
-../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg init || exit 1
#create a base to test on
-../../index/zebraidx -l idx.log -c zebra1.cfg update records || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg update records || exit 1
#kill old server (if any)
test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
-rm -f zebrasrv.pid
-rm -f srv.log
-echo "Starting server with (forked)..."
-../../index/zebrasrv -c zebra1.cfg -l srv.log tcp:@:9901 &
+echo "Starting server with (forked)..." >>$LOG
+../../index/zebrasrv -c zebra1.cfg -l $LOG tcp:@:9901 &
sleep 1
-echo " checking that it runs... "
+echo " checking that it runs... " >>$LOG
test -f zebrasrv.pid || exit 1
PID=`cat zebrasrv.pid`
ps -p $PID | grep $PID >/dev/null || exit 1
-echo " connecting to it..."
-../api/testclient localhost:9901 utah > log || exit 1
+echo " connecting to it..." >>$LOG
+../api/testclient localhost:9901 utah >>$LOG || exit 1
sleep 1
-echo " checking that it still runs..."
+echo " checking that it still runs..." >>$LOG
ps -p $PID | grep $PID >/dev/null || exit 1
-echo " connecting again, with a delay..."
-../api/testclient localhost:9901 utah 5 > log &
+echo " connecting again, with a delay..." >>$LOG
+../api/testclient localhost:9901 utah 5 >>$LOG
sleep 1 # let the client connect
-echo " killing it..."
-kill $PID
+echo " killing it..." >>$LOG
+kill $PID
sleep 1
-echo " checking that the server is dead..."
+echo " checking that the server is dead..." >>$LOG
ps -p $PID | grep $PID >/dev/null && exit 1
# clean up
-rm -rf reg idx.log srv.log zebrasrv.pid
+rm -rf reg zebrasrv.pid
#!/bin/sh
-# $Id: test1.sh,v 1.6 2003-05-21 14:39:22 adam Exp $
-echo "testing without stored keys (zebra1.cfg)"
+# $Id: test1.sh,v 1.7 2003-05-24 22:34:48 adam Exp $
-sleep 1
+LOG=test1.log
-echo "initializing..."
+rm -f $LOG
+echo "initializing..." >>$LOG
mkdir -p reg
rm -f records/esdd000[12].grs # these should not be here, will be created later
-rm -f idx.log srv.log
-../../index/zebraidx -l idx.log -c zebra1.cfg init || exit 1
+../../index/zebraidx -l $LOG -c zebra1.cfg init || exit 1
-echo "updating..."
-../../index/zebraidx -l idx.log -c zebra1.cfg update records || exit 1
+echo "updating..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra1.cfg update records || exit 1
-echo "killing old server (if any)..."
+echo "killing old server (if any)..." >>$LOG
test -f zebrasrv.pid && kill `cat zebrasrv.pid`
-rm -f zebrasrv.pid
-rm -f srv.log
-echo "starting server..."
-../../index/zebrasrv -S -c zebra1.cfg -l srv.log tcp:@:9901 &
+echo "starting server..." >>$LOG
+../../index/zebrasrv -S -c zebra1.cfg -l $LOG tcp:@:9901 &
sleep 1
-echo "checking it runs..."
+echo "checking it runs..." >>$LOG
test -f zebrasrv.pid || exit 1
-echo "search 1..."
+echo "search 1..." >>$LOG
../api/testclient localhost:9901 utah > log || exit 1
-grep "^Result count: 17$" log || exit 1
+grep "^Result count: 17$" log >/dev/null || exit 1
-echo "search 2..."
+echo "search 2..." >>$LOG
../api/testclient localhost:9901 "@or utah the" > log || exit 1
-grep "^Result count: 40$" log || exit 1
+grep "^Result count: 40$" log >/dev/null || exit 1
-echo "search 3..."
+echo "search 3..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 the" > log || exit 1
-grep "^Result count: 1$" log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
-echo "search 4..."
+echo "search 4..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 9$" log || exit 1
+grep "^Result count: 9$" log >/dev/null || exit 1
-echo "reindexing..."
-../../index/zebraidx -l idx.log -c zebra1.cfg update records || exit 1
+echo "reindexing..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra1.cfg update records || exit 1
-echo "search 5..."
+echo "search 5..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 18$" log || exit 1
+grep "^Result count: 18$" log >/dev/null || exit 1
-echo "stopping server..."
+echo "stopping server..." >>$LOG
test -f zebrasrv.pid || exit 1
kill `cat zebrasrv.pid` || exit 1
rm -f zebrasrv.pid
#!/bin/sh
-# $Id: test2.sh,v 1.6 2003-05-21 14:39:22 adam Exp $
-echo "Testing with storekeys (zebra2.cfg)"
-echo "init..."
-rm -f idx.log log
+# $Id: test2.sh,v 1.7 2003-05-24 22:34:48 adam Exp $
+
+LOG=test2.log
+
+rm -f $LOG
+echo "init..." >>$LOG
rm -f records/esdd000[12].grs # these should not be here, will be created later
-../../index/zebraidx -l idx.log -c zebra2.cfg init || exit 1
+../../index/zebraidx -l $LOG -c zebra2.cfg init || exit 1
-echo "update 1..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo "update 1..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo "update 2..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo "update 2..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo "killing old server (if any)..."
+echo "killing old server (if any)..." >>$LOG
test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
-rm -f zebrasrv.pid
-rm -f srv.log
-echo "starting server..."
-../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
+echo "starting server..." >>$LOG
+../../index/zebrasrv -S -c zebra2.cfg -l $LOG tcp:@:9901 &
sleep 1
test -f zebrasrv.pid || exit 1
-echo "search 1..."
+echo "search 1..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 9$" log || exit 1
+grep "^Result count: 9$" log >/dev/null || exit 1
-echo "update 3..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo "update 3..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo "search 2..."
+echo "search 2..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 9$" log || exit 1
+grep "^Result count: 9$" log >/dev/null || exit 1
-echo "making test records..."
+echo "making test records..." >>$LOG
cp records/esdd0006.grs records/esdd0001.grs
-echo "indexing them..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo "indexing them..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo "search 3..."
+echo "search 3..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 10$" log || exit 1
+grep "^Result count: 10$" log >/dev/null || exit 1
touch records/esdd0001.grs
-echo "indexing again..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo "indexing again..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo "search 4..."
+echo "search 4..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 10$" log || exit 1
+grep "^Result count: 10$" log >/dev/null || exit 1
-echo "making another test record..."
+echo "making another test record..." >>$LOG
mv records/esdd0001.grs records/esdd0002.grs
-echo "indexing it too..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo "indexing it too..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo "search 5..."
+echo "search 5..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 10$" log || exit 1
+grep "^Result count: 10$" log >/dev/null || exit 1
sleep 1
-echo "modifying a test record..."
+echo "modifying a test record..." >>$LOG
sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
mv records/esdd0002x.grs records/esdd0002.grs
-echo "indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo "indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 1
-echo "search 6..."
+echo "search 6..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 9$" log || exit 1
+grep "^Result count: 9$" log >/dev/null || exit 1
-echo "search 7..."
+echo "search 7..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
-grep "^Result count: 1$" log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
-echo "stopping server..."
+echo "stopping server..." >>$LOG
test -f zebrasrv.pid || exit 1
kill `cat zebrasrv.pid` || exit 1
-rm -f idx.log log
+rm -f log
rm -f records/esdd000[12].grs
rm -f zebrasrv.pid
-rm -f srv.log
#!/bin/sh
-# $Id: timing1.sh,v 1.6 2003-05-21 14:39:22 adam Exp $
+# $Id: timing1.sh,v 1.7 2003-05-24 22:34:48 adam Exp $
# tests that updates are reflected immediately # in the registers.
# Repeatedly modifies a record and counts hits.
# Test 1: with good sleeps in every between - should pass always
-echo "Testing timings of updates"
-echo " init..."
-rm -f idx.log log
+LOG=timing1.log
+
+rm -f $LOG
+
+echo " init..." >>$LOG
rm -f records/esdd000[12].grs # these should not be here, will be created later
-../../index/zebraidx -c zebra2.cfg -l idx.log init || exit 1
+../../index/zebraidx -c zebra2.cfg -l $LOG init || exit 1
-echo " killing old server (if any)..."
+echo " killing old server (if any)..." >>$LOG
test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
-rm -f zebrasrv.pid
-rm -f srv.log
-echo " starting server..."
-../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
+echo " starting server..." >>$LOG
+../../index/zebrasrv -S -c zebra2.cfg -l $LOG tcp:@:9901 &
sleep 1
test -f zebrasrv.pid || exit 1
sleep 2
-echo " update 1..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " update 1..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 2
-echo " search 1..."
+echo " search 1..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 9$" log || exit 1
+grep "^Result count: 9$" log >/dev/null || exit 1
sleep 2
-echo "making a test record..."
+echo "making a test record..." >>$LOG
cp records/esdd0006.grs records/esdd0002.grs
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 2
-echo " search 2..."
+echo " search 2..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 10$" log || exit 1
+grep "^Result count: 10$" log >/dev/null || exit 1
sleep 2
-echo " 1a: modifying a test record (xyz)..."
+echo " 1a: modifying a test record (xyz)..." >>$LOG
sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
mv records/esdd0002x.grs records/esdd0002.grs
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 2
-echo " search 3..."
+echo " search 3..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-echo " checking..."
-grep "^Result count: 9$" log || exit 1
+echo " checking..." >>$LOG
+grep "^Result count: 9$" log >/dev/null || exit 1
sleep 2
-echo " 1b: modifying the test record back (utah)..."
+echo " 1b: modifying the test record back (utah)..." >>$LOG
sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
mv records/esdd0002x.grs records/esdd0002.grs
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 2
-echo " search 4..."
+echo " search 4..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-echo " checking..."
-grep "^Result count: 10$" log || exit 1
+echo " checking..." >>$LOG
+grep "^Result count: 10$" log >/dev/null || exit 1
sleep 2
-echo " 2a: modifying the test record (xyz)..."
+echo " 2a: modifying the test record (xyz)..." >>$LOG
sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
mv records/esdd0002x.grs records/esdd0002.grs
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 2
-echo " search 5..."
+echo " search 5..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-echo " checking..."
-grep "^Result count: 9$" log || exit 1
+echo " checking..." >>$LOG
+grep "^Result count: 9$" log >/dev/null || exit 1
sleep 2
-echo " 2b: modifying the test record back (utah)..."
+echo " 2b: modifying the test record back (utah)..." >>$LOG
sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
mv records/esdd0002x.grs records/esdd0002.grs
sleep 2
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 2
-echo " search 6..."
+echo " search 6..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-echo " checking..."
-grep "^Result count: 10$" log || exit 1
+echo " checking..." >>$LOG
+grep "^Result count: 10$" log >/dev/null || exit 1
sleep 2
-echo " 3a: modifying the test record (xyz)..."
+echo " 3a: modifying the test record (xyz)..." >>$LOG
sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
mv records/esdd0002x.grs records/esdd0002.grs
sleep 2
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 2
-echo " search 7..."
+echo " search 7..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-echo " checking..."
-grep "^Result count: 9$" log || exit 1
+echo " checking..." >>$LOG
+grep "^Result count: 9$" log >/dev/null || exit 1
sleep 2
-echo " 3b: modifying the test record back (utah)..."
+echo " 3b: modifying the test record back (utah)..." >>$LOG
sed 's/XYZ/UTAH/g' <records/esdd0002.grs >records/esdd0002x.grs
mv records/esdd0002x.grs records/esdd0002.grs
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
sleep 2
-echo " search 8..."
+echo " search 8..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-echo " checking..."
-grep "^Result count: 10$" log || exit 1
-
+echo " checking..." >>$LOG
+grep "^Result count: 10$" log >/dev/null || exit 1
-echo "stopping server..."
+echo "stopping server..." >>$LOG
test -f zebrasrv.pid || exit 1
kill `cat zebrasrv.pid` || exit 1
-rm -f idx.log log
+rm -f log
rm -f records/esdd000[12].grs
rm -f zebrasrv.pid
-rm -f srv.log
#!/bin/sh
-# $Id: timing2.sh,v 1.6 2003-05-21 14:39:22 adam Exp $
+# $Id: timing2.sh,v 1.7 2003-05-24 22:34:48 adam Exp $
# Demonstrated that updates depend on file timestamps
-echo "Testing timings of updates"
-echo " init..."
-rm -f idx.log log timeref[12]
+LOG=timing2.log
+
+rm -f $LOG
+
+echo " init..." >>$LOG
+rm -f log timeref[12]
rm -f records/esdd000[12].grs # these should not be here, will be created later
-../../index/zebraidx -c zebra2.cfg -l idx.log init || exit 1
+../../index/zebraidx -c zebra2.cfg -l $LOG init || exit 1
touch timeref1 # make an early timestamp
-echo " killing old server (if any)..."
+echo " killing old server (if any)..." >>$LOG
test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
-rm -f zebrasrv.pid
-rm -f srv.log
-echo " starting server..."
-../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
+echo " starting server..." >>$LOG
+../../index/zebrasrv -S -c zebra2.cfg -l $LOG tcp:@:9901 &
sleep 1
test -f zebrasrv.pid || exit 1
touch timeref2 # make a later timestamp
-echo " update 1..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " update 1..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo " search 1..."
+echo " search 1..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 9$" log || exit 1
+grep "^Result count: 9$" log >/dev/null || exit 1
-echo "making a test record..."
+echo "making a test record..." >>$LOG
cp records/esdd0006.grs records/esdd0002.grs
touch -r timeref1 records/esdd0002.grs
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo " search 2..."
+echo " search 2..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-grep "^Result count: 10$" log || exit 1
+grep "^Result count: 10$" log >/dev/null || exit 1
-echo " modifying a test record (xyz)..."
+echo " modifying a test record (xyz)..." >>$LOG
sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
mv records/esdd0002x.grs records/esdd0002.grs
touch -r timeref1 records/esdd0002.grs # reset timestamp to 'early'
-echo " not indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " not indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo " search 3..."
+echo " search 3..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-echo " checking..."
-grep "^Result count: 10$" log || exit 1
+echo " checking..." >>$LOG
+grep "^Result count: 10$" log >/dev/null || exit 1
-echo " touching its timestamp..."
+echo " touching its timestamp..." >>$LOG
touch -r timeref2 records/esdd0002.grs # set timestamp to 'late'
-echo " indexing it..."
-../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
+echo " indexing it..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra2.cfg update records || exit 1
-echo " search 4..."
+echo " search 4..." >>$LOG
../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
-echo " checking..."
-grep "^Result count: 9$" log || exit 1
+echo " checking..." >>$LOG
+grep "^Result count: 9$" log >/dev/null || exit 1
-echo "stopping server..."
+echo "stopping server..." >>$LOG
test -f zebrasrv.pid || exit 1
kill `cat zebrasrv.pid` || exit 1
-rm -f idx.log log timeref[12]
+rm -f log timeref[12]
rm -f records/esdd000[12].grs
rm -f zebrasrv.pid
-rm -f srv.log