Add tests for wordbased index.
[SXSI/xpathcomp.git] / tests / non_regression_tests / sxsi.sh
1 #!/bin/bash
2
3 source utils.sh
4
5 function do_sxsi() {
6     query="$1"
7     count="$4"
8     doc=`basename "$2" .xml`.srx
9     repeat="$3"
10     TIME_MAT=""
11     TIME_COUNT=""
12     TIME_PRINT=""
13     NUM_RESULTS=""
14     output=`./main.native -r "$3" -c -b "$doc" "$query" 2>&1`
15     echo "$output" >> sxsi_debug.log
16     NUM_RESULT=`echo "$output" | grep "Number of results" | grep -o '[0-9]*'`
17     time=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | cut -f1 -d ':' | grep -o '[0-9.]*'`
18     TIME_COUNT=`echo "$time" | tail -n +2 | average`
19     if [ -z "$count" ]
20     then
21         output=`./main.native -b -r "$3" "$doc" "$query" /dev/null 2>&1`
22         mtime=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | cut -f1 -d ':'| grep -o '[0-9.]*'`
23         ptime=`echo "$output" | grep 'Serialization time' | cut -f 3 -d ' ' | grep -o '[0-9.]*'`
24         TIME_MAT=`echo "$mtime" | tail -n +2 | average`
25         TIME_PRINT="$ptime"
26     else
27         TIME_MAT="999999"
28         TIME_PRINT="0"
29     fi
30
31     echo "$TIME_COUNT"
32     echo "$TIME_MAT"
33     echo "$TIME_PRINT"
34     echo $NUM_RESULT
35 }
36
37 do_sxsi "$@"