Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
caisar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
caisar
Commits
7b794ad9
Commit
7b794ad9
authored
2 years ago
by
Michele Alberti
Browse files
Options
Downloads
Patches
Plain Diff
Register custom printers for the used exceptions in order to display clean error messages.
parent
8703afd4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main.ml
+9
-0
9 additions, 0 deletions
src/main.ml
src/verification.ml
+8
-7
8 additions, 7 deletions
src/verification.ml
with
17 additions
and
7 deletions
src/main.ml
+
9
−
0
View file @
7b794ad9
...
@@ -215,6 +215,15 @@ let default_info =
...
@@ -215,6 +215,15 @@ let default_info =
let
default_cmd
=
Term
.(
ret
(
const
(
fun
_
->
`Help
(
`Pager
,
None
))
$
const
()
))
let
default_cmd
=
Term
.(
ret
(
const
(
fun
_
->
`Help
(
`Pager
,
None
))
$
const
()
))
let
()
=
(* We register custom printers for a selection of exceptions otherwise Why3
will print the related messages as "anomaly: <exception with message>". *)
Why3
.
Exn_printer
.
register
(
fun
fmt
exn
->
match
exn
with
|
Invalid_argument
msg
->
Fmt
.
pf
fmt
"Invalid argument: %s"
msg
|
Failure
msg
->
Fmt
.
pf
fmt
"Failure: %s"
msg
|
_
->
raise
exn
)
let
()
=
let
()
=
try
try
Cmd
.
group
~
default
:
default_cmd
default_info
[
config_cmd
;
verify_cmd
]
Cmd
.
group
~
default
:
default_cmd
default_info
[
config_cmd
;
verify_cmd
]
...
...
This diff is collapsed.
Click to expand it.
src/verification.ml
+
8
−
7
View file @
7b794ad9
...
@@ -77,7 +77,7 @@ let answer_saver limit config task env prover dataset_csv =
...
@@ -77,7 +77,7 @@ let answer_saver limit config task env prover dataset_csv =
let
handle_task_saver
task
env
dataset_csv
command
=
let
handle_task_saver
task
env
dataset_csv
command
=
let
dataset_filename
=
let
dataset_filename
=
match
dataset_csv
with
match
dataset_csv
with
|
None
->
failwith
"Error, n
o dataset provided for SAVer
.
"
|
None
->
invalid_arg
"N
o dataset provided for SAVer"
|
Some
s
->
s
|
Some
s
->
s
in
in
let
goal
=
Task
.
task_goal_fmla
task
in
let
goal
=
Task
.
task_goal_fmla
task
in
...
@@ -104,13 +104,14 @@ let answer_saver limit config task env prover dataset_csv =
...
@@ -104,13 +104,14 @@ let answer_saver limit config task env prover dataset_csv =
let
svm_filename
=
let
svm_filename
=
match
Language
.
lookup_loaded_svms
svm_app_sym
with
match
Language
.
lookup_loaded_svms
svm_app_sym
with
|
Some
t
->
t
.
filename
|
Some
t
->
t
.
filename
|
None
->
failwith
"SVM file not found in environment.
"
|
None
->
invalid_arg
"No SVM model found in task
"
in
in
(
eps
,
svm_filename
)
(
eps
,
svm_filename
)
else
failwith
"Wrong predicate found."
else
failwith
"Wrong predicate found"
(* no other predicate than robust_to is supported *)
|
_
->
|
_
->
failwith
"Unsupported by SAVer."
)
(* no other predicate than robust_to is supported *)
|
_
->
failwith
"Unsupported by SAVer."
failwith
"Unsupported predicate by SAVer"
)
|
_
->
failwith
"Unsupported predicate by SAVer"
in
in
let
svm_file
=
Unix
.
realpath
svm_filename
in
let
svm_file
=
Unix
.
realpath
svm_filename
in
let
dataset_file
=
Unix
.
realpath
dataset_filename
in
let
dataset_file
=
Unix
.
realpath
dataset_filename
in
...
@@ -175,7 +176,7 @@ let answer_generic limit config task driver (prover : Whyconf.config_prover) =
...
@@ -175,7 +176,7 @@ let answer_generic limit config task driver (prover : Whyconf.config_prover) =
match
Task
.
on_meta_excl
Native_nn_prover
.
meta_nn_filename
task_prepared
with
match
Task
.
on_meta_excl
Native_nn_prover
.
meta_nn_filename
task_prepared
with
|
Some
[
MAstr
nn_file
]
->
nn_file
|
Some
[
MAstr
nn_file
]
->
nn_file
|
Some
_
->
assert
false
(* By construction of the meta. *)
|
Some
_
->
assert
false
(* By construction of the meta. *)
|
None
->
invalid_arg
(
Fmt
.
str
"No neural network model found in task"
)
|
None
->
invalid_arg
"No neural network model found in task"
in
in
let
nn_file
=
Unix
.
realpath
nn_file
in
let
nn_file
=
Unix
.
realpath
nn_file
in
let
command
=
Re__Core
.
replace_string
nnet_or_onnx
~
by
:
nn_file
command
in
let
command
=
Re__Core
.
replace_string
nnet_or_onnx
~
by
:
nn_file
command
in
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment