2 # $Id: timing2.sh,v 1.12 2005-01-03 12:08:04 adam Exp $
3 # Demonstrated that updates depend on file timestamps
11 echo " init..." >>$LOG
13 rm -f $pp/records/esdd000[12].grs # these should not be here, will be created later
14 ../../index/zebraidx -c $pp/zebra2.cfg -l $LOG init || exit 1
15 touch timeref1 # make an early timestamp
17 echo " starting server..." >>$LOG
18 ../../index/zebrasrv -D -p z.pid -S -c $pp/zebra2.cfg -l $LOG unix:socket
19 test -f z.pid || exit 1
21 touch timeref2 # make a later timestamp
23 echo " update 1..." >>$LOG
24 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
26 echo " search 1..." >>$LOG
27 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
28 grep "^Result count: 9$" log >/dev/null || exit 1
30 echo "making a test record..." >>$LOG
31 cp $pp/records/esdd0006.grs $pp/records/esdd0002.grs
32 touch -r timeref1 $pp/records/esdd0002.grs
34 echo " indexing it..." >>$LOG
35 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
37 echo " search 2..." >>$LOG
38 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
39 grep "^Result count: 10$" log >/dev/null || exit 1
41 echo " modifying a test record (xyz)..." >>$LOG
42 sed 's/UTAH/XYZ/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
43 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
44 touch -r timeref1 $pp/records/esdd0002.grs # reset timestamp to 'early'
46 echo " not indexing it..." >>$LOG
47 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
49 echo " search 3..." >>$LOG
50 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
51 echo " checking..." >>$LOG
52 grep "^Result count: 10$" log >/dev/null || exit 1
54 echo " touching its timestamp..." >>$LOG
55 touch -r timeref2 $pp/records/esdd0002.grs # set timestamp to 'late'
57 echo " indexing it..." >>$LOG
58 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
60 echo " search 4..." >>$LOG
61 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
62 echo " checking..." >>$LOG
63 grep "^Result count: 9$" log >/dev/null || exit 1
65 echo "stopping server..." >>$LOG
66 test -f z.pid || exit 1
67 kill `cat z.pid` || exit 1
69 rm -f $pp/records/esdd000[12].grs