Skip to content

Commit

Permalink
Newline at the beginning of smt printing and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevendeo committed Oct 5, 2023
1 parent f9e7c67 commit d7fadeb
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 53 deletions.
8 changes: 7 additions & 1 deletion src/bin/common/solving_loop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ let main () =
| Util.Timeout ->
Printer.print_status_timeout None None None None;
exit_as_timeout ()
| Errors.Error e -> recoverable_error "%a" Errors.report e; st
| Errors.Error e ->
recoverable_error "%a" Errors.report e;
st
| _ as exn -> Printexc.raise_with_backtrace exn bt
in
let finally ~handle_exn st e =
Expand Down Expand Up @@ -560,6 +562,10 @@ let main () =
handle_option loc name value;
st

| {contents = `Set_option _; _} ->
recoverable_error "Invalid set-option";
st

| {contents = `Get_model; _ } ->
if Options.get_interpretation () then
match State.get partial_model_key st with
Expand Down
1 change: 1 addition & 0 deletions src/lib/util/printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ let print_status_preprocess ?(validity_mode=true)

let print_smtlib_err ?(flushed=true) s =
(* The smtlib error messages are printed on the regular output. *)
pp_std_smt ();
let fmt = Options.Output.get_fmt_regular () in
let k fmt =
if flushed || Options.get_output_with_forced_flush () then
Expand Down
17 changes: 16 additions & 1 deletion tests/cram.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ echo '(check-sat)' | alt-ergo --inequalities-plugin does-not-exist -i smtlib2 -o smtlib2 2>&1 >/dev/null | sed -E 's/\(\\".*\\"\)//'
alt-ergo: ; Fatal Error: [Dynlink] Loading the 'inequalities' reasoner (FM module) plugin in "does-not-exist" failed!
alt-ergo: Fatal Error: [Dynlink] Loading the 'inequalities' reasoner (FM module) plugin in "does-not-exist" failed!
>> Failure message: error loading shared library: Dynlink.Error (Dynlink.Cannot_open_dll "Failure")

Now we will have some tests for the models. Note that it is okay if the format
Expand Down Expand Up @@ -78,3 +78,18 @@ And now some cases where it should work (using either `--produce-models` or `set
unknown
(
)

We now test the --continue-on-error strategy where alt-ergo fails (legitimately) on some commands but keeps running.
$ echo '(get-info :foo) (set-option :bar) (check-sat)' | alt-ergo -i smtlib2 -o smtlib2 --continue-on-error 2>/dev/null
unsupported

(error "Invalid set-option")

unknown

Some errors are unescapable though. It its the case of syntax error in commands.
$ echo '(get-info :foo) (set-option :bar) (exil) (check-sat)' | alt-ergo -i smtlib2 -o smtlib2 --continue-on-error 2>/dev/null
unsupported

(error "Invalid set-option")
(error "Error on parsing errors (code 3)")
13 changes: 0 additions & 13 deletions tests/everything/testfile-smt-instr-get-info.dolmen.expected

This file was deleted.

17 changes: 0 additions & 17 deletions tests/everything/testfile-smt-instr-get-info.dolmen.smt2

This file was deleted.

3 changes: 0 additions & 3 deletions tests/models/issues/719.models.expected

This file was deleted.

18 changes: 0 additions & 18 deletions tests/models/issues/719.models.smt2

This file was deleted.

0 comments on commit d7fadeb

Please sign in to comment.