summaryrefslogtreecommitdiff
path: root/tests/test_runner/run_test.ml
diff options
context:
space:
mode:
authorNadrieril2024-05-22 15:11:28 +0200
committerGuillaume Boisseau2024-05-24 14:24:38 +0200
commit6f14e8c699169aa11ea9c106f8cae1ba593569d0 (patch)
tree35e539becc5a8c6642eb3c37a851b25c0ccdffa1 /tests/test_runner/run_test.ml
parentad819ad9ccdf137ca87eb367810694246696b835 (diff)
Add simple test runner
Diffstat (limited to 'tests/test_runner/run_test.ml')
-rw-r--r--tests/test_runner/run_test.ml30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_runner/run_test.ml b/tests/test_runner/run_test.ml
new file mode 100644
index 00000000..379abe04
--- /dev/null
+++ b/tests/test_runner/run_test.ml
@@ -0,0 +1,30 @@
+let concat_path = List.fold_left Filename.concat ""
+
+let () =
+ match Array.to_list Sys.argv with
+ (* Ad-hoc argument passing for now. *)
+ | _exe_path :: aeneas_path :: tests_dir :: test_name :: subdir :: backend
+ :: options ->
+ let input_file = concat_path [ tests_dir; "llbc"; test_name ] ^ ".llbc" in
+ let dest_dir = concat_path [ "tests"; backend; subdir ] in
+ let args =
+ [| aeneas_path; input_file; "-dest"; dest_dir; "-backend"; backend |]
+ in
+ let args = Array.append args (Array.of_list options) in
+
+ (* Debug arguments *)
+ print_string "[test_runner] Running: ";
+ Array.iter
+ (fun x ->
+ print_string x;
+ print_string " ")
+ args;
+ print_endline "";
+
+ (* Run Aeneas *)
+ let pid =
+ Unix.create_process aeneas_path args Unix.stdin Unix.stdout Unix.stderr
+ in
+ let _ = Unix.waitpid [] pid in
+ ()
+ | _ -> ()