-MLSRCS = benchmark.ml main.ml
+MLSRCS = benchmark.ml main.ml
MLISRCS = benchmark.mli
MLOBJS = $(MLSRCS:.ml=.cmx)
MLCINT = $(MLISRCS:.mli=.cmi)
-OCAMLPACKAGES = unix,str
+OCAMLPACKAGES = unix,str,camlp4
PPINCLUDES=$(OCAMLINCLUDES:%=-ppopt %)
OCAMLFIND = ocamlfind
OCAMLMKLIB = ocamlmklib
OCAMLDEP = ocamldep
-LINK=$(OCAMLOPT) -linkpkg
-
+LINK=$(OCAMLOPT) -linkpkg camlp4lib.cmxa
+SYNTAX=-syntax camlp4o -ppopt pa_macro.cmo
all: $(MLOBJS)
- $(OCAMLFIND) $(LINK) -o test_suite -package "$(OCAMLPACKAGES)" $(MLOBJS)
+ $(OCAMLFIND) $(LINK) -o test_suite -package "$(OCAMLPACKAGES)" $(SYNTAX) $(MLOBJS)
.SUFFIXES: .ml .mli .cmx .cmi
.PHONY: depend
depend: $(MLSRCS) $(MLISRCS)
- @ $(OCAMLFIND) $(OCAMLDEP) -package "$(OCAMLPACKAGES)" $(MLSRCS) $(MLISRCS) >depend
+ @$(OCAMLFIND) $(OCAMLDEP) -package "$(OCAMLPACKAGES)" $(SYNTAX) $(MLSRCS) $(MLISRCS) >depend
include depend
Array.iteri ( fun docnum (_,docsize) ->
let sres = [| (empty_stats()); (empty_stats()) |] in
Printf.printf "Running query %.2d on document %.2d :\n%!" qnum docnum;
- for j = (vb (not Conf.run_without_output)) to (vb Conf.run_with_output) do
- if j = 0 then Printf.printf "No output : \t%!"
- else Printf.printf "With output : \t%!";
- for i = 1 to Conf.num_runs do
- let s = extract(run_query false (j==1) qnum docnum qset) in
- if sres.(j).query_execution_time > s.query_execution_time
- then sres.(j) <- s;
- Printf.printf "pass %i ... %!" i;
+
+ for k = 0 to 1 do
+ for j = (vb (not Conf.run_without_output)) to (vb Conf.run_with_output) do
+ if j = 0 then Printf.printf "No output : \t%!"
+ else Printf.printf "With output : \t%!";
+ for i = 1 to Conf.num_runs do
+ let s = extract(run_query (k==1) (j==1) qnum docnum qset) in
+ if sres.(j).query_execution_time > s.query_execution_time
+ then sres.(j) <- s;
+ if (k==1) then
+ sres.(j).memory_usage <- s.memory_usage;
+ Printf.printf "pass %i ... %!" i;
+ done;
+ Printf.printf "Ok\n%!";
done;
- Printf.printf "Ok\n%!";
- done;
- Printf.printf "Monitoring memory use: ... %!";
- let s = extract(run_query true false qnum docnum qset)
- in
- sres.(1).memory_usage <- s.memory_usage;
- Printf.printf "Ok\n%!";
- let _ = Array.iteri (fun i s -> s.print_output <- (i==1);
- s.query <- qnum;
- s.input_document <- docnum;
- s.input_size <- docsize) sres
- in lres := sres::!lres
+ if (k == 0)
+ then Printf.printf "Monitoring memory use: ... \n%!";
+ done;
+ let _ = Array.iteri (fun i s -> s.print_output <- (i==1);
+ s.query <- qnum;
+ s.input_document <- docnum;
+ s.input_size <- docsize) sres
+ in lres := sres::!lres
) qset.documents
)qset.queries
in
--- /dev/null
+(* semi-colon separated list of input documents *)
+let documents = [ "../tests/base.xml" ]
+
+(* semi-colon separated list of XPath queries *)
+let queries = [ "/child::*"; "//*" ]
+
+
+(* I is the initial configuration
+ * MK (engine) (configuration) gives a new configuration
+ * valid engines are SXSI and SaxonBXQuery
+ * ex: if you only want to test SaxonBXQuery :
+ * module TEST = MK (SaxonBXQuery) (I)
+ *)
+
+module CONF : CONFIGURATION =
+struct
+ let path = "."
+ let result_basename = "test"
+ let num_runs = 5
+ let run_with_output = true
+ let run_without_output = true
+end
+
+module I = INIT_TESTER (CONF)
+
+module TEST = MK (SXSI) (MK (SaxonBXQuery) (I))
+
end
-module CONF : CONFIGURATION =
-struct
- let path = "."
- let result_basename = "test"
- let num_runs = 1
- let run_with_output = false
- let run_without_output = true
-end
-module I = INIT_TESTER (CONF)
-module TestOld = MK (SXSI) (MK (SaxonBXQuery) (I))
-module Test = MK (SXSI) (I)
+INCLUDE "config.ml"
-let l = Test.test_engine [] (make_queryset
- ["/home/kim/Documents/Work/Code/xpathcomp/tests/tiny.xml"]
- ["/child::*"])
+let l = TEST.test_engine [] (make_queryset
+ documents
+ queries
+ )
;;
-
-
-
List.iter (function (e,d),s ->
Printf.printf "\n-------------- %s -----------------" e;
Array.iter ( fun i ->