make the testsuite work without installing OCaml

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13682 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Damien Doligez 2013-05-16 12:20:59 +00:00
parent 5a1a95f5e6
commit 1a2c1ed3e2
12 changed files with 49 additions and 27 deletions

View File

@ -11,7 +11,7 @@
#########################################################################
BASEDIR=../..
EXECNAME=./program$(EXE)
EXECNAME=program$(EXE)
.PHONY: run-all
run-all:
@ -21,7 +21,7 @@ run-all:
for arg in a b c d ''; do \
printf " ... testing '$$file' with argument '$$arg':"; \
F="`basename $$file .ml`"; \
(OCAMLRUNPARAM=b=1 $(EXECNAME) $$arg || true) \
(OCAMLRUNPARAM=b=1 $(OCAMLRUN) $(EXECNAME) $$arg || true) \
>$$F.$$arg.result 2>&1; \
$(DIFF) $$F.$$arg.reference $$F.$$arg.result >/dev/null \
&& echo " => passed" || echo " => failed"; \

View File

@ -12,8 +12,10 @@
BASEDIR=../..
.PHONY: default
default: compile run
.PHONY: compile
compile:
@$(OCAMLC) -c registry.ml
@for file in stub*.c; do \
@ -26,31 +28,36 @@ compile:
$(OCAMLMKLIB) -o `basename $$file .ml` `basename $$file ml`cmo; \
done
@$(OCAMLC) -c main.ml
@rm -f main static custom custom.exe
@$(OCAMLC) -o main dynlink.cma registry.cmo main.cmo
@$(OCAMLC) -o static -linkall registry.cmo plug1.cma plug2.cma \
-use-runtime $(OTOPDIR)/byterun/ocamlrun
@$(OCAMLC) -o custom -custom -linkall registry.cmo plug2.cma \
-use-runtime $(OTOPDIR)/boot/ocamlrun$(EXE)
@$(OCAMLC) -o custom$(EXE) -custom -linkall registry.cmo plug2.cma \
plug1.cma -I .
.PHONY: run
run:
@printf " ... testing 'main'"
@LD_LIBRARY_PATH="`pwd`" ./main plug1.cma plug2.cma >main.result
@LD_LIBRARY_PATH="`pwd`" $(OCAMLRUN) ./main plug1.cma plug2.cma \
>main.result
@$(DIFF) main.reference main.result >/dev/null \
&& echo " => passed" || echo " => failed"
@printf " ... testing 'static'"
@LD_LIBRARY_PATH="`pwd`" ./static >static.result
@LD_LIBRARY_PATH="`pwd`" $(OCAMLRUN) ./static >static.result
@$(DIFF) static.reference static.result >/dev/null \
&& echo " => passed" || echo " => failed"
@printf " ... testing 'custom'"
@LD_LIBRARY_PATH="`pwd`" ./custom > custom.result
@LD_LIBRARY_PATH="`pwd`" ./custom$(EXE) > custom.result
@$(DIFF) custom.reference custom.result >/dev/null \
&& echo " => passed" || echo " => failed"
.PHONY: promote
promote: defaultpromote
.PHONY: clean
clean: defaultclean
@rm -f ./main ./static ./custom *.result marshal.data
@rm -f main static custom custom.exe *.result marshal.data
include $(BASEDIR)/makefiles/Makefile.common

View File

@ -12,32 +12,41 @@
BASEDIR=../..
.PHONY: default
default: compile run
.PHONY: compile
compile: tscanf2_io.cmo
@rm -f master.byte master.native master.native.exe
@rm -f slave.byte slave.native slave.native.exe
@$(OCAMLC) unix.cma tscanf2_io.cmo -o master.byte tscanf2_master.ml
@$(OCAMLC) tscanf2_io.cmo -o slave.byte tscanf2_slave.ml
@if $(BYTECODE_ONLY); then : ; else \
$(MAKE) tscanf2_io.cmx; \
$(OCAMLOPT) unix.cmxa tscanf2_io.cmx -o master.native \
$(OCAMLOPT) unix.cmxa tscanf2_io.cmx -o master.native$(EXE) \
tscanf2_master.ml; \
$(OCAMLOPT) tscanf2_io.cmx -o slave.native tscanf2_slave.ml; \
$(OCAMLOPT) tscanf2_io.cmx -o slave.native$(EXE) tscanf2_slave.ml; \
fi
run:
@printf " ... testing with ocamlc"
@./master.byte "`$(CYGPATH) ./slave.byte`" >result.byte 2>&1
@$(OCAMLRUN) ./master.byte "$(OTOPDIR)/boot/ocamlrun$(EXE) \
`$(CYGPATH) ./slave.byte`" \
>result.byte 2>&1
@$(DIFF) reference result.byte >/dev/null \
&& if $(BYTECODE_ONLY); then : ; else \
printf " ocamlopt"; \
./master.native "`$(CYGPATH) ./slave.native`" >result.native 2>&1;\
./master.native$(EXE) "`$(CYGPATH) ./slave.native`" \
>result.native 2>&1; \
$(DIFF) reference result.native >/dev/null; \
fi \
&& echo " => passed" || echo " => failed"
.PHONY: promote
promote:
@cp result.byte reference
.PHONY: clean
clean: defaultclean
@rm -f master.* slave.* result.*

