2 # $Id: timing2.sh,v 1.13 2006-04-27 10:52:27 marc Exp $
3 # Demonstrated that updates depend on file timestamps
7 if [ "$srcdir" != "." ]
9 echo "Jumping over test"
17 echo " init..." >>$LOG
19 # these should not be here, will be created later
20 $srcdir/cleanrecords.sh
22 ../../index/zebraidx -c $srcdir/zebra2.cfg -l $LOG init || exit 1
23 touch timeref1 # make an early timestamp
25 echo " starting server..." >>$LOG
26 ../../index/zebrasrv -D -p z.pid -S -c $srcdir/zebra2.cfg -l $LOG unix:socket
27 test -f z.pid || exit 1
29 touch timeref2 # make a later timestamp
31 echo " update 1..." >>$LOG
32 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
34 echo " search 1..." >>$LOG
35 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
36 grep "^Result count: 9$" log >/dev/null || exit 1
38 echo "making a test record..." >>$LOG
39 cp $srcdir/records/esdd0006.grs $srcdir/records/esdd0002.grs
40 touch -r timeref1 $srcdir/records/esdd0002.grs
42 echo " indexing it..." >>$LOG
43 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
45 echo " search 2..." >>$LOG
46 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
47 grep "^Result count: 10$" log >/dev/null || exit 1
49 echo " modifying a test record (xyz)..." >>$LOG
50 sed 's/UTAH/XYZ/g' <$srcdir/records/esdd0002.grs >$srcdir/records/esdd0002x.grs
51 mv $srcdir/records/esdd0002x.grs $srcdir/records/esdd0002.grs
52 touch -r timeref1 $srcdir/records/esdd0002.grs # reset timestamp to 'early'
54 echo " not indexing it..." >>$LOG
55 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
57 echo " search 3..." >>$LOG
58 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
59 echo " checking..." >>$LOG
60 grep "^Result count: 10$" log >/dev/null || exit 1
62 echo " touching its timestamp..." >>$LOG
63 touch -r timeref2 $srcdir/records/esdd0002.grs # set timestamp to 'late'
65 echo " indexing it..." >>$LOG
66 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
68 echo " search 4..." >>$LOG
69 ../api/testclient unix:socket "@attr 1=4 utah" > log || exit 1
70 echo " checking..." >>$LOG
71 grep "^Result count: 9$" log >/dev/null || exit 1
73 echo "stopping server..." >>$LOG
74 test -f z.pid || exit 1
75 kill `cat z.pid` || exit 1
77 $srcdir/cleanrecords.sh