From: Kim Nguyễn Date: Mon, 22 Apr 2013 16:20:49 +0000 (+0200) Subject: Use the Remakefile to perform non-regression tests. X-Git-Tag: v0.1~92 X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=commitdiff_plain;h=ebe172413cade8d324561a0279b9b8017b9a2fc0 Use the Remakefile to perform non-regression tests. --- diff --git a/Remakefile.in b/Remakefile.in index 2903e3e..355b643 100644 --- a/Remakefile.in +++ b/Remakefile.in @@ -146,3 +146,36 @@ distclean: clean @REMAKE@ -v PACKINCLUDE="$PACKINCLUDE" -v OCAMLDEPNATIVE="$OCAMLDEPNATIVE" -v OCAMLFORPACK="$OCAMLFORPACK" "$obj" fi +## Tests + +test_suite: tools src/@PACKAGE_TARNAME@.native@EXE@ + for i in tests/*.xml + do + @REMAKE@ "$i".summary + done + + +%.summary: + base="${1%.xml.summary}" + @REMAKE@ "$base".xml "$base".xml.queries + 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_TARNAME@.xml + LOG="$base".xml.results/"$q"_@PACKAGE_TARNAME@.log + src/@PACKAGE_TARNAME@.native@EXE@ -s "$base".xml \ + "$query" "$OUTPUT" > "$LOG" 2>&1 + echo "Query: $q : $query" > "$1" + cat "$LOG" | grep '^STATS' >> "$1" + echo -n "Diff: " >> "$1" + tools/xml_diff.native "$REF" "$OUTPUT" >/dev/null 2>&1 + if [ "$?" -eq 0 ]; then + echo ok + echo ok >> "$1" + else + echo failed + echo failed >> "$1" + fi + echo '-------------------------------------------' >> "$1" + done diff --git a/tests/alphabet.xml.summary b/tests/alphabet.xml.summary new file mode 100644 index 0000000..bf9f0ec --- /dev/null +++ b/tests/alphabet.xml.summary @@ -0,0 +1,11 @@ +Query: O4 : //L/ancestor::* | //L/descendant::* +STATS: Query: /descendant-or-self::node()/child::L/ancestor::* | /descendant-or-self::node()/child::L/descendant::* +STATS: Automaton: +STATS: evaluation time: 7.114887ms +STATS: serialization time: 0.150919ms +STATS: 1 iterations +STATS: automaton 0, cache2: 70 entries, cache6: 2345 entries +STATS: cache2: length: 105, used: 35, occupation: 0.333333 +STATS: cache4: length: 2543, used: 198, occupation: 0.077861 +Diff: ok +------------------------------------------- diff --git a/tests/comments00.xml.summary b/tests/comments00.xml.summary new file mode 100644 index 0000000..e04988d --- /dev/null +++ b/tests/comments00.xml.summary @@ -0,0 +1,11 @@ +Query: C0 : /descendant::comment() +STATS: Query: /descendant::comment() +STATS: Automaton: +STATS: evaluation time: 0.082016ms +STATS: serialization time: 0.002861ms +STATS: 1 iterations +STATS: automaton 0, cache2: 6 entries, cache6: 18 entries +STATS: cache2: length: 9, used: 3, occupation: 0.333333 +STATS: cache4: length: 27, used: 9, occupation: 0.333333 +Diff: ok +------------------------------------------- diff --git a/tests/xmark_small.xml.summary b/tests/xmark_small.xml.summary new file mode 100644 index 0000000..15df64b --- /dev/null +++ b/tests/xmark_small.xml.summary @@ -0,0 +1,11 @@ +Query: B13 : //keyword/ancestor::parlist/descendant::keyword/ancestor::parlist/descendant::keyword/ancestor::parlist/descendant::keyword +STATS: Query: /descendant-or-self::node()/child::keyword/ancestor::parlist/descendant::keyword/ancestor::parlist/descendant::keyword/ancestor::parlist/descendant::keyword +STATS: Automaton: +STATS: evaluation time: 294.135094ms +STATS: serialization time: 1.837015ms +STATS: 4 iterations +STATS: automaton 0, cache2: 0 entries, cache6: 2671 entries +STATS: cache2: length: 0, used: 0, occupation: -nan +STATS: cache4: length: 2984, used: 313, occupation: 0.104893 +Diff: ok +------------------------------------------- diff --git a/tools/do_tatoo.sh b/tools/do_tatoo.sh deleted file mode 100755 index f80df14..0000000 --- a/tools/do_tatoo.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -TESTPROG="src/tatoo.native" -VERSION="$(git log -1 --oneline | cut -f1 -d ' ' 2>/dev/null)" -if [ -z "$VERSION" ] -then - SUFFIX=tatoo -else - SUFFIX=tatoo_"$VERSION" -fi - -usage() { - echo "error: missing input, query file, xml_diff or $TESTPROG" - echo "usage: $0 file.xml" -} - -FILE="$1" -RESULTS="$FILE".results -QUERIES="$FILE".queries - -if test ! -f "$FILE" -o ! -f "$QUERIES" -o ! -f "$TESTPROG" -then - usage; - exit 1 -fi - -echo "Testing version: $VERSION" -mkdir -p "$RESULTS" - -cat "$QUERIES" | grep -v '^#' | while read qname q -do - echo -n "Testing $qname: $q ... " - "$TESTPROG" "$FILE" "$q" > "$RESULTS"/"$qname"_"$SUFFIX".xml 2> "$RESULTS"/"$qname"_"$SUFFIX".log - echo "ok" -done diff --git a/tools/gen_mlpack.sh b/tools/gen_mlpack.sh deleted file mode 100755 index 95f78ec..0000000 --- a/tools/gen_mlpack.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -cd src -echo `pwd` -for dir in * -do - if [ -d "$dir" ] - then - echo "$dir" - rm -f "$dir".mlpack - cd "$dir" - for i in *.ml *.mly *.mll - do - if [ ! -f "$i" ] - then - continue - fi - echo "$i" - f=`echo "$i" | cut -b1` - l=`basename "$i" .mll` - l=`basename "$l" .mly` - l=`basename "$l" .ml | cut -b2-` - o=`echo "$f" | tr a-z A-Z` - echo "$dir"/"$o""$l" >> ../"$dir".mlpack - done - cd .. - fi -done -cd .. \ No newline at end of file diff --git a/tools/gen_test_results.sh b/tools/gen_test_results.sh deleted file mode 100755 index b3d79e0..0000000 --- a/tools/gen_test_results.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -PROGS="$@" -for doc in tests/*.xml -do - if [ -f "$doc".queries ] - then - cat "$doc".queries | grep -v '^#' | while read qname q - do - D="" - N="" - echo "$qname" "$q" - for p in $PROGS - do - echo "$p": - cat "$doc".results/"$qname"_"$p".log | grep --color=never 'INFO\|time' - N="$N_$p" - D="$D $doc".results/"$qname"_"$p".xml - done - - echo -n "Diff ... " - DIFFILE="$doc".results/"$qname"_"$N".diff - ./tools/xml_diff.native $D > "$DIFFILE" 2>&1 - case "$?" in - "0") - echo "ok" - rm -f "$DIFFILE" - ;; - *) - echo "failed" - ;; - esac - echo "-------------------------------------------" - done - fi - - -done