diff --git a/tests/stress/dune b/tests/stress/dune index f91efe0..4897320 100644 --- a/tests/stress/dune +++ b/tests/stress/dune @@ -8,4 +8,8 @@ (deps %{bin:ff} %{bin:ff_wrapper} - (glob_files *.fun))) + (glob_files *.fun) + %{lib-private:runtime:libfun_rt.a} + %{lib-private:runtime:fun_rt.hpp} + %{lib-private:runtime:fun_rt_core.hpp} + %{lib-private:runtime:fun_rt_lib.hpp})) diff --git a/tests/stress/test_entry.ml b/tests/stress/test_entry.ml index 3649a65..48d9a03 100644 --- a/tests/stress/test_entry.ml +++ b/tests/stress/test_entry.ml @@ -3,7 +3,11 @@ module U = Util let sum_test = let rec sum x = if x = 0 then 0 else x + sum (x - 1) in QCheck.Test.make ~count:10 ~name:"sum.exe property" QCheck.small_nat - (fun i -> U.call_ff_int_to_int ~case:"sum.fun" i = sum i) + (fun i -> + Alcotest.(check int) + "int compare" (sum i) + (U.call_ff_int_to_int ~case:"sum.fun" i); + true) let fib_test = let rec fib x = @@ -13,7 +17,11 @@ let fib_test = | _ -> fib (x - 1) + fib (x - 2) in QCheck.Test.make ~count:5 ~name:"fib.exe propety" (QCheck.int_bound 30) - (fun i -> U.call_ff_int_to_int ~case:"fib.fun" i = fib i) + (fun i -> + Alcotest.(check int) + "int compare" (fib i) + (U.call_ff_int_to_int ~case:"fib.fun" i); + true) module RTA = Rand_struct_access @@ -23,8 +31,12 @@ let struct_acces_test = (QCheck.make RTA.tree_gen ~print:(fun tree -> fst (RTA.test_case_of_tree tree))) (fun tree -> + let _int_list_tsetable = Alcotest.(list int) in let prog, expect = RTA.test_case_of_tree tree in - U.call_ff_on_prog_to_int_list ~prog = expect)) + Alcotest.(check (list int)) + "int list should equal" expect + (U.call_ff_on_prog_to_int_list ~prog); + true)) let () = let suite = diff --git a/tests/stress/util.ml b/tests/stress/util.ml index 6255899..6d198fb 100644 --- a/tests/stress/util.ml +++ b/tests/stress/util.ml @@ -32,18 +32,15 @@ let call_ff_on_prog_to_int_list ~(prog : string) : int list = let oc = open_out temp_file in Printf.fprintf oc "%s" prog; close_out oc; - (* compiling *) - Printf.printf "Call ff_wraper on tempfile %s\n" temp_file; - let _pid = - Unix.create_process "ff_wrapper" - [| "ff_wrapper"; temp_file |] - Unix.stdin Unix.stdout Unix.stderr - in - ignore (Unix.wait ()); - let exe = Printf.sprintf "%s.out" temp_file in - Printf.printf "Dumped exe file path: %s\n" exe; Lwt_main.run - (let* out = Lwt_process.pread (exe, [| exe |]) in + ((* compiling *) + Printf.printf "Call ff_wraper on tempfile %s\n" temp_file; + let* ret = + Lwt_process.exec ("ff_wrapper", [| "ff_wrapper"; temp_file |]) + in + let exe = Printf.sprintf "%s.out" temp_file in + Printf.printf "Dumped exe file path: %s\n" exe; + let* out = Lwt_process.pread (exe, [| exe |]) in let lines = String.split_on_char '\n' out in let ints = List.(lines |> filter (fun s -> s <> "") |> map int_of_string)