bypassing checks when running make distcheck
[idzebra-moved-to-github.git] / test / gils / timing2.sh
1 #!/bin/sh
2 # $Id: timing2.sh,v 1.13 2006-04-27 10:52:27 marc Exp $ 
3 # Demonstrated that updates depend on file timestamps
4
5 srcdir=${srcdir:-"."}
6
7 if [ "$srcdir" != "." ]
8     then
9     echo "Jumping over test"
10     exit 0
11 fi
12
13 LOG=timing2.log
14
15 rm -f $LOG
16
17 echo "  init..." >>$LOG
18 rm -f log timeref[12]
19 # these should not be here, will be created later
20 $srcdir/cleanrecords.sh
21
22 ../../index/zebraidx -c $srcdir/zebra2.cfg -l $LOG init || exit 1
23 touch timeref1  # make an early timestamp
24
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
28 sleep 1
29 touch timeref2  # make a later timestamp
30
31 echo "  update 1..." >>$LOG
32 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
33
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
37
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
41
42 echo "  indexing it..." >>$LOG
43 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
44
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
48
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'
53
54 echo "    not indexing it..." >>$LOG
55 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
56
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
61
62 echo "  touching its timestamp..." >>$LOG
63 touch -r timeref2 $srcdir/records/esdd0002.grs # set timestamp to 'late'
64
65 echo "    indexing it..." >>$LOG
66 ../../index/zebraidx -l $LOG -c $srcdir/zebra2.cfg update $srcdir/records || exit 1
67
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
72
73 echo "stopping server..." >>$LOG
74 test -f z.pid || exit 1
75 kill `cat z.pid` || exit 1
76 rm -f log timeref[12]
77 $srcdir/cleanrecords.sh
78 rm -f z.pid
79