summaryrefslogtreecommitdiff
path: root/src/test/lib/Makefile
diff options
context:
space:
mode:
authorRobert Norton2017-06-29 17:30:53 +0100
committerRobert Norton2017-06-29 17:30:53 +0100
commitacfa76485c252aa2a6df199aeeaf9af6b4dc4930 (patch)
treeb827ad442e8a2b93fa844db553de1214e985230e /src/test/lib/Makefile
parent044403657d09aed9c56a9bca6decc864ed987f69 (diff)
beginnings of a sail library test suite.
Diffstat (limited to 'src/test/lib/Makefile')
-rw-r--r--src/test/lib/Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/lib/Makefile b/src/test/lib/Makefile
new file mode 100644
index 00000000..2c4036f7
--- /dev/null
+++ b/src/test/lib/Makefile
@@ -0,0 +1,40 @@
+
+# Disable built-in make madness
+MAKEFLAGS=-r
+.SUFFIXES:
+
+TESTS=div.sail
+
+BITBUCKET_DIR:=$(realpath ../../../../)
+LEM_DIR:=$(BITBUCKET_DIR)/lem
+LEM:=$(LEM_DIR)/lem
+LEMLIB = $(LEM_DIR)/ocaml-lib
+SAIL_DIR:=$(BITBUCKET_DIR)/sail/src
+SAIL:=$(SAIL_DIR)/sail.native
+ZARITH_DIR:=$(LEM_DIR)/ocaml-lib/dependencies/zarith
+ZARITH_LIB:=$(ZARITH_DIR)/zarith.cmxa
+SAIL_VALUES:=$(SAIL_DIR)/gen_lib/sail_values.ml
+
+BUILD_DIR:=_build
+
+$(BUILD_DIR):
+ mkdir -p $@
+
+ocaml: | $(BUILD_DIR)
+ cp test_lib.sail $(SAIL_VALUES) run_test_embed.ml $(BUILD_DIR)
+ cd $(BUILD_DIR) && \
+ $(SAIL) -ocaml test_lib.sail -o test && \
+ ocamlopt -I $(ZARITH_DIR) $(ZARITH_LIB) sail_values.ml test.ml run_test_embed.ml -o test_embed.native && \
+ ./test_embed.native
+
+interp: | $(BUILD_DIR)
+ cp test_lib.sail $(BUILD_DIR) && \
+ cp run_test_interp.ml $(BUILD_DIR) && \
+ cd $(BUILD_DIR) && \
+ $(SAIL) -lem_ast test_lib.sail -o test_lem_ast && \
+ $(LEM) -ocaml test_lem_ast.lem -lib $(SAIL_DIR)/lem_interp && \
+ ocamlfind ocamlopt -g -package num -I $(ZARITH_DIR) -I $(SAIL_DIR)/_build/lem_interp -I $(LEMLIB) -linkpkg $(ZARITH_LIB) $(LEMLIB)/extract.cmxa $(SAIL_DIR)/_build/lem_interp/extract.cmxa test_lem_ast.ml run_test_interp.ml -o test_interp.native && \
+ ./test_interp.native
+
+all:
+ true