From acfa76485c252aa2a6df199aeeaf9af6b4dc4930 Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Thu, 29 Jun 2017 17:30:53 +0100 Subject: beginnings of a sail library test suite. --- src/test/lib/Makefile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/test/lib/Makefile (limited to 'src/test/lib/Makefile') 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 -- cgit v1.2.3 From d8969b1f9631dc15d5fb6b3b33a4a69dbfb7358a Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Wed, 19 Jul 2017 14:05:04 +0100 Subject: borrow some of aa's bash code to convert library test suite output to junit xml for jenkins. --- src/test/lib/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/test/lib/Makefile') diff --git a/src/test/lib/Makefile b/src/test/lib/Makefile index 2c4036f7..35b65419 100644 --- a/src/test/lib/Makefile +++ b/src/test/lib/Makefile @@ -25,7 +25,8 @@ ocaml: | $(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 + ./test_embed.native > test_embed.out && \ + ../test_to_junit.sh < test_embed.out interp: | $(BUILD_DIR) cp test_lib.sail $(BUILD_DIR) && \ -- cgit v1.2.3 From 632b10c0d4b01dc1af8593b8ae1f088fbfd9e342 Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Wed, 19 Jul 2017 18:08:02 +0100 Subject: split library tests into separate files to avoid risk of sail compiler stack overflow. --- src/test/lib/Makefile | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'src/test/lib/Makefile') diff --git a/src/test/lib/Makefile b/src/test/lib/Makefile index 35b65419..d2185866 100644 --- a/src/test/lib/Makefile +++ b/src/test/lib/Makefile @@ -17,25 +17,39 @@ 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 $@ -ocaml: | $(BUILD_DIR) - cp test_lib.sail $(SAIL_VALUES) run_test_embed.ml $(BUILD_DIR) +$(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_lib.sail -o test && \ + $(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 > test_embed.out && \ - ../test_to_junit.sh < test_embed.out + ./test_embed.native > $(notdir $@) -interp: | $(BUILD_DIR) - cp test_lib.sail $(BUILD_DIR) && \ - cp run_test_interp.ml $(BUILD_DIR) && \ +$(BUILD_DIR)/%_interp.out : tests/%.sail $(BUILD_DIR)/run_test_interp.ml cd $(BUILD_DIR) && \ - $(SAIL) -lem_ast test_lib.sail -o test_lem_ast && \ + $(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 + ./test_interp.native >$(notdir $@) 2>&1 -all: - true +tests.xml: $(OCAML_RESULTS) $(INTERP_RESULTS) + ./test_to_junit.sh $^ -- cgit v1.2.3