-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move runtest to own module (#11043)
Signed-off-by: Rudi Grinberg <[email protected]>
- Loading branch information
Showing
5 changed files
with
71 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
open Import | ||
|
||
let runtest_info = | ||
let doc = "Run tests." in | ||
let man = | ||
[ `S "DESCRIPTION" | ||
; `P {|This is a short-hand for calling:|} | ||
; `Pre {| dune build @runtest|} | ||
; `Blocks Common.help_secs | ||
; Common.examples | ||
[ ( "Run all tests in the current source tree (including those that passed on \ | ||
the last run)" | ||
, "dune runtest --force" ) | ||
; ( "Run tests sequentially without output buffering" | ||
, "dune runtest --no-buffer -j 1" ) | ||
] | ||
] | ||
in | ||
Cmd.info "runtest" ~doc ~man ~envs:Common.envs | ||
;; | ||
|
||
let runtest_term = | ||
let name_ = Arg.info [] ~docv:"DIR" in | ||
let+ builder = Common.Builder.term | ||
and+ dirs = Arg.(value & pos_all string [ "." ] name_) in | ||
let common, config = Common.init builder in | ||
let request (setup : Import.Main.build_system) = | ||
Action_builder.all_unit | ||
(List.map dirs ~f:(fun dir -> | ||
let dir = Path.(relative root) (Common.prefix_target common dir) in | ||
Alias.in_dir | ||
~name:Dune_rules.Alias.runtest | ||
~recursive:true | ||
~contexts:setup.contexts | ||
dir | ||
|> Alias.request)) | ||
in | ||
Build_cmd.run_build_command ~common ~config ~request | ||
;; | ||
|
||
let commands = | ||
let command = Cmd.v runtest_info runtest_term in | ||
[ command; command_alias command runtest_term "test" ] | ||
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
open Import | ||
|
||
val commands : unit Cmd.t list |