diff --git a/bin/build.ml b/bin/build.ml index 901f5bd3102..1f1b7d15e6b 100644 --- a/bin/build.ml +++ b/bin/build.ml @@ -98,8 +98,11 @@ let poll_handling_rpc_build_requests ~(common : Common.t) ~config = match kind with | Build targets -> Target.interpret_targets (Common.root common) config setup targets - | Runtest dir_or_cram_test_paths -> - Runtest_common.make_request ~dir_or_cram_test_paths ~to_cwd:root.to_cwd setup + | Runtest test_paths -> + Runtest_common.make_request + ~contexts:setup.contexts + ~to_cwd:root.to_cwd + ~test_paths in run_build_system ~common ~request, outcome) ;; diff --git a/bin/runtest.ml b/bin/runtest.ml index 28124e2e577..821986b84cc 100644 --- a/bin/runtest.ml +++ b/bin/runtest.ml @@ -36,17 +36,15 @@ let runtest_info = let runtest_term = let name = Arg.info [] ~docv:"TEST" in let+ builder = Common.Builder.term - and+ dir_or_cram_test_paths = Arg.(value & pos_all string [ "." ] name) in + and+ test_paths = Arg.(value & pos_all string [ "." ] name) in let common, config = Common.init builder in match Dune_util.Global_lock.lock ~timeout:None with | Ok () -> - Build.run_build_command - ~common - ~config - ~request: - (Runtest_common.make_request - ~dir_or_cram_test_paths - ~to_cwd:(Common.root common).to_cwd) + Build.run_build_command ~common ~config ~request:(fun setup -> + Runtest_common.make_request + ~contexts:setup.contexts + ~to_cwd:(Common.root common).to_cwd + ~test_paths) | Error lock_held_by -> Scheduler.go_without_rpc_server ~common ~config (fun () -> let open Fiber.O in @@ -56,7 +54,7 @@ let runtest_term = ~lock_held_by builder Dune_rpc.Procedures.Public.runtest - dir_or_cram_test_paths + test_paths >>| Rpc.Rpc_common.wrap_build_outcome_exn ~print_on_success:true) ;; diff --git a/bin/runtest_common.ml b/bin/runtest_common.ml index c235a30ae76..cda81f5101c 100644 --- a/bin/runtest_common.ml +++ b/bin/runtest_common.ml @@ -75,9 +75,8 @@ let disambiguate_test_name path = | None -> explain_unsuccessful_search path ~parent_dir)) ;; -let make_request ~dir_or_cram_test_paths ~to_cwd (setup : Import.Main.build_system) = - let contexts = setup.contexts in - List.map dir_or_cram_test_paths ~f:(fun dir -> +let make_request ~contexts ~to_cwd ~test_paths = + List.map test_paths ~f:(fun dir -> let dir = Path.of_string dir |> Path.Expert.try_localize_external in let open Action_builder.O in let* contexts, alias_kind = diff --git a/bin/runtest_common.mli b/bin/runtest_common.mli index b88a10e4914..877d2cde0fe 100644 --- a/bin/runtest_common.mli +++ b/bin/runtest_common.mli @@ -1,10 +1,7 @@ open Import -(** [make_request ~dir_or_cram_test_paths ~to_cwd] returns a function suitable - for passing to [Build_cmd.run_build_system] which runs the tests referred - to by the elements of [dir_or_cram_test_paths]. *) val make_request - : dir_or_cram_test_paths:string list + : contexts:Context.t list -> to_cwd:string list - -> Dune_rules.Main.build_system + -> test_paths:string list -> unit Action_builder.t