summaryrefslogtreecommitdiff
path: root/test/mono/test.sh
diff options
context:
space:
mode:
authorBrian Campbell2017-08-16 14:39:27 +0100
committerBrian Campbell2017-08-16 14:39:27 +0100
commitf5ce4223dbd99349fd1cdbeb99a2839a799589c5 (patch)
tree37a05d25311395c207c53e9416f4a50afb49d3d9 /test/mono/test.sh
parentf6f41a79bb2d189bc10c650dd0ad41257a76161e (diff)
Very basic start to monomorphisation testing
Diffstat (limited to 'test/mono/test.sh')
-rwxr-xr-xtest/mono/test.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/mono/test.sh b/test/mono/test.sh
new file mode 100755
index 00000000..7b1eeb64
--- /dev/null
+++ b/test/mono/test.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -ex
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+SAILDIR="$DIR/../.."
+LEMDIR="$DIR/../../../lem"
+OUTDIR="$DIR/fnreduce-ml"
+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
+ 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