From 526254fe4a2c1343268abe28f4abc1ff92c377e2 Mon Sep 17 00:00:00 2001 From: kessibi <guillaume@kessibi.fr> Date: Thu, 30 Jan 2020 13:32:12 +0100 Subject: [PATCH] test suite: added -from-asml tests and modified closure.asml to use indices instead of offsets --- Makefile | 6 +++++- asml/closure.asml | 4 ++-- tests/suite_from_asml.sh | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100755 tests/suite_from_asml.sh diff --git a/Makefile b/Makefile index 3b486d7..91baf3d 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ doc: all -I _build/backend/asm_gen -I _build/frontend -d _build/doc echo -e "\e[42m\033[1mDocumentation ready at: _build/doc/index.html\033[0m" -test: clean all test_typechecking test_asml_gen test_asm_gen test_asm_output +test: clean all test_typechecking test_asml_gen test_asm_gen test_asm_output \ + test_from_asml test_typechecking: all PROG=$(PROG) ./tests/typechecking/suite.sh @@ -29,5 +30,8 @@ test_asm_gen: all test_asm_output: all PROG=$(PROG) ./tests/suite_asm_output.sh +test_from_asml: all + PROG=$(PROG) ./tests/suite_from_asml.sh + clean: rm -rf _build $(PROG) *.s *.asml ARM/*.ml* *.output diff --git a/asml/closure.asml b/asml/closure.asml index e506132..80e031a 100644 --- a/asml/closure.asml +++ b/asml/closure.asml @@ -1,5 +1,5 @@ let _add_x y = - let x = mem(%self + 4) in + let x = mem(%self + 1) in add y x let _apply_to_zero u = @@ -11,6 +11,6 @@ let _ = let add_x = new 8 in let addr_add_x = _add_x in let tu0 = mem(add_x + 0) <- addr_add_x in - let tu1 = mem(add_x + 4) <- x0 in + let tu1 = mem(add_x + 1) <- x0 in let res = call _apply_to_zero add_x in call _min_caml_print_int res diff --git a/tests/suite_from_asml.sh b/tests/suite_from_asml.sh new file mode 100755 index 0000000..5614bd5 --- /dev/null +++ b/tests/suite_from_asml.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +echo -e "\n\e[44m\033[1m---- TESTING COMPILING FROM ASML! ----\033[0m" + + +echo -e "\n\e[4m\033[1m--> All asml files\033[0m" + +for f in asml/*.asml; do + base=$(basename "$f") + printf "$base:\t" + ./$PROG -from-asml $f -o ARM/$base.s + cd ARM && make && qemu-arm $base.arm &>/dev/null && \ + printf "\e[1;32mOK \e[0m\n" || exit 1 + cd .. +done + +exit 0 -- GitLab