summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Clerc <xavier.clerc@inria.fr>2010-01-25 14:17:10 +0000
committerXavier Clerc <xavier.clerc@inria.fr>2010-01-25 14:17:10 +0000
commit97edaa6cea536686e4793a8ae1f6e80467af9bff (patch)
treea08be18c565e4633543d447b3431d14a7508b14f
parentf9f9fd1b8d9f2cff64beebed5ddc770f99d6a72e (diff)
Tests moved to 'lib-dynlink-bytecode'
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9575 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--test/dynlink/Makefile54
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/Makefile36
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/custom.reference5
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/main.ml (renamed from test/dynlink/main.ml)0
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/main.reference7
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/plug1.ml (renamed from test/dynlink/plug1.ml)0
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/plug2.ml (renamed from test/dynlink/plug2.ml)0
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/static.reference5
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/stub1.c (renamed from test/dynlink/stub1.c)0
-rw-r--r--testsuite/tests/lib-dynlink-bytecode/stub2.c (renamed from test/dynlink/stub2.c)0
10 files changed, 53 insertions, 54 deletions
diff --git a/test/dynlink/Makefile b/test/dynlink/Makefile
deleted file mode 100644
index a4c396c1e..000000000
--- a/test/dynlink/Makefile
+++ /dev/null
@@ -1,54 +0,0 @@
-include ../../config/Makefile
-
-OCAMLRUN=$(BINDIR)/ocamlrun.exe
-OCAMLC=$(OCAMLRUN) $(BINDIR)/ocamlc
-OCAMLMKLIB=$(OCAMLRUN) $(BINDIR)/ocamlmklib
-
-all: demo
-
-stub1.$(O): stub1.c
- $(OCAMLC) -c stub1.c
-
-libplug1.$(A): stub1.$(O)
- $(OCAMLMKLIB) -o plug1 stub1.$(O)
-
-plug1.cmo: plug1.ml
- $(OCAMLC) -c plug1.ml
-
-plug1.cma: plug1.cmo libplug1.$(A)
- $(OCAMLMKLIB) -o plug1 plug1.cmo
-
-stub2.$(O): stub2.c
- $(OCAMLC) -c stub2.c
-
-libplug2.$(A): stub2.$(O)
- $(OCAMLMKLIB) -o plug2 stub2.$(O)
-
-plug2.cmo: plug2.ml
- $(OCAMLC) -c plug2.ml
-
-plug2.cma: plug2.cmo libplug2.$(A)
- $(OCAMLMKLIB) -o plug2 plug2.cmo
-
-main.cmo: main.ml
- $(OCAMLC) -c main.ml
-
-main.exe: main.cmo
- $(OCAMLC) -o main.exe dynlink.cma main.cmo
-
-static.exe: plug1.cma plug2.cma
- $(OCAMLC) -o static.exe -linkall plug1.cma plug2.cma -use-runtime $(OCAMLRUN)
-
-custom.exe: plug2.cma plug1.cma
- $(OCAMLC) -o custom.exe -custom -linkall plug2.cma plug1.cma
-
-demo: main.exe plug1.cma plug2.cma static.exe custom.exe
- @echo "********** Dynamic"
- -$(OCAMLRUN) ./main.exe plug1.cma plug2.cma
- @echo "********** Static"
- -$(OCAMLRUN) ./static.exe
- @echo "********** Custom"
- -./custom.exe
-
-clean:
- rm -f *.lib *.obj *.o *.a *.dll *.manifest *.exe *.cmo *.cmi *~ *.exp *.cma *.so \ No newline at end of file
diff --git a/testsuite/tests/lib-dynlink-bytecode/Makefile b/testsuite/tests/lib-dynlink-bytecode/Makefile
new file mode 100644
index 000000000..7c9e4ea86
--- /dev/null
+++ b/testsuite/tests/lib-dynlink-bytecode/Makefile
@@ -0,0 +1,36 @@
+default: compile run
+
+compile:
+ @for file in stub*.c; do \
+ $(OCAMLC) -c $$file; \
+ $(OCAMLMKLIB) -o `echo $$file | sed -e 's/stub/plug/' | sed -e 's/\.c//'` `basename $$file c`o; \
+ done
+ @for file in plug*.ml; do \
+ $(OCAMLC) -c $$file; \
+ $(OCAMLMKLIB) -o `basename $$file .ml` `basename $$file ml`cmo; \
+ done
+ @$(OCAMLC) -c main.ml
+ @$(OCAMLC) -o main dynlink.cma main.cmo
+ @$(OCAMLC) -o static -linkall plug1.cma plug2.cma -use-runtime $(PREFIX)/bin/ocamlrun
+ @$(OCAMLC) -o custom -custom -linkall plug2.cma plug1.cma -I .
+
+run:
+ @echo -n " ... testing 'main'"
+ @./main plug1.cma plug2.cma > main.result
+ @diff -q main.reference main.result > /dev/null || (echo " => failed" && exit 1)
+ @echo " => passed"
+
+ @echo -n " ... testing 'static'"
+ @./static > static.result
+ @diff -q static.reference static.result > /dev/null || (echo " => failed" && exit 1)
+ @echo " => passed"
+
+ @echo -n " ... testing 'custom'"
+ @./custom > custom.result
+ @diff -q custom.reference custom.result > /dev/null || (echo " => failed" && exit 1)
+ @echo " => passed"
+
+clean: defaultclean
+ @rm -f ./main ./static ./custom *.result
+
+include ../../makefiles/Makefile.common
diff --git a/testsuite/tests/lib-dynlink-bytecode/custom.reference b/testsuite/tests/lib-dynlink-bytecode/custom.reference
new file mode 100644
index 000000000..f7eeb3aeb
--- /dev/null
+++ b/testsuite/tests/lib-dynlink-bytecode/custom.reference
@@ -0,0 +1,5 @@
+ABCDEF
+This is stub2, calling stub1:
+This is stub1!
+Ok!
+This is stub1!
diff --git a/test/dynlink/main.ml b/testsuite/tests/lib-dynlink-bytecode/main.ml
index bd980f102..bd980f102 100644
--- a/test/dynlink/main.ml
+++ b/testsuite/tests/lib-dynlink-bytecode/main.ml
diff --git a/testsuite/tests/lib-dynlink-bytecode/main.reference b/testsuite/tests/lib-dynlink-bytecode/main.reference
new file mode 100644
index 000000000..df46049bf
--- /dev/null
+++ b/testsuite/tests/lib-dynlink-bytecode/main.reference
@@ -0,0 +1,7 @@
+Loading plug1.cma
+ABCDEF
+Loading plug2.cma
+This is stub1!
+This is stub2, calling stub1:
+This is stub1!
+Ok!
diff --git a/test/dynlink/plug1.ml b/testsuite/tests/lib-dynlink-bytecode/plug1.ml
index 324604517..324604517 100644
--- a/test/dynlink/plug1.ml
+++ b/testsuite/tests/lib-dynlink-bytecode/plug1.ml
diff --git a/test/dynlink/plug2.ml b/testsuite/tests/lib-dynlink-bytecode/plug2.ml
index 05f4fdaed..05f4fdaed 100644
--- a/test/dynlink/plug2.ml
+++ b/testsuite/tests/lib-dynlink-bytecode/plug2.ml
diff --git a/testsuite/tests/lib-dynlink-bytecode/static.reference b/testsuite/tests/lib-dynlink-bytecode/static.reference
new file mode 100644
index 000000000..32281bcf4
--- /dev/null
+++ b/testsuite/tests/lib-dynlink-bytecode/static.reference
@@ -0,0 +1,5 @@
+ABCDEF
+This is stub1!
+This is stub2, calling stub1:
+This is stub1!
+Ok!
diff --git a/test/dynlink/stub1.c b/testsuite/tests/lib-dynlink-bytecode/stub1.c
index 18ddf3f13..18ddf3f13 100644
--- a/test/dynlink/stub1.c
+++ b/testsuite/tests/lib-dynlink-bytecode/stub1.c
diff --git a/test/dynlink/stub2.c b/testsuite/tests/lib-dynlink-bytecode/stub2.c
index a11867354..a11867354 100644
--- a/test/dynlink/stub2.c
+++ b/testsuite/tests/lib-dynlink-bytecode/stub2.c