Implement set-theoretic operation on 2WSATA (union, intersection,
[tatoo.git] / Remakefile.in
index 3fa1d73..f8552fe 100644 (file)
@@ -51,7 +51,7 @@ clean:
        done
 
 distclean: clean test_clean
-       rm -rf config.status configure config.log autom4te.cache .remake Remakefile remake
+       rm -rf config.status configure config.log autom4te.cache .remake Remakefile remake Makefile
 
 %.class: %.java
        javac $<
@@ -92,17 +92,22 @@ distclean: clean test_clean
        . tools/ocamldriver.sh
 
 %.cmi:
-       $(REMAKE) $*.mli
-       if test -z "$(OCAMLNATIVE)"; then
-               $(OCAMLC) -c $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDFLAGS) $(PACKINCLUDE) $*.mli
+       base=$*
+       target=$@
+       NATIVE=$(OCAMLNATIVE)
+       REMAKE="$(REMAKE) -v OCAMLNATIVE=$NATIVE"
+       OCAMLDEP="$(OCAMLDEP) $(OCAMLFINDFLAGS)"
+       SRC=$(SRC)
+       if test -z "$NATIVE"; then
+               COMPILE="$(OCAMLC) $(OCAMLFLAGS) $(OCAMLCFLAGS) $(OCAMLFINDFLAGS)"
        else
-               $(OCAMLOPT) -c $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDFLAGS) $(PACKINCLUDE) $*.mli
-
+               COMPILE="$(OCAMLOPT) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) $(OCAMLFINDFLAGS)"
        fi
+       . tools/ocamldriver.sh
 
 ## Tests
 
-test: tools $(BIN)
+test:
        for i in tests/*.xml
        do
          for j in 1 2 3
@@ -114,106 +119,16 @@ test: tools $(BIN)
 test_clean:
        rm -rf tests/*.summary tests/*.results/*_"$(PACKAGE)"_*.*
 
-%.test1.summary:
-               base="$@"
-               base=${base%.xml.test1.summary}
-               $(REMAKE) "$base".xml "$base".xml.queries
-               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)"_test1.xml
-                       LOG="$base".xml.results/"$q"_"$(PACKAGE)"_test1.log
-                       cp "$@" /tmp
-                       src/@PACKAGE_TARNAME@.native@EXE@ -s -d "$base".xml \
-                               "$query" -o "$OUTPUT" > "$LOG" 2>&1
-                       cp "$@" /tmp
-                       echo "Query: $q : $query" >> "$@"
-                       cat  "$LOG" | grep '^STATS' >> "$@"
-                       echo -n "Diff: " >> "$@"
-                       if tools/xml_diff.native "$REF" "$OUTPUT" >/dev/null 2>&1; then
-                               echo ok
-                               echo ok >> "$@"
-                       else
-                               echo failed
-                               echo failed >> "$@"
-                               exit 1
-                       fi
-                       echo '-------------------------------------------' >> "$@"
-               done
-
-%.test2.summary:
-               base="$@"
-               base=${base%.xml.test2.summary}
-               $(REMAKE) "$base".xml "$base".xml.queries
-               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 '-------------------------------------------' >> "$@"
-
-%.test3.summary:
-               base="$@"
-               base=${base%.xml.test3.summary}
-               $(REMAKE) "$base".xml "$base".xml.queries
-               rm -f "$@"
-               MSG="Test 3 (multiple queries composition: sequential vs parallel)"
-               echo "$MSG" >> "$@"
-               echo "$MSG"
-               cat "$base".xml.queries | grep -v '^#' | while read q query; do
-                       echo -n "$base"".xml $q $query ... sequential ... "
-                       OUTPUTA="$base".xml.results/"$q"_"$(PACKAGE)"_test3a.xml
-                       LOG="$base".xml.results/"$q"_"$(PACKAGE)"_test3a.log
-                       src/@PACKAGE_TARNAME@.native@EXE@ -s -d -C "$base".xml \
-                                -o "$OUTPUTA" $(tools/split_path.native$(EXE) "$query") > "$LOG" 2>&1
-                       echo "Query: $q : $query" >> "$@"
-                       cat  "$LOG" | grep '^STATS' >> "$@"
-
-                       echo -n "parallel ... "
-                       OUTPUTB="$base".xml.results/"$q"_"$(PACKAGE)"_test3a.xml
-                       LOG="$base".xml.results/"$q"_"$(PACKAGE)"_test3a.log
-                       src/@PACKAGE_TARNAME@.native@EXE@ -s -d -p -C "$base".xml \
-                                -o "$OUTPUTB" $(tools/split_path.native$(EXE) "$query") > "$LOG" 2>&1
-                       echo "Query: $q : $query" >> "$@"
-                       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 '-------------------------------------------' >> "$@"
-               done
+%.summary:  tools $(BIN)
+               target=$@
+               base=$*
+               test=${base#*.xml.}
+               xml=${base%.$test}
+               REMAKE=$(REMAKE)
+               BIN=$(BIN)
+               SPLIT=tools/split_path.native$(EXE)
+               XMLDIFF=tools/xml_diff.native$(EXE)
+               PACKAGE=$(PACKAGE)
+               $REMAKE $xml ${xml}.queries tests/${test}.sh
+               rm -f "$target"
+               . tests/${test}.sh