summaryrefslogtreecommitdiff
path: root/test/mono/test.sh
blob: 8a88e2e3d6a7d1dcb3c912e9bf8c7352f7d699c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SAILDIR="$DIR/../.."
LEMDIR="$DIR/../../../lem"
OUTDIR="$DIR/test-out"
ZARITH="$LEMDIR/ocaml-lib/dependencies/zarith"

if [ ! -d "$OUTDIR" ]; then
  mkdir -- "$OUTDIR"
fi
cd "$OUTDIR"

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/sail_operators_mwords.lem" "$SAILDIR/src/gen_lib/state.lem" testout_embed_types_sequential.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 sail_operators_mwords.ml state.ml testout_embed_types_sequential.ml testout_embed_sequential.ml test.ml -o test
    ./test
  fi
done