View File

@ -10,7 +10,7 @@
# #
#########################################################################
./program > test3.result &
$RUNTIME ./program >test3.result &
pid=$!
sleep 5
kill -9 $pid

View File

@ -10,4 +10,4 @@
# #
#########################################################################
./program < test4.data > test4.result 2> /dev/null || true
$RUNTIME ./program <test4.data >test4.result 2>/dev/null || true

View File

@ -10,7 +10,7 @@
# #
#########################################################################
./program > test5.result &
$RUNTIME ./program >test5.result &
pid=$!
sleep 3
kill -9 $pid

View File

@ -10,7 +10,7 @@
# #
#########################################################################
./program > test6.result &
$RUNTIME ./program >test6.result &
pid=$!
sleep 1
kill -9 $pid

View File

@ -10,7 +10,7 @@
# #
#########################################################################
./program > test7.result &
$RUNTIME ./program >test7.result &
pid=$!
sleep 1
kill -9 $pid

View File

@ -10,7 +10,7 @@
# #
#########################################################################
./program > testsignal.result &
$RUNTIME ./program >testsignal.result &
pid=$!
sleep 3
kill -INT $pid

View File

@ -10,7 +10,7 @@
# #
#########################################################################
./program > testsignal2.result &
$RUNTIME ./program >testsignal2.result &
pid=$!
sleep 3
kill -INT $pid

View File

@ -10,4 +10,4 @@
# #
#########################################################################
./program < torture.data > torture.result 2> /dev/null || true
$RUNTIME ./program <torture.data >torture.result 2>/dev/null || true

View File

@ -12,37 +12,43 @@
BASEDIR=../..
.PHONY: default
default: compile run
.PHONY: compile
compile:
@for f in *.ml; do \
$(OCAMLC) -w a -o `basename $$f ml`bytecode $$f; \
F=`basename $$f .ml`; \
rm -f $$F.bytecode $$F.native $$F.native.exe; \
$(OCAMLC) -w a -o $$F.bytecode $$f; \
if $(BYTECODE_ONLY); then : ; else \
$(OCAMLOPT) -w a -o `basename $$f ml`native $$f; \
$(OCAMLOPT) -w a -o $$F.native$(EXE) $$f; \
fi; \
done
@grep -q HAS_STACK_OVERFLOW_DETECTION $(TOPDIR)/config/s.h \
|| rm -f stackoverflow.native
|| rm -f stackoverflow.native$(EXE)
run:
@ulimit -s 1024; \
for f in *.bytecode; do \
printf " ... testing '$$f':"; \
(./$$f > $$f.result 2>&1 || true); \
$(OCAMLRUN) ./$$f >$$f.result 2>&1 || true; \
DIFF="$(DIFF)" sh $$f.checker \
&& echo " => passed" || echo " => failed"; \
fn=`basename $$f bytecode`native; \
if $(BYTECODE_ONLY) || [ ! -f "$$fn" ] ; then : ; else \
if $(BYTECODE_ONLY) || [ ! -f "$${fn}$(EXE)" ] ; then : ; else \
printf " ... testing '$$fn':"; \
(./$$fn > $$fn.result 2>&1 || true); \
./$${fn}$(EXE) >$$fn.result 2>&1 || true; \
DIFF="$(DIFF)" sh $$fn.checker \
&& echo " => passed" || echo " => failed"; \
fi; \
done
.PHONY: promote
promote: defaultpromote
.PHONY: clean
clean: defaultclean
@rm -f *.bytecode *.native *.result
@rm -f *.bytecode *.native *.native.exe *.result
include $(BASEDIR)/makefiles/Makefile.common