tweak tests/backtrace to also test ocamlopt

Note that native and byte-test share the same reference file, so in
particular they check that ocamlc and ocamlopt report uncaught
exception in the exact same way. Passing this test required a change
in asmrun/backtrace.c/print_location.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13810 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Gabriel Scherer 2013-06-19 14:05:10 +00:00
parent be7dca95f5
commit 1b1c4a4d15
1 changed files with 24 additions and 5 deletions

View File

@ -13,17 +13,36 @@
BASEDIR=../.. BASEDIR=../..
EXECNAME=program$(EXE) EXECNAME=program$(EXE)
.PHONY: run-all default:
run-all: $(MAKE) byte
@if $(BYTECODE_ONLY); then : ; else $(MAKE) native; fi
.PHONY: byte
byte:
@for file in *.ml; do \ @for file in *.ml; do \
rm -f program program.exe; \ rm -f program program.exe; \
$(OCAMLC) -g -o $(EXECNAME) $$file; \ $(OCAMLC) -g -o $(EXECNAME) $$file; \
for arg in a b c d ''; do \ for arg in a b c d ''; do \
printf " ... testing '$$file' with argument '$$arg':"; \ printf " ... testing '$$file' with ocamlc and argument '$$arg':"; \
F="`basename $$file .ml`"; \ F="`basename $$file .ml`"; \
(OCAMLRUNPARAM=b=1 $(OCAMLRUN) $(EXECNAME) $$arg || true) \ (OCAMLRUNPARAM=b=1 $(OCAMLRUN) $(EXECNAME) $$arg || true) \
>$$F.$$arg.result 2>&1; \ >$$F.$$arg.byte.result 2>&1; \
$(DIFF) $$F.$$arg.reference $$F.$$arg.result >/dev/null \ $(DIFF) $$F.$$arg.reference $$F.$$arg.byte.result >/dev/null \
&& echo " => passed" || echo " => failed"; \
done; \
done
.PHONY: native
native:
@for file in *.ml; do \
rm -f program program.exe; \
$(OCAMLOPT) -g -o $(EXECNAME) $$file; \
for arg in a b c d ''; do \
printf " ... testing '$$file' with ocamlopt and argument '$$arg':"; \
F="`basename $$file .ml`"; \
(OCAMLRUNPARAM=b=1 ./$(EXECNAME) $$arg || true) \
>$$F.$$arg.native.result 2>&1; \
$(DIFF) $$F.$$arg.reference $$F.$$arg.native.result >/dev/null \
&& echo " => passed" || echo " => failed"; \ && echo " => passed" || echo " => failed"; \
done; \ done; \
done done