diff options
| author | Alasdair Armstrong | 2017-07-26 14:12:09 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-07-26 14:12:09 +0100 |
| commit | 678ab0e23ba4a8d95010df2bd2467dae7d544e29 (patch) | |
| tree | 0b2e02773327b9483f24b2e1ad46b7235ec9633e /src/test/lib/Makefile | |
| parent | 26e59493cde0ffbf1868426fe3bec158f2dbaad0 (diff) | |
| parent | 18cf235fad35a0e06e26ea91ee0e1c673febddb8 (diff) | |
Merge remote-tracking branch 'origin/master' into sail_new_tc
Diffstat (limited to 'src/test/lib/Makefile')
| -rw-r--r-- | src/test/lib/Makefile | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/test/lib/Makefile b/src/test/lib/Makefile new file mode 100644 index 00000000..d2185866 --- /dev/null +++ b/src/test/lib/Makefile @@ -0,0 +1,55 @@ + +# 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 + +TESTS:=$(wildcard tests/*.sail) +OCAML_RESULTS:=$(addsuffix _embed.out,$(addprefix $(BUILD_DIR)/,$(notdir $(basename $(TESTS))))) +INTERP_RESULTS:=$(addsuffix _interp.out,$(addprefix $(BUILD_DIR)/,$(notdir $(basename $(TESTS))))) + +all: tests.xml + +clean: + rm -rf $(BUILD_DIR) tests.xml + +$(BUILD_DIR): + mkdir -p $@ + +$(BUILD_DIR)/run_test_embed.ml: | $(BUILD_DIR) + cp run_test_embed.ml $(BUILD_DIR) + +$(BUILD_DIR)/run_test_interp.ml: | $(BUILD_DIR) + cp run_test_interp.ml $(BUILD_DIR) + +$(BUILD_DIR)/sail_values.ml: | $(BUILD_DIR) + cp $(SAIL_VALUES) $(BUILD_DIR) + +$(BUILD_DIR)/%_embed.out : tests/%.sail $(BUILD_DIR)/run_test_embed.ml $(BUILD_DIR)/sail_values.ml + cd $(BUILD_DIR) && \ + $(SAIL) -ocaml ../test_prelude.sail ../$< ../test_epilogue.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 > $(notdir $@) + +$(BUILD_DIR)/%_interp.out : tests/%.sail $(BUILD_DIR)/run_test_interp.ml + cd $(BUILD_DIR) && \ + $(SAIL) -lem_ast ../test_prelude.sail ../$< ../test_epilogue.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 >$(notdir $@) 2>&1 + +tests.xml: $(OCAML_RESULTS) $(INTERP_RESULTS) + ./test_to_junit.sh $^ |
