Skip to content

Commit 0227fa6

Browse files
committed
CHC: add check for error result
1 parent 1d5c00a commit 0227fa6

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

CodeHawk/CHC/cchcmdline/cCHXCAnalyzer.ml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ let speclist = [
125125
"path relative to project path");
126126
("-diagnostics", Arg.Unit (fun () -> activate_diagnostics ()),
127127
"collect diagnostics messages and save in diagnostics log");
128+
("-disable_timing", Arg.Unit (fun () -> CHTiming.disable_timing ()),
129+
"disable printing timing log messages");
128130
("-verbose", Arg.Unit (fun () -> system_settings#set_verbose true),
129131
"print status on proof obligations and invariants");
130132
("-projectname", Arg.String system_settings#set_projectname,
@@ -186,7 +188,8 @@ let main () =
186188
else if !cmd = "outputparameters-primary" then
187189
begin
188190
system_settings#set_output_parameter_analysis;
189-
CCHCreateOutputParameterPOs.output_parameter_po_process_file ();
191+
let _ =
192+
CCHCreateOutputParameterPOs.output_parameter_po_process_file () in
190193
log_info "primary proof obligations generated [%s:%d]" __FILE__ __LINE__;
191194
save_log_files "primary";
192195
log_info
@@ -214,18 +217,26 @@ let main () =
214217
end
215218

216219
else if !cmd = "generate_and_check" then
217-
begin
218-
generate_and_check_process_file (List.rev !domains);
219-
pr_timing [STR cfilename; STR ": finished generate_and_check"];
220-
log_info
221-
"Invariants generated and proof obligations checked [%s:%d]"
222-
__FILE__ __LINE__;
223-
save_log_files "gencheck";
224-
log_info
225-
"Invariant generation and proof obligation check log files saved [%s:%d]"
226-
__FILE__ __LINE__;
227-
pr_timing [STR cfilename; STR ": finished saving log files"]
228-
end
220+
match generate_and_check_process_file (List.rev !domains) with
221+
| Error e ->
222+
let msg = STR (String.concat "; " e) in
223+
begin
224+
ch_error_log#add "generate-and-check-failure" msg;
225+
pr_debug [msg; NL];
226+
exit 1
227+
end
228+
| _ ->
229+
begin
230+
pr_timing [STR cfilename; STR ": finished generate_and_check"];
231+
log_info
232+
"Invariants generated and proof obligations checked [%s:%d]"
233+
__FILE__ __LINE__;
234+
save_log_files "gencheck";
235+
log_info
236+
("Invariant generation and proof obligation check log files saved [%s:%d]")
237+
__FILE__ __LINE__;
238+
pr_timing [STR cfilename; STR ": finished saving log files"]
239+
end
229240

230241
else
231242
begin

0 commit comments

Comments
 (0)