diff --git a/Makefile b/Makefile index 3b486d76a4c665e775592061bdedc3c904e94cc8..91baf3d282e2097f4a543d411c09f1b09bbb8d3d 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 e506132273bbce416cf2777052b0c54ae0adac02..80e031a7d8dbc78289f7178ce30cdf929bc0f501 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 0000000000000000000000000000000000000000..5614bd517e320f81eb95aec9c5199f3eac5599cd --- /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