X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=tests%2Fcomparison_tests%2Fqizx.sh;fp=tests%2Fcomparison_tests%2Fqizx.sh;h=763ed53b87a13f04fd9435e1bbafde3b6b867e5c;hb=adbae5267917033dec93e753bbc81272d16ab218;hp=0000000000000000000000000000000000000000;hpb=8f5b2f0c7e95245c1b7f4cc18aa137ba8e784166;p=SXSI%2Fxpathcomp.git diff --git a/tests/comparison_tests/qizx.sh b/tests/comparison_tests/qizx.sh new file mode 100755 index 0000000..763ed53 --- /dev/null +++ b/tests/comparison_tests/qizx.sh @@ -0,0 +1,165 @@ +#!/bin/bash +QIZX="/raid0/kn/qizx/qizx-fe-4.1p1/bin/qizx.alarm" + +source utils.sh + +function stop_qizx() { + sleep 2 +# rm -rf mat.xq count.xq + QIZXPIDS=`ps xwww --format "%p,%a" | grep java | grep qizx | cut -f 1 -d ' '` + for i in $QIZXPIDS + do + kill -TERM "$i" + sleep 2 + KILLED=`ps aux | grep '^'$i` + if [ "$KILLED" ] + then + kill -9 "$i" + fi + sleep 3 + rm -f /raid0/kn/qizxlib/*/lock + while true + do + o=/raid0/kn/qizx/qizx-fe-4.1p1/bin/qizx -g /raid0/kn/qizxlib/ -l xmark -check /tmp/log >/dev/null 2>&1 + sleep 2 + if [ -z "$o" ] + then + break + fi + done + done + +} + +trap stop_qizx INT TERM + +function do_qizx() { + + stop_qizx + + query="$1" + doc=`basename "$2"` + repeat="$3" + count="$4" + echo 'let $doc := collection("'"$doc"'") return count($doc'"$query"')' > count.xq + echo 'let $doc := collection("'"$doc"'") return $doc'"$query" > mat.xq + + IT=0 + while true + do + OUTPUT=`$QIZX -g /raid0/kn/qizxlib/ -l xmark count.xq 2>&1` + if echo "$OUTPUT" | grep -q 'java' >/dev/null 2>&1 + then + if [ "$IT" = 5 ] + then + break + fi + IT=$(($IT + 1)) + continue + fi + + { + read count; + } < <(echo "$OUTPUT") + + stop_qizx + sleep 3 + tmp=`echo "$count" | grep -o '[0-9.]\+'` + if [ "$tmp" = "$count" ] + then + break + fi + done + + IT=0 + while true + do + + OUTPUT=`$QIZX -g /raid0/kn/qizxlib/ -l xmark -r "$repeat" count.xq 2>&1` + if echo "$OUTPUT" | grep -q 'java' >/dev/null 2>&1 + then + if [ "$IT" = 5 ] + then + break + fi + IT=$(($IT + 1)) + continue + fi + + { + read time_count; + } < <(echo "$OUTPUT" | grep 'display time' | cut -f 3 -d : | grep -o '[0-9]\+'| tail -n +1 | average ) + + + stop_qizx + sleep 3 + if [ -z "$time_count" ] + then + break + fi + tmp=`echo "$time_count" | grep -o '[0-9.]\+'` + if [ "$tmp" = "$time_count" ] + then + break + fi + done + + IT=0 + if [ -z "$count" ] + then + + while true + do + OUTPUT=`$QIZX -g /raid0/kn/qizxlib/ -l xmark -r "$repeat" mat.xq -out /dev/null 2>&1` + if echo "$OUTPUT" | grep -q 'java' >/dev/null 2>&1 + then + if [ "$IT" = 5 ] + then + break + fi + IT=$(($IT + 1)) + continue + fi + + { + read time_mat; + } < <(echo "$OUTPUT" 2>&1 | grep 'display time' | cut -f 3 -d : | grep -o '[0-9]\+'| tail -n +1 | average) + + stop_qizx + sleep 3 + if [ -z "$time_mat" ] + then + break + fi + + + tmp=`echo "$time_mat" | grep -o '[0-9.]\+'` + if [ "$tmp" = "$time_mat" ] + then + break + fi + done + else + time_mat="999999" + fi + + echo $time_count + echo 0 + echo $time_mat + echo $count + +} + +#UGLY HACK TO TRICK QIZX EVALUATION VERSION +# OLD_DATE=`date +"%m/%d/%Y"` + +# function reset_time() { +# CUR_TIME=`date +"%H:%M:%S"` +# sudo date -s "$OLD_DATE $CUR_TIME" >/dev/null 2>&1 +# } +# trap reset_time INT TERM + +#CUR_TIME=`date +"%H:%M:%S"` +#sudo date -s "03/11/2011 $CUR_TIME" >/dev/null 2>&1 +do_qizx "$@" +#reset_time