Commit 4b1bc2b0 authored by Andrei Paskevich's avatar Andrei Paskevich

reorganize examples/

- all programs with sessions are in examples/
- all programs without sessions are in examples/in_progress/
  (if you have private sessions for those, just move them there)
- all pure logical problems are in logic/
  (to simplify bench scripts and gallery building; they are few anyway)
- all OCaml programs are in examples/use_api/
- all strange stuff is in examples/misc/
  (most of it should probably go)
- Claude's solutions for Foveoos 2011 are in examples/foveoos11-cm/
  (why do we need two sets of solutions for quite simple problems?)
- hoare_logic, bitvectors, vacid_0_binary_heaps are in examples/

Bench scripts and documentation are updated.
Also, bench/bench is simplified a little bit.
parent 09da8804
...@@ -172,12 +172,12 @@ pvsbin/ ...@@ -172,12 +172,12 @@ pvsbin/
/tests/test-and/ /tests/test-and/
# /examples/ # /examples/
/examples/programs/course/ /examples/in_progress/course/
/examples/programs/wcet_hull/ /examples/in_progress/wcet_hull/
/examples/programs/binary_search2/ /examples/in_progress/binary_search2/
/examples/programs/vacid_0_red_black_trees_harness/ /examples/in_progress/binary_search_c/
/examples/programs/next_digit_sum/ /examples/in_progress/next_digit_sum/
/examples/programs/binary_search_c/ /examples/in_progress/vacid_0_red_black_trees_harness/
/examples/why3bench.html /examples/why3bench.html
/examples/why3regtests.err /examples/why3regtests.err
/examples/why3regtests.out /examples/why3regtests.out
...@@ -187,8 +187,8 @@ pvsbin/ ...@@ -187,8 +187,8 @@ pvsbin/
/examples/*/*.tex /examples/*/*.tex
/examples/*/*/*.tex /examples/*/*/*.tex
/examples/*/*/*/*.tex /examples/*/*/*/*.tex
/examples/runstrat/makejob.opt /examples/use_api/runstrat/makejob.opt
/examples/runstrat/runstrat.opt /examples/use_api/runstrat/runstrat.opt
# modules # modules
/modules/string/ /modules/string/
......
...@@ -425,14 +425,14 @@ clean:: ...@@ -425,14 +425,14 @@ clean::
gallery:: gallery::
@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi @if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
@for x in `find examples/programs/ -name why3session.xml`; do \ @for x in examples/*/why3session.xml ; do \
d=`dirname $$x`; \ d=`dirname $$x`; \
f=`basename $$d`; \ f=`basename $$d`; \
echo "exporting $$f"; \ echo "exporting $$f"; \
mkdir -p $(GALLERYDIR)/$$f; \ mkdir -p $(GALLERYDIR)/$$f; \
cp examples/programs/$$f.mlw $(GALLERYDIR)/$$f/; \ cp examples/$$f.mlw $(GALLERYDIR)/$$f/; \
rm -f $(GALLERYDIR)/$$f/$$f.zip; \ rm -f $(GALLERYDIR)/$$f/$$f.zip; \
cd examples/programs/; \ cd examples/; \
zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \ zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \
cd ../..; \ cd ../..; \
done done
...@@ -1130,28 +1130,28 @@ testl-ide: bin/why3ide.opt ...@@ -1130,28 +1130,28 @@ testl-ide: bin/why3ide.opt
testl-type: bin/why3.byte testl-type: bin/why3.byte
ocamlrun -bt bin/why3.byte --type-only tests/test-pgm-jcf.mlw ocamlrun -bt bin/why3.byte --type-only tests/test-pgm-jcf.mlw
test-api.byte: examples/use_api.ml lib/why3/why3.cma test-api.byte: examples/use_api/use_api.ml lib/why3/why3.cma
$(if $(QUIET),@echo 'Ocaml $<' &&) \ $(if $(QUIET),@echo 'Ocaml $<' &&) \
ocaml -I lib/why3 $(INCLUDES) $(EXTCMA) lib/why3/why3.cma $< \ ocaml -I lib/why3 $(INCLUDES) $(EXTCMA) lib/why3/why3.cma $< \
|| (printf "Test of Why API calls failed. Please fix it"; exit 2) || (printf "Test of Why API calls failed. Please fix it"; exit 2)
test-api.opt: examples/use_api.ml lib/why3/why3.cmxa test-api.opt: examples/use_api/use_api.ml lib/why3/why3.cmxa
$(if $(QUIET),@echo 'Ocamlopt $<' &&) \ $(if $(QUIET),@echo 'Ocamlopt $<' &&) \
($(OCAMLOPT) -o $@ -I lib/why3 $(INCLUDES) $(EXTCMXA) lib/why3/why3.cmxa $< \ ($(OCAMLOPT) -o $@ -I lib/why3 $(INCLUDES) $(EXTCMXA) lib/why3/why3.cmxa $< \
&& ./test-api.opt) \ && ./test-api.opt) \
|| (printf "Test of Why API calls failed. Please fix it"; exit 2) || (printf "Test of Why API calls failed. Please fix it"; exit 2)
@rm -f test-api.opt @rm -f test-api.opt
test-shape: lib/why3/why3.cma #test-shape: lib/why3/why3.cma
ocaml -I lib/why3 $(INCLUDES) $(EXTCMA) $? examples/test_shape.ml # ocaml -I lib/why3 $(INCLUDES) $(EXTCMA) $? examples/test_shape.ml
test-session.byte: examples/create_session.ml lib/why3/why3.cma test-session.byte: examples/use_api/create_session.ml lib/why3/why3.cma
$(if $(QUIET),@echo 'Ocaml $<' &&) \ $(if $(QUIET),@echo 'Ocaml $<' &&) \
ocaml -I lib/why3 $(INCLUDES) $(EXTCMA) lib/why3/why3.cma $< \ ocaml -I lib/why3 $(INCLUDES) $(EXTCMA) lib/why3/why3.cma $< \
|| (printf "Test of Why API calls for Session module failed. Please fix it"; exit 2) || (printf "Test of Why API calls for Session module failed. Please fix it"; exit 2)
@rm -f why3session.xml @rm -f why3session.xml
test-session.opt: examples/create_session.ml lib/why3/why3.cmxa test-session.opt: examples/use_api/create_session.ml lib/why3/why3.cmxa
$(if $(QUIET),@echo 'Ocamlopt $<' &&) \ $(if $(QUIET),@echo 'Ocamlopt $<' &&) \
($(OCAMLOPT) -o $@ -I lib/why3 $(INCLUDES) $(EXTCMXA) lib/why3/why3.cmxa $< \ ($(OCAMLOPT) -o $@ -I lib/why3 $(INCLUDES) $(EXTCMXA) lib/why3/why3.cmxa $< \
&& ./test-session.opt) \ && ./test-session.opt) \
...@@ -1162,12 +1162,12 @@ test-session.opt: examples/create_session.ml lib/why3/why3.cmxa ...@@ -1162,12 +1162,12 @@ test-session.opt: examples/create_session.ml lib/why3/why3.cmxa
#only test the compilation of runstrat #only test the compilation of runstrat
test-runstrat.byte: lib/why3/why3.cma lib/why3/META test-runstrat.byte: lib/why3/why3.cma lib/why3/META
OCAMLPATH=$(PWD)/lib $(MAKE) -C examples/runstrat clean OCAMLPATH=$(PWD)/lib $(MAKE) -C examples/use_api/runstrat clean
OCAMLPATH=$(PWD)/lib $(MAKE) -C examples/runstrat byte OCAMLPATH=$(PWD)/lib $(MAKE) -C examples/use_api/runstrat byte
test-runstrat.opt: lib/why3/why3.cmxa lib/why3/META test-runstrat.opt: lib/why3/why3.cmxa lib/why3/META
OCAMLPATH=$(PWD)/lib $(MAKE) -C examples/runstrat clean OCAMLPATH=$(PWD)/lib $(MAKE) -C examples/use_api/runstrat clean
OCAMLPATH=$(PWD)/lib $(MAKE) -C examples/runstrat opt OCAMLPATH=$(PWD)/lib $(MAKE) -C examples/use_api/runstrat opt
test-runstrat: test-runstrat.$(OCAMLBEST) test-runstrat: test-runstrat.$(OCAMLBEST)
...@@ -1393,16 +1393,16 @@ DISTRIB_FILES = Version Makefile.in configure.in configure \ ...@@ -1393,16 +1393,16 @@ DISTRIB_FILES = Version Makefile.in configure.in configure \
lib/why3/META.in lib/why3/why3.ml \ lib/why3/META.in lib/why3/why3.ml \
doc/version.tex.in doc/manual.pdf \ doc/version.tex.in doc/manual.pdf \
drivers/*.drv drivers/*.gen \ drivers/*.drv drivers/*.gen \
examples/*.why examples/programs/*.mlw examples/tptp/*.why \ examples/*.mlw examples/logic/*.why \
examples/tests-provers/*.why examples/check-builtin/*.why \ examples/tests-provers/*.why examples/check-builtin/*.why \
examples/bts/*.why \ examples/bts/*.why \
examples/programs/vacid_0_binary_heaps/*.why \ examples/vacid_0_binary_heaps/*.why \
examples/programs/vacid_0_binary_heaps/*.mlw \ examples/vacid_0_binary_heaps/*.mlw \
examples/bitvectors/*.why \ examples/bitvectors/*.why \
examples/foveoos2011/*.mlw \ examples/foveoos11-cm/*.mlw \
examples/*/*.xml examples/*/*/*.xml examples/*/*/*/*.xml \ examples/*/*.xml examples/*/*/*.xml examples/*/*/*/*.xml \
examples/*/*.v examples/*/*/*.v examples/*/*/*/*.v\ examples/*/*.v examples/*/*/*.v examples/*/*/*/*.v\
examples/use_api.ml \ examples/use_api/*.ml \
theories/*.why \ theories/*.why \
modules/*.mlw \ modules/*.mlw \
lib/coq/*.v lib/coq/*/*.v lib/coq-tactic/*.v \ lib/coq/*.v lib/coq/*/*.v lib/coq-tactic/*.v \
...@@ -1445,6 +1445,7 @@ $(DISTRIB_TAR): doc/manual.pdf ...@@ -1445,6 +1445,7 @@ $(DISTRIB_TAR): doc/manual.pdf
ln -s ../theories $(DISTRIB_DIR)/share/theories ln -s ../theories $(DISTRIB_DIR)/share/theories
cp --parents $(DISTRIB_FILES) $(DISTRIB_DIR) cp --parents $(DISTRIB_FILES) $(DISTRIB_DIR)
rm -rf $(DISTRIB_DIR)/examples/hoare_logic rm -rf $(DISTRIB_DIR)/examples/hoare_logic
rm -rf $(DISTRIB_DIR)/examples/misc
cd $(DISTRIB_DIR); rm -f $(LIBGENERATED) \ cd $(DISTRIB_DIR); rm -f $(LIBGENERATED) \
$(COQPGENERATED) $(WHY3DOCGENERATED) $(PLUGGENERATED) $(COQPGENERATED) $(WHY3DOCGENERATED) $(PLUGGENERATED)
cd distrib; tar cf $(NAME).tar $(NAME); gzip -f --best $(NAME).tar cd distrib; tar cf $(NAME).tar $(NAME); gzip -f --best $(NAME).tar
......
...@@ -5,103 +5,72 @@ ...@@ -5,103 +5,72 @@
# Useless in this script ? # Useless in this script ?
# export WHY3LIB=lib # export WHY3LIB=lib
# export WHY3DATA=. # export WHY3DATA=.
# export WHY3LOADPATH=theories
export WHY3LOADPATH=theories
pgm=$1 pgm=$1
pgml=$1
pgml_options= shopt -u failglob
goods () { goods () {
for f in $1/*.why; do for f in $1/*.[wm][hl][yw] ; do
echo -n " "$f"... " echo -n " $f... "
base=$1/`basename $f .why`
# running Why # running Why
if ! $pgm $2 $f > /dev/null 2>&1; then if ! $pgm $2 $f > /dev/null 2>&1; then
echo "why FAILED" echo "FAILED!"
echo "env: WHY3DATA='$WHY3DATA'" # echo "env: WHY3DATA='$WHY3DATA'"
echo "invocation: $pgm $2 $f" echo "invocation: $pgm $2 $f"
echo "result:" echo "result:"
$pgm $2 $f $pgm $2 $f
exit 1 exit 1
fi fi
echo "why ok... " echo "ok"
done done
} }
bads () { bads () {
for f in $1/*.why; do for f in $1/*.[wm][hl][yw] ; do
echo -n " "$f"... " echo -n " $f... "
if $pgm $2 $f > /dev/null 2>&1; then if $pgm $2 $f > /dev/null 2>&1; then
echo "$pgm $2 $f" echo "SHOULD FAIL!"
echo "FAILED!" # echo "env: WHY3DATA='$WHY3DATA'"
echo "invocation: $pgm $2 $f"
exit 1 exit 1
else
echo "ok"
fi fi
echo "ok"
done done
} }
drivers () { drivers () {
for f in $1/*.drv; do for f in $1/*.drv; do
if [ $f = "drivers/ocaml.drv" ]; then continue; fi if [ $f = "drivers/ocaml.drv" ]; then continue; fi
echo -n " "$f"... " echo -n " $f... "
# running Why # running Why
if ! echo "theory Test goal G : 1=2 end" | $pgm -F why --driver $f - > /dev/null 2>&1; then if ! echo "theory Test goal G : 1=2 end" | $pgm -F why --driver $f - > /dev/null 2>&1; then
echo "why FAILED" echo "why FAILED"
echo "theory Test goal G : 1=2 end" | $pgm -F why --driver $f - echo "theory Test goal G : 1=2 end" | $pgm -F why --driver $f -
exit 1 exit 1
fi fi
echo "why ok... " echo "ok"
done
}
programs () {
for f in $1/*.mlw; do
echo -n " "$f"... "
if ! $pgml -L modules $pgml_options $f $2 > /dev/null 2>&1; then
echo
echo "$pgml $pgml_options $f $2"
$pgml -L modules $pgml_options $f $2
echo "FAILED!"
exit 1
else
echo "ok"
fi
done
}
bad_programs () {
for f in $1/*.mlw; do
echo -n " "$f"... "
if $pgml -L modules $pgml_options $f > /dev/null 2>&1; then
echo
echo "$pgml $pgml_options $f"
echo "SHOULD FAIL!"
exit 1
else
echo "ok"
fi
done done
} }
valid_goals () { valid_goals () {
for f in $1/*.mlw; do for f in $1/*.mlw; do
echo -n " "$f"... " echo -n " "$f"... "
if $pgml -L modules -t 10 -P alt-ergo $f | grep -q -v Valid; then if $pgm -t 10 -P alt-ergo $f | grep -q -v Valid; then
echo "valid test $f failed!" echo "valid test $f failed!"
echo "$pgml -P alt-ergo $f" echo "$pgm -P alt-ergo $f"
$pgml -L modules -t 10 -P alt-ergo $f $pgm -t 10 -P alt-ergo $f
exit 1 exit 1
else else
echo "ok" echo "ok"
fi fi
done done
} }
list_stuff () { list_stuff () {
echo -n "$1 " echo -n "$1 "
if $pgml $1 > /dev/null 2>&1; then if $pgm $1 > /dev/null 2>&1; then
echo "ok" echo "ok"
else else
echo "$pgm $1 FAIL" echo "$pgm $1 FAIL"
...@@ -115,52 +84,63 @@ echo "=== Checking drivers ===" ...@@ -115,52 +84,63 @@ echo "=== Checking drivers ==="
drivers drivers drivers drivers
echo "" echo ""
echo "=== Parsing good files ===" #echo "=== Parsing good files ==="
goods bench/typing/bad --parse-only #goods bench/typing/bad --parse-only
echo "" #goods bench/typing/good --parse-only
#goods examples/logic --parse-only
#goods examples/bitvectors "--parse-only -I examples/bitvectors"
#echo ""
echo "=== Type-checking bad files ===" echo "=== Type-checking bad files ==="
goods bench/typing/bad --parse-only
bads bench/typing/bad --type-only bads bench/typing/bad --type-only
echo "" echo ""
echo "=== Type-checking good files ==="
goods bench/typing/good --type-only
goods examples --type-only
goods examples/tptp --type-only
echo ""
echo "=== Type-checking theories ===" echo "=== Type-checking theories ==="
goods theories --type-only goods theories --type-only
echo "" echo ""
echo "=== Parsing programs ===" echo "=== Type-checking good files ==="
pgml_options=--parse-only goods bench/typing/good --type-only
programs bench/programs/bad-typing goods examples/logic --type-only
programs bench/programs/good goods examples/bitvectors "--type-only -I examples/bitvectors"
programs examples/programs
echo "" echo ""
echo "=== Type-checking bad programs ===" #echo "=== Parsing goods ==="
pgml_options=--type-only #goods bench/programs/bad-typing --parse-only
bad_programs bench/programs/bad-typing #goods bench/programs/good --parse-only
#goods examples --parse-only
#goods examples/in_progress --parse-only
#goods examples/foveoos11-cm --parse-only
#goods examples/hoare_logic --parse-only
#goods examples/vacid_0_binary_heaps "--parse-only -I examples/vacid_0_binary_heaps"
#echo ""
echo "=== Type-checking bad goods ==="
goods bench/programs/bad-typing --parse-only
bads bench/goods/bad-typing --type-only
echo "" echo ""
echo "=== Type-checking modules ===" echo "=== Type-checking modules ==="
pgml_options=--type-only goods modules --type-only
programs modules
echo ""
echo "=== Type-checking good programs ==="