Rename the main program.
-src/main.native
+src/tatoo.native
tools/xml_diff.native
tools/XPathEval.class
+++ /dev/null
-(***********************************************************************)
-(* *)
-(* TAToo *)
-(* *)
-(* Kim Nguyen, LRI UMR8623 *)
-(* Université Paris-Sud & CNRS *)
-(* *)
-(* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
-(* Recherche Scientifique. All rights reserved. This file is *)
-(* distributed under the terms of the GNU Lesser General Public *)
-(* License, with the special exception on linking described in file *)
-(* ../LICENSE. *)
-(* *)
-(***********************************************************************)
-
-(*
- Time-stamp: <Last modified on 2013-03-13 21:29:17 CET by Kim Nguyen>
-*)
-
-let doc =
- let fd = open_in Sys.argv.(1) in
- let d = Tree.Naive.load_xml_file fd in
- close_in fd; d
-
-
-let query =
- let arg2 = Sys.argv.(2) in
- Xpath.Parser.parse (Ulexing.from_latin1_string arg2)
-
-let auto =
- Xpath.Compile.path query
-
-open Format
-
-let () =
- fprintf err_formatter "Query: %a\n%!" Xpath.Ast.print_path query;
- fprintf err_formatter "Automata: %a\n%!" Auto.Ata.print auto;
- fprintf err_formatter "Evaluating automaton:\n%!";
- let module Naive = Auto.Eval.Make(Tree.Naive) in
- let t1 = Unix.gettimeofday() in
- let results = Naive.eval auto doc (Tree.Naive.root doc) in
- let teval = (Unix.gettimeofday () -. t1) *. 1000. in
- let t1 = Unix.gettimeofday () in
- output_string stdout "<xml_result>\n";
- List.iter (fun n ->
- Tree.Naive.print_xml stdout doc n;
- output_char stdout '\n'
- ) results;
- output_string stdout "</xml_result>\n";
- let tprint = (Unix.gettimeofday () -. t1) *. 1000. in
- flush stdout;
- fprintf err_formatter "evaluation time: %fms\nserialization time: %fms\n%!" teval tprint
--- /dev/null
+(***********************************************************************)
+(* *)
+(* TAToo *)
+(* *)
+(* Kim Nguyen, LRI UMR8623 *)
+(* Université Paris-Sud & CNRS *)
+(* *)
+(* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
+(* Recherche Scientifique. All rights reserved. This file is *)
+(* distributed under the terms of the GNU Lesser General Public *)
+(* License, with the special exception on linking described in file *)
+(* ../LICENSE. *)
+(* *)
+(***********************************************************************)
+
+(*
+ Time-stamp: <Last modified on 2013-03-13 21:29:17 CET by Kim Nguyen>
+*)
+
+let doc =
+ let fd = open_in Sys.argv.(1) in
+ let d = Tree.Naive.load_xml_file fd in
+ close_in fd; d
+
+
+let query =
+ let arg2 = Sys.argv.(2) in
+ Xpath.Parser.parse (Ulexing.from_latin1_string arg2)
+
+let auto =
+ Xpath.Compile.path query
+
+open Format
+
+let () =
+ fprintf err_formatter "Query: %a\n%!" Xpath.Ast.print_path query;
+ fprintf err_formatter "Automata: %a\n%!" Auto.Ata.print auto;
+ fprintf err_formatter "Evaluating automaton:\n%!";
+ let module Naive = Auto.Eval.Make(Tree.Naive) in
+ let t1 = Unix.gettimeofday() in
+ let results = Naive.eval auto doc (Tree.Naive.root doc) in
+ let teval = (Unix.gettimeofday () -. t1) *. 1000. in
+ let t1 = Unix.gettimeofday () in
+ output_string stdout "<xml_result>\n";
+ List.iter (fun n ->
+ Tree.Naive.print_xml stdout doc n;
+ output_char stdout '\n'
+ ) results;
+ output_string stdout "</xml_result>\n";
+ let tprint = (Unix.gettimeofday () -. t1) *. 1000. in
+ flush stdout;
+ fprintf err_formatter "evaluation time: %fms\nserialization time: %fms\n%!" teval tprint
--- /dev/null
+#!/bin/sh
+
+usage() {
+ echo "error: missing input, query file"
+ echo "usage: $0 file.xml"
+}
+
+FILE="$1"
+RESULTS="$FILE".results
+QUERIES="$FILE".queries
+
+if test ! -f "$FILE" -o ! -f "$QUERIES"
+then
+ usage;
+ exit 1
+fi
+
+
+mkdir -p "$RESULTS"
+
+cat "$QUERIES" | grep -v '^#' | while read qname q
+do
+ echo "Computing $q"
+ java -cp _build/tools XPathEval "$FILE" "$q" > "$RESULTS"/"$qname"_jaxp.xml 2> "$RESULTS"/"$qname"_jaxp.log
+done
--- /dev/null
+#!/bin/sh
+
+TESTPROG="./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
+
+
+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
+++ /dev/null
-#!/bin/sh
-
-TESTPROG="./main.native"
-
-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" -o ! -f xml_diff.native
-then
- usage;
- exit 1
-fi
-
-
-mkdir -p "$RESULTS"
-
-cat "$QUERIES" | grep -v '^#' | ( TOTAL=0; TESTS=0;
-while read qname q
-do
- TOTAL=$(($TOTAL + 1))
- echo -n "Testing $qname: $q ... "
- "$TESTPROG" "$FILE" "$q" > "$RESULTS"/"$qname"_test.xml 2> "$RESULTS"/"$qname"_test.log
- ./xml_diff.native "$RESULTS"/"$qname"_test.xml "$RESULTS"/"$qname".xml 2>> "$RESULTS"/"$qname"_test.log
- case "$?" in
- 0)
- TESTS=$(($TESTS + 1))
- echo ok
- ;;
- *)
- echo failed
- # echo ------- output -----------
- # cat "$RESULTS"/"$qname".xml
- # echo ==========================
- # cat "$RESULTS"/"$qname"_test.xml
- # echo --------------------------
- ;;
- esac
-done;
-echo "Summary: $TESTS/$TOTAL tests successfull"
-)
+++ /dev/null
-#!/bin/sh
-
-usage() {
- echo "error: missing input, query file"
- echo "usage: $0 file.xml"
-}
-
-FILE="$1"
-RESULTS="$FILE".results
-QUERIES="$FILE".queries
-
-if test ! -f "$FILE" -o ! -f "$QUERIES"
-then
- usage;
- exit 1
-fi
-
-
-mkdir -p "$RESULTS"
-
-cat "$QUERIES" | grep -v '^#' | while read qname q
-do
- echo "Computing $q"
- java -cp _build/tools XPathEval "$FILE" "$q" > "$RESULTS"/"$qname".xml 2> "$RESULTS"/"$qname".log
-done
--- /dev/null
+#!/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 time
+ N="$N_$p"
+ D="$D $doc".results/"$qname"_"$p".xml
+ done
+ echo -n "Diff ... "
+ ./xml_diff.native $D > "$doc".results/"$qname""$N".diff 2>&1
+ case "$?" in
+ "0")
+ echo "ok"
+ ;;
+ *)
+ echo "failed"
+ ;;
+ esac
+ echo "-------------------------------------------"
+ done
+ fi
+
+
+done