Merge branch 'local-ocamlbuild' into local-trunk
[SXSI/xpathcomp.git] / tests / non_regression_tests / sxsi.sh
diff --git a/tests/non_regression_tests/sxsi.sh b/tests/non_regression_tests/sxsi.sh
new file mode 100755 (executable)
index 0000000..f1948ea
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+function do_sxsi() {
+    query="$1"
+    doc=`basename "$2" .xml`.srx
+    repeat="$3"
+    TIME_MAT=""
+    TIME_COUNT=""
+    TIME_PRINT=""
+    NUM_RESULTS=""
+    output=`./main.native -v -c -b "$doc" "$query" 2>&1`
+    echo "$output" >> sxsi_debug.log
+    NUM_RESULT=`echo "$output" | grep "Number of nodes " | grep -o '[0-9]*'`
+    time=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | grep -o '[0-9.]*'`
+    TIME_COUNT=`echo "$time" | sort -g | head -1`
+
+    output=`./main.native -b "$doc" "$query" /dev/null 2>&1`
+    mtime=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | grep -o '[0-9.]*'`
+    ptime=`echo "$output" | grep "Serializing" | grep -o '[0-9.]*'`
+    TIME_MAT=`echo "$mtime" | sort -g | head -1`
+    TIME_PRINT="$ptime"
+
+    echo "$TIME_COUNT" 
+    echo "$TIME_MAT" 
+    echo "$TIME_PRINT"
+    echo $NUM_RESULT
+}
+
+do_sxsi "$@"