3 has_infer
=`sed -n -e 's/INFERLIB *= *\([^ ]\+\)/\1/p' share/Makefile.config`
5 if test -z "$has_infer"; then
6 echo "Inference of loop invariants not enabled!"
11 forceupdateoracle
=false
15 why3prove
="bin/why3 prove"
19 printf "no files provided\n"
23 while test $# != 0; do
27 "-force-update-oracle")
28 forceupdateoracle
=true
;;
30 why3libs
="$why3libs ${1#*=}";;
32 printf "unknown option: %s\n" "$1"
33 printf "usage: infer-bench [-update-oracle] <file>\n"
34 printf " if <file> is a directory, it runs on all the *.mlw files\n"
43 echo "File not found: $1"
51 if test -n "$why3libs"; then
52 why3libs
="-L $why3libs"
56 d
=$
(echo $d |
sed 's:/*$::') #remove trailling slashs
57 mlw
="$(ls $d/*.mlw 2> /dev/null)"
65 printf "running for $1"
66 file_base
="$(basename $1)"
67 file_dir
="$(dirname $1)"
68 out_file
="$file_dir/${file_base%.*}.out"
69 oracle_file
="$file_dir/infer-oracles/${file_base%.*}.oracle"
70 $why3prove $1 -t 1 -P alt-ergo
--debug=print-inferred-invs
$why3libs > "$out_file" 2>&1
71 str_out
=$
(sed 's/[0-9]\+\.[0-9]\+s//g' $out_file |
sed 's/[0-9]\+ steps//g')
72 str_oracle
=$
(sed 's/[0-9]\+\.[0-9]\+s//g' $oracle_file |
sed 's/[0-9]\+ steps//g')
73 if [ "$str_oracle" = "$str_out" ] ; then
77 if $updateoracle; then
78 echo "Updating oracle for $file_base"
79 cp "$out_file" "$oracle_file"
82 echo "diff is the following:"
84 diff <(echo "$str_oracle") <(echo "$str_out")
89 if $forceupdateoracle; then
90 echo "Forcing update oracle for $file_base"
91 cp "$out_file" "$oracle_file"
96 for file in $files; do
101 echo "Infer bench: success"
104 echo "Infer bench: failed"