-
Notifications
You must be signed in to change notification settings - Fork 430
Fix cram tests build-path-prefix-map substitutions #11366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fix cram tests build-path-prefix-map substitutions (#11366, @art-w) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -855,6 +855,14 @@ let report_process_finished | |
|
||
let set_temp_dir_when_running_actions = ref true | ||
|
||
let set_temp_dir ~temp_dir env = | ||
match temp_dir, !set_temp_dir_when_running_actions with | ||
| Some path, _ -> | ||
Env.add env ~var:Env.Var.temp_dir ~value:(Path.to_absolute_filename path) | ||
| None, true -> Dtemp.add_to_env env | ||
| None, false -> env | ||
;; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rgrinberg There's a comment in the code indicating that janestreet uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see this global variable anymore internally. Feel free to get rid of it here as well I suppose. However, let's try to keep the PR's as focused as possible, so that would work should come in a separate PR. |
||
|
||
let await { response_file; pid; _ } = | ||
let+ process_info, termination_reason = | ||
Scheduler.wait_for_build_process pid ~is_process_group_leader:true | ||
|
@@ -865,6 +873,7 @@ let await { response_file; pid; _ } = | |
|
||
let spawn | ||
?dir | ||
?temp_dir | ||
?(env = Env.initial) | ||
~(stdout : _ Io.t) | ||
~(stderr : _ Io.t) | ||
|
@@ -933,14 +942,7 @@ let spawn | |
Unix.gettimeofday () | ||
in | ||
let pid = | ||
let env = | ||
let env = | ||
match !set_temp_dir_when_running_actions with | ||
| true -> Dtemp.add_to_env env | ||
| false -> env | ||
in | ||
Env.to_unix env |> Spawn.Env.of_list | ||
in | ||
let env = set_temp_dir ~temp_dir env |> Env.to_unix |> Spawn.Env.of_list in | ||
let stdout = Io.fd stdout in | ||
let stderr = Io.fd stderr in | ||
let stdin = Io.fd stdin in | ||
|
@@ -976,6 +978,7 @@ let spawn | |
|
||
let run_internal | ||
?dir | ||
?temp_dir | ||
~(display : Display.t) | ||
?(stdout_to = Io.stdout) | ||
?(stderr_to = Io.stderr) | ||
|
@@ -1015,7 +1018,16 @@ let run_internal | |
| _ -> Pp.nop | ||
in | ||
let t = | ||
spawn ?dir ?env ~stdout:stdout_to ~stderr:stderr_to ~stdin:stdin_from ~prog ~args () | ||
spawn | ||
?dir | ||
?temp_dir | ||
?env | ||
~stdout:stdout_to | ||
~stderr:stderr_to | ||
~stdin:stdin_from | ||
~prog | ||
~args | ||
() | ||
in | ||
let* () = | ||
let description = | ||
|
@@ -1092,11 +1104,23 @@ let run_internal | |
res, times) | ||
;; | ||
|
||
let run ?dir ~display ?stdout_to ?stderr_to ?stdin_from ?env ?metadata fail_mode prog args | ||
let run | ||
?dir | ||
?temp_dir | ||
~display | ||
?stdout_to | ||
?stderr_to | ||
?stdin_from | ||
?env | ||
?metadata | ||
fail_mode | ||
prog | ||
args | ||
= | ||
let+ run = | ||
run_internal | ||
?dir | ||
?temp_dir | ||
~display | ||
?stdout_to | ||
?stderr_to | ||
|
@@ -1113,6 +1137,7 @@ let run ?dir ~display ?stdout_to ?stderr_to ?stdin_from ?env ?metadata fail_mode | |
|
||
let run_with_times | ||
?dir | ||
?temp_dir | ||
~display | ||
?stdout_to | ||
?stderr_to | ||
|
@@ -1126,6 +1151,7 @@ let run_with_times | |
let+ code, times = | ||
run_internal | ||
?dir | ||
?temp_dir | ||
~display | ||
?stdout_to | ||
?stderr_to | ||
|
@@ -1141,6 +1167,7 @@ let run_with_times | |
|
||
let run_capture_gen | ||
?dir | ||
?temp_dir | ||
~display | ||
?stderr_to | ||
?stdin_from | ||
|
@@ -1155,6 +1182,7 @@ let run_capture_gen | |
let+ run = | ||
run_internal | ||
?dir | ||
?temp_dir | ||
~display | ||
~stdout_to:(Io.file fn Io.Out) | ||
?stderr_to | ||
|
@@ -1178,6 +1206,7 @@ let run_capture_zero_separated = run_capture_gen ~f:Stdune.Io.zero_strings_of_fi | |
|
||
let run_capture_line | ||
?dir | ||
?temp_dir | ||
~display | ||
?stderr_to | ||
?stdin_from | ||
|
@@ -1189,6 +1218,7 @@ let run_capture_line | |
= | ||
run_capture_gen | ||
?dir | ||
?temp_dir | ||
~display | ||
?stderr_to | ||
?stdin_from | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
open Import | ||
|
||
val action : Path.t -> Action.t | ||
val action : version:Dune_lang.Syntax.Version.t -> Path.t -> Action.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(documentation was wrong, no
$
is added in front of the replacement)