Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions bin/build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
;;
Expand Down
16 changes: 7 additions & 9 deletions bin/runtest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
;;

Expand Down
5 changes: 2 additions & 3 deletions bin/runtest_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
7 changes: 2 additions & 5 deletions bin/runtest_common.mli
Original file line number Diff line number Diff line change
@@ -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
Loading