Skip to content

Commit 9a3bdff

Browse files
committed
handle previous run file generation correctly for multi-domain runs
- Update `ocannl_config.example` to use `prev_run_prefix` instead of `prev_run_file` - Modify `get_debug` function to handle previous run file generation more flexibly - Improve file stem and previous run file path generation in debug configuration
1 parent 783ad97 commit 9a3bdff

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

arrayjit/lib/utils.ml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,14 @@ let get_debug name =
272272
let log_main_domain_to_stdout =
273273
Bool.of_string @@ get_global_arg ~default:"false" ~arg_name:"log_main_domain_to_stdout"
274274
in
275-
let filename =
275+
let file_stem =
276276
if log_main_domain_to_stdout && String.is_empty name then None
277-
else Some (diagn_log_file @@ if String.is_empty name then "debug" else "debug-" ^ name)
277+
else Some ((if String.is_empty name then "debug" else "debug-") ^ name)
278+
in
279+
let filename = Option.map file_stem ~f:(fun stem -> diagn_log_file @@ stem) in
280+
let prev_run_file =
281+
let prefix = get_global_arg ~default:"" ~arg_name:"prev_run_prefix" in
282+
Option.map file_stem ~f:(fun stem -> diagn_log_file @@ prefix ^ stem ^ ".raw")
278283
in
279284
let log_level =
280285
let s = String.strip @@ get_global_arg ~default:"1" ~arg_name:"log_level" in
@@ -319,12 +324,6 @@ let get_debug name =
319324
if String.is_empty arg then [] else [ Re.Pcre.re arg ]
320325
in
321326
let highlight_terms = Re.(alt (highlight_re @ List.map debug_highlights ~f:str)) in
322-
let prev_run_file =
323-
let arg = get_global_arg ~default:"" ~arg_name:"prev_run_file" in
324-
if String.is_empty arg then None
325-
else if String.is_suffix arg ~suffix:".raw" then Some arg
326-
else Some (arg ^ ".raw")
327-
in
328327
let diff_ignore_pattern =
329328
let arg = get_global_arg ~default:"" ~arg_name:"diff_ignore_pattern_pcre" in
330329
if String.is_empty arg then None else Some (Re.Pcre.re arg)
@@ -348,8 +347,7 @@ let get_debug name =
348347
~flame_graph_separation:50 ~toc_entry ~for_append:false ~max_inline_sexp_length:120
349348
~hyperlink ~toc_specific_hyperlink:"" ~highlight_terms
350349
~exclude_on_path:Re.(str "env")
351-
~backend ~log_level ?snapshot_every_sec ?prev_run_file ?diff_ignore_pattern
352-
filename
350+
~backend ~log_level ?snapshot_every_sec ?prev_run_file ?diff_ignore_pattern filename
353351

354352
let _get_local_debug_runtime =
355353
let open Stdlib.Domain in

ocannl_config.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ debug_highlights=
135135
debug_highlight_pcre=
136136

137137
# For ppx_minidebug: if provided, enables highlighting differences between the current run
138-
# and a previous run loaded from this file. The ".raw" extension is added automatically if not present.
139-
prev_run_file=
138+
# and a previous run loaded from `.raw` files derived using the given prefix.
139+
prev_run_prefix=
140140

141141
# For ppx_minidebug: a pcre syntax regular expression pattern that will be removed from messages
142142
# before comparison when highlighting differences between runs, allowing certain differences to be ignored.

0 commit comments

Comments
 (0)