[sledge] Support stopping on first report in release mode

Summary:
Specifying that sledge should stop execution when the first report is
made via e.g. `sledge l a -t Stop` currently only works when debug
tracing is enabled. This diff fixes this so that `-t Stop` also works
for the release build.

Reviewed By: jvillard

Differential Revision: D27828753

fbshipit-source-id: dd7511ff1
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 631eacd71f
commit 7817a87e32

@ -56,6 +56,7 @@ let command ~summary ?readme param =
| Assert_failure _ as exn ->
Report.InternalError (Sexp.to_string_hum (sexp_of_exn exn))
| Failure msg -> Report.InternalError msg
| Stop.Stop -> Report.safe_or_unsafe ()
| exn -> Report.UnknownError (Printexc.to_string exn)
in
Report.status (status_of_exn exn) ;
@ -143,8 +144,8 @@ let analyze =
let module Analysis = Control.Make (Opts) (Dom) in
Domain_sh.simplify_states := not no_simplify_states ;
Option.iter dump_query ~f:(fun n -> Solver.dump_query := n) ;
at_exit (fun () -> Report.coverage pgm) ;
Analysis.exec_pgm pgm ;
Report.coverage pgm ;
Report.safe_or_unsafe ()
let analyze_cmd =

@ -7,5 +7,7 @@
(** Stop analysis when encountering issues *)
let on_unknown_call _ = [%Trace.kprintf (fun _ -> assert false) ""]
let on_alarm _ = [%Trace.kprintf (fun _ -> assert false) ""]
exception Stop
let on_unknown_call _ = Trace.kprintf __FUNCTION__ (fun _ -> raise Stop) ""
let on_alarm _ = Trace.kprintf __FUNCTION__ (fun _ -> raise Stop) ""

@ -7,5 +7,7 @@
(** Stop analysis when encountering issues *)
exception Stop
val on_unknown_call : 'a -> unit
val on_alarm : 'a -> unit

Loading…
Cancel
Save