Rework test scripts
[SXSI/xpathcomp.git] / tests / non_regression_tests / test_cache.sh
diff --git a/tests/non_regression_tests/test_cache.sh b/tests/non_regression_tests/test_cache.sh
new file mode 100755 (executable)
index 0000000..de275a7
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+source utils.sh
+DOC="$2"
+cat "$1" | grep -v '^#' | while read line 
+do
+    QNAME=`echo "$line" | cut -f 1 -d '%'`
+    QUERY=`echo "$line" | cut -f 2 -d '%'`
+    echo -n "$QNAME",
+    for mode in "-nc -nj" "-nc" "-nj" ""
+    do
+       output=`../../main.native -r "4" $mode -c "$DOC" "$QUERY" 2>&1`
+       #echo "$output"
+       time=`echo "$output" | grep "Execution time" | cut -f 2 -d',' | cut -f1 -d ':' | grep -o '[0-9.]*'`
+       TIME_COUNT=`echo "$time" | tail -n +2 | average`
+       echo -n "$TIME_COUNT"
+       if [ -z "$mode" ]
+       then
+           echo
+       else
+           echo -n ","
+       fi
+    done
+done