summaryrefslogtreecommitdiff
path: root/test/mono/test.sh
diff options
context:
space:
mode:
authorBrian Campbell2017-08-18 16:36:52 +0100
committerBrian Campbell2017-08-18 16:36:52 +0100
commitbbdb011b8364ceaed867abb9d6b580ba8b2a60e8 (patch)
tree7b54bc62ded248d6269cf603f0107fecdd9b3390 /test/mono/test.sh
parent5527ed5ce34e77f452ca90d1b4a5126255b4ee43 (diff)
Bit more monomorphisation testing
Diffstat (limited to 'test/mono/test.sh')
-rwxr-xr-xtest/mono/test.sh37
1 files changed, 27 insertions, 10 deletions
diff --git a/test/mono/test.sh b/test/mono/test.sh
index 7b1eeb64..153b09f8 100755
--- a/test/mono/test.sh
+++ b/test/mono/test.sh
@@ -1,21 +1,38 @@
#!/bin/bash
-set -ex
+set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SAILDIR="$DIR/../.."
LEMDIR="$DIR/../../../lem"
-OUTDIR="$DIR/fnreduce-ml"
+OUTDIR="$DIR/test-out"
ZARITH="$LEMDIR/ocaml-lib/dependencies/zarith"
-"$SAILDIR/sail" -lem "$SAILDIR/lib/prelude.sail" -mono-split fnreduce.sail:43:x "$DIR/fnreduce.sail" -o "$DIR/fnreduce"
-if [ -d "$OUTDIR" ]; then
- rm -- "$OUTDIR"/*
-else
+if [ ! -d "$OUTDIR" ]; then
mkdir -- "$OUTDIR"
fi
-"$LEMDIR/bin/lem" -ocaml -lib "$SAILDIR/src/lem_interp" "$SAILDIR/src/gen_lib/sail_values.lem" "$SAILDIR/src/gen_lib/state.lem" "$DIR/fnreduce_embed_types.lem" "$DIR/fnreduce_embed_sequential.lem" -outdir "$OUTDIR"
-cp -- "$DIR"/test.ml "$OUTDIR"
cd "$OUTDIR"
-ocamlc -I "$ZARITH" "$ZARITH/zarith.cma" -dllpath "$ZARITH" -I "$LEMDIR/ocaml-lib" "$LEMDIR/ocaml-lib/extract.cma" -I "$SAILDIR/src/_build/lem_interp" "$SAILDIR/src/_build/lem_interp/extract.cma" sail_values.ml state.ml fnreduce_embed_types.ml fnreduce_embed_sequential.ml test.ml -o test
-./test
+
+TESTONLY="$1"
+if [ -n "$TESTONLY" ]; then shift; fi
+
+exec 3< "$DIR/tests"
+while read -u 3 TEST ARGS; do
+ if [ -z "$TESTONLY" -o "$TEST" = "$TESTONLY" ]; then
+# echo "$TEST ocaml"
+# rm -f -- "$OUTDIR"/*
+# "$SAILDIR/sail" -ocaml "$SAILDIR/lib/prelude.sail" "$DIR/$TEST" -o "$OUTDIR/testout" $ARGS
+# cp -- "$SAILDIR"/src/gen_lib/sail_values.ml .
+# cp -- "$DIR"/test.ml .
+# ocamlc -I "$ZARITH" "$ZARITH/zarith.cma" -dllpath "$ZARITH" -I "$LEMDIR/ocaml-lib" "$LEMDIR/ocaml-lib/extract.cma" -I "$SAILDIR/src/_build/lem_interp" "$SAILDIR/src/_build/lem_interp/extract.cma" sail_values.ml testout.ml test.ml -o test
+# ./test
+
+ echo "$TEST lem - ocaml"
+ rm -f -- "$OUTDIR"/*
+ "$SAILDIR/sail" -lem "$SAILDIR/lib/prelude.sail" "$DIR/$TEST".sail -o "$OUTDIR/testout" $ARGS $@
+ "$LEMDIR/bin/lem" -ocaml -lib "$SAILDIR/src/lem_interp" "$SAILDIR/src/gen_lib/sail_values.lem" "$SAILDIR/src/gen_lib/state.lem" testout_embed_types.lem testout_embed_sequential.lem -outdir "$OUTDIR"
+ cp -- "$DIR"/test.ml "$OUTDIR"
+ ocamlc -I "$ZARITH" "$ZARITH/zarith.cma" -dllpath "$ZARITH" -I "$LEMDIR/ocaml-lib" "$LEMDIR/ocaml-lib/extract.cma" -I "$SAILDIR/src/_build/lem_interp" "$SAILDIR/src/_build/lem_interp/extract.cma" sail_values.ml state.ml testout_embed_types.ml testout_embed_sequential.ml test.ml -o test
+ ./test
+ fi
+done