Add tests for parallel query evaluation.
authorKim Nguyễn <kn@lri.fr>
Wed, 24 Jul 2013 09:49:53 +0000 (11:49 +0200)
committerKim Nguyễn <kn@lri.fr>
Wed, 24 Jul 2013 09:49:53 +0000 (11:49 +0200)
Remakefile.in

index 1416beb..e599827 100644 (file)
@@ -160,21 +160,28 @@ distclean: clean test_clean
 test:
        for i in tests/*.xml
        do
-               $(REMAKE) "$i".summary
+         for j in 1 2
+         do
+               $(REMAKE) "$i".test"$j".summary
+         done
        done
 
 test_clean:
        rm -rf tests/*.summary tests/*.results/*_"$(PACKAGE)".*
 
-%.summary:
-               base=`dirname "$@"`/`basename "$@" .xml.summary`
+%.test1.summary:
+               base="$@"
+               base=${base%.xml.test1.summary}
                $(REMAKE) "$base".xml "$base".xml.queries tools "$(BIN)"
                rm -f "$@"
+               MSG="Test 1 (single query: tatoo vs java implementation)" 
+               echo "$MSG" >> "$@"
+               echo "$MSG"
                cat "$base".xml.queries | grep -v '^#' | while read q query; do
                        echo -n "$base"".xml $q $query ... "
                        REF="$base".xml.results/"$q"_jaxp.xml
                        $(REMAKE) "$REF"
-                       OUTPUT="$base".xml.results/"$q"_"$(PACKAGE)".xml
+                       OUTPUT="$base".xml.results/"$q"_"$(PACKAGE)"_test1.xml
                        LOG="$base".xml.results/"$q"_"$(PACKAGE)".log
                        src/@PACKAGE_TARNAME@.native@EXE@ -s -d "$base".xml \
                                "$query" -o "$OUTPUT" > "$LOG" 2>&1
@@ -191,3 +198,37 @@ test_clean:
                        fi
                        echo '-------------------------------------------' >> "$@"
                done
+
+%.test2.summary:
+               base="$@"
+               base=${base%.xml.test2.summary}
+               $(REMAKE) "$base".xml "$base".xml.queries tools "$(BIN)"
+               rm -f "$@"
+               MSG="Test 2 (all queries sequentially vs all queries in parallel)"
+               echo "$MSG" >> "$@"
+               echo "$MSG"
+               allqueries=`cat "$base".xml.queries | grep -v '^#' | while read q query; do echo "'$query'"; done`
+               echo -n "Running all queries ... "
+               OUTPUTA="$base".xml.results/test2a_"$(PACKAGE)".xml
+               LOG="$base".xml.results/test2a_"$(PACKAGE)".log
+               echo -n "sequential ... "
+               echo "$allqueries" | xargs src/@PACKAGE_TARNAME@.native@EXE@ -s -d "$base".xml \
+                -o "$OUTPUTA" > "$LOG" 2>&1
+               cat  "$LOG" | grep '^STATS' >> "$@"
+
+               OUTPUTB="$base".xml.results/test2b_"$(PACKAGE)".xml
+               LOG="$base".xml.results/test2b_"$(PACKAGE)".log
+               echo -n "parallel ... "
+               echo "$allqueries" | xargs src/@PACKAGE_TARNAME@.native@EXE@ -p -s -d "$base".xml \
+                -o "$OUTPUTB" > "$LOG" 2>&1
+               cat  "$LOG" | grep '^STATS' >> "$@"
+                       echo -n "Diff: " >> "$@"
+               if diff "$OUTPUTA" "$OUTPUTB" >/dev/null 2>&1; then
+                       echo ok
+                       echo ok >> "$@"
+               else
+                       echo failed
+                       echo failed >> "$@"
+                       exit 1
+               fi
+               echo '-------------------------------------------' >> "$@"