f1948ea555fa7ffc703806552a24cceec7d01696
[SXSI/xpathcomp.git] / tests / non_regression_tests / sxsi.sh
1 #!/bin/bash
2
3 function do_sxsi() {
4     query="$1"
5     doc=`basename "$2" .xml`.srx
6     repeat="$3"
7     TIME_MAT=""
8     TIME_COUNT=""
9     TIME_PRINT=""
10     NUM_RESULTS=""
11     output=`./main.native -v -c -b "$doc" "$query" 2>&1`
12     echo "$output" >> sxsi_debug.log
13     NUM_RESULT=`echo "$output" | grep "Number of nodes " | grep -o '[0-9]*'`
14     time=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | grep -o '[0-9.]*'`
15     TIME_COUNT=`echo "$time" | sort -g | head -1`
16
17     output=`./main.native -b "$doc" "$query" /dev/null 2>&1`
18     mtime=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | grep -o '[0-9.]*'`
19     ptime=`echo "$output" | grep "Serializing" | grep -o '[0-9.]*'`
20     TIME_MAT=`echo "$mtime" | sort -g | head -1`
21     TIME_PRINT="$ptime"
22
23     echo "$TIME_COUNT" 
24     echo "$TIME_MAT" 
25     echo "$TIME_PRINT"
26     echo $NUM_RESULT
27 }
28
29 do_sxsi "$@"