2025-01-27 19:31:19 -08:00
|
|
|
open Util.Assert
|
|
|
|
|
open Arg
|
|
|
|
|
open X86
|
|
|
|
|
open Sim.Simulator
|
|
|
|
|
|
|
|
|
|
exception Ran_tests
|
|
|
|
|
let worklist = ref []
|
|
|
|
|
|
|
|
|
|
let suite = ref (timeout_suite 5 (Studenttests.provided_tests @ Gradedtests.graded_tests))
|
|
|
|
|
|
|
|
|
|
let exec_tests () =
|
|
|
|
|
let o = run_suite !suite in
|
|
|
|
|
Printf.printf "%s\n" (outcome_to_string o);
|
|
|
|
|
raise Ran_tests
|
|
|
|
|
|
|
|
|
|
let do_one_file fn =
|
|
|
|
|
let _ = Printf.printf "Processing: %s\n" fn in ()
|
|
|
|
|
|
|
|
|
|
(* Use the --test option to run unit tests and the quit the program. *)
|
|
|
|
|
let argspec = [
|
|
|
|
|
("--test", Unit exec_tests, "run the test suite, ignoring other inputs");
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
let _ =
|
|
|
|
|
try
|
|
|
|
|
Arg.parse argspec (fun f -> worklist := f :: !worklist)
|
|
|
|
|
"CIS341 main test harness \n";
|
|
|
|
|
match !worklist with
|
|
|
|
|
| [] -> print_endline "* Nothing to do"
|
|
|
|
|
| _ -> List.iter do_one_file !worklist
|
|
|
|
|
with Ran_tests -> ()
|