Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: OCamlPro/owi
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 43436126dee893af8052a0fe9536188bd7e6e5d6
Choose a base ref
..
head repository: OCamlPro/owi
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 91673b1f682f9a0955c9c4db2a6791fc8c7541cf
Choose a head ref
Showing with 26 additions and 8 deletions.
  1. +26 −8 src/cmd/cmd_conc.ml
34 changes: 26 additions & 8 deletions src/cmd/cmd_conc.ml
Original file line number Diff line number Diff line change
@@ -541,13 +541,31 @@ let find_model_to_run solver tree =
| Some pc -> pc_model solver pc

let launch solver tree link_state modules_to_run =
let rec loop () =
let model = find_model_to_run solver tree in
run_model model
and run_model model =
let rec find_model n =
if n = 0 then begin
Format.pp_std "Failed to find something to run@\n";
None
end
else
match find_model_to_run solver tree with
| None -> find_model (n - 1)
| Some m ->
if debug then begin
Format.pp_std "Found something to run %a@\n"
(Smtml.Model.pp ~no_values:false)
m
end;
Some m
in
let rec loop count =
if count <= 0 then None
else
let model = find_model 20 in
run_model model count
and run_model model count =
let r, thread = run_once tree link_state modules_to_run model in
match r with
| Ok (Ok ()) -> loop ()
| Ok (Ok ()) -> loop (count - 1)
| Ok (Error e) -> Result.failwith e
| Error (Assume_fail c) -> begin
if debug then begin
@@ -559,13 +577,13 @@ let launch solver tree link_state modules_to_run =
match pc_model solver thread.pc with
| None ->
Format.pp_err "Can't satisfy assume !@\n";
loop ()
| Some _model as model -> run_model model
loop (count - 1)
| Some _model as model -> run_model model (count - 1)
end
| Error (Trap trap) -> Some (`Trap trap, thread)
| Error Assert_fail -> Some (`Assert_fail, thread)
in
loop ()
loop 10

(* NB: This function propagates potential errors (Result.err) occurring
during evaluation (OS, syntax error, etc.), except for Trap and Assert,