-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.ml
More file actions
23 lines (19 loc) · 785 Bytes
/
test.ml
File metadata and controls
23 lines (19 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(** Compile and run the extracted codes in extraction/. *)
let run (command : string) : unit =
let code = Sys.command command in
if code <> 0 then
exit code
let do_test (test : string) (arguments : string list) =
Sys.chdir "extraction/";
let native = Filename.chop_extension test ^ ".p.native" in (* .p for profiling *)
let compile = "ocamlbuild " ^ native ^ " -use-ocamlfind -package base64,num,str,unix" in
run compile;
Sys.chdir "../";
let arguments = List.fold_left (fun s1 s2 -> s1 ^ " " ^ s2) "" arguments in
run ("extraction/" ^ native ^ " " ^ arguments)
let main () =
match Array.to_list Sys.argv with
| _ :: test :: arguments ->
do_test test arguments
| _ -> prerr_endline "At least argument was expected (the name of the test)."
;;main ()