summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-dynlink-csharp
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib-dynlink-csharp')
-rw-r--r--testsuite/tests/lib-dynlink-csharp/Makefile122
-rw-r--r--testsuite/tests/lib-dynlink-csharp/bytecode.reference7
-rw-r--r--[-rwxr-xr-x]testsuite/tests/lib-dynlink-csharp/entry.c0
-rw-r--r--testsuite/tests/lib-dynlink-csharp/main.bytecode.reference5
-rw-r--r--[-rwxr-xr-x]testsuite/tests/lib-dynlink-csharp/main.cs0
-rw-r--r--[-rwxr-xr-x]testsuite/tests/lib-dynlink-csharp/main.ml90
-rw-r--r--testsuite/tests/lib-dynlink-csharp/main.native.reference5
-rw-r--r--testsuite/tests/lib-dynlink-csharp/native.reference7
-rw-r--r--testsuite/tests/lib-dynlink-csharp/ocamltests1
-rw-r--r--[-rwxr-xr-x]testsuite/tests/lib-dynlink-csharp/plugin.ml0
10 files changed, 93 insertions, 144 deletions
diff --git a/testsuite/tests/lib-dynlink-csharp/Makefile b/testsuite/tests/lib-dynlink-csharp/Makefile
deleted file mode 100644
index a385d1caf1..0000000000
--- a/testsuite/tests/lib-dynlink-csharp/Makefile
+++ /dev/null
@@ -1,122 +0,0 @@
-#**************************************************************************
-#* *
-#* OCaml *
-#* *
-#* Xavier Clerc, SED, INRIA Rocquencourt *
-#* *
-#* Copyright 2010 Institut National de Recherche en Informatique et *
-#* en Automatique. *
-#* *
-#* All rights reserved. This file is distributed under the terms of *
-#* the GNU Lesser General Public License version 2.1, with the *
-#* special exception on linking described in the file LICENSE. *
-#* *
-#**************************************************************************
-
-BASEDIR=../..
-# Only run this test for TOOLCHAIN=msvc
-CSC_COMMAND=$(filter csc,$(subst msvc,csc,$(TOOLCHAIN)))
-CSC=$(CSC_COMMAND) $(CSC_FLAGS)
-
-COMPFLAGS=-I $(OTOPDIR)/otherlibs/bigarray -I $(OTOPDIR)/otherlibs/dynlink \
- -I $(OTOPDIR)/byterun
-LD_PATH=$(TOPDIR)/otherlibs/win32unix:$(TOPDIR)/otherlibs/bigarray:$(TOPDIR)/otherlibs/dynlink
-
-default:
- @$(SET_LD_PATH) $(MAKE) all
-
-.PHONY: all
-all: prepare bytecode bytecode-dll native native-dll
-
-.PHONY: prepare
-prepare:
- @if $(SUPPORTS_SHARED_LIBRARIES); then \
- $(OCAMLC) -c plugin.ml && \
- if $(BYTECODE_ONLY) ; then : ; else \
- $(OCAMLOPT) -o plugin.cmxs -shared plugin.ml; \
- fi; \
- fi
-
-.PHONY: bytecode
-bytecode:
- @printf " ... testing 'bytecode':"
- @if ! $(SUPPORTS_SHARED_LIBRARIES) || ! which $(CSC_COMMAND) >/dev/null 2>&1; \
- then \
- echo " => skipped"; \
- else \
- rm -f main.exe main.dll; \
- $(OCAMLC) -output-obj -o main.dll dynlink.cma main.ml entry.c; \
- $(CSC) /nologo /nowarn:1668 /out:main.exe main.cs; \
- ./main.exe > bytecode.result; \
- $(DIFF) bytecode.reference bytecode.result >/dev/null \
- && echo " => passed" || echo " => failed"; \
- fi
-
-.PHONY: bytecode-dll
-bytecode-dll:
- @printf " ... testing 'bytecode-dll':"
- @if ! $(SUPPORTS_SHARED_LIBRARIES) || ! which $(CSC_COMMAND) > /dev/null 2>&1; \
- then \
- echo " => skipped"; \
- else \
- rm -f main.exe main_obj.$(O) main.dll; \
- $(OCAMLC) -output-obj -o main_obj.$(O) dynlink.cma entry.c main.ml; \
- $(MKDLL) -maindll -o main.dll main_obj.$(O) entry.$(O) \
- $(CTOPDIR)/byterun/libcamlrun.$(A) $(BYTECCLIBS); \
- $(CSC) /nologo /nowarn:1668 /out:main.exe main.cs; \
- ./main.exe >bytecode-dll.result; \
- $(DIFF) bytecode.reference bytecode-dll.result >/dev/null \
- && echo " => passed" || echo " => failed"; \
- fi
-
-.PHONY: native
-native:
- @printf " ... testing 'native':"
- @if ! $(SUPPORTS_SHARED_LIBRARIES) || $(BYTECODE_ONLY) \
- || ! which $(CSC_COMMAND) > /dev/null 2>&1; then \
- echo " => skipped"; \
- else \
- rm -f main.exe main.dll; \
- $(OCAMLOPT) -output-obj -o main.dll dynlink.cmxa entry.c main.ml; \
- $(CSC) /nologo /nowarn:1668 /out:main.exe main.cs; \
- ./main.exe > native.result; \
- $(DIFF) native.reference native.result > /dev/null \
- && echo " => passed" || echo " => failed"; \
- fi
-
-.PHONY: native-dll
-native-dll:
- @printf " ... testing 'native-dll':"
- @if ! $(SUPPORTS_SHARED_LIBRARIES) || $(BYTECODE_ONLY) \
- || ! which $(CSC_COMMAND) > /dev/null 2>&1; then \
- echo " => skipped"; \
- else \
- rm -f main.exe main_obj.$(O) main.dll; \
- $(OCAMLOPT) -output-obj -o main_obj.$(O) dynlink.cmxa entry.c \
- main.ml; \
- $(MKDLL) -maindll -o main.dll main_obj.$(O) entry.$(O) \
- $(CTOPDIR)/asmrun/libasmrun.lib $(NATIVECCLIBS); \
- $(CSC) /nologo /nowarn:1668 /out:main.exe main.cs; \
- ./main.exe > native-dll.result; \
- $(DIFF) native.reference native-dll.result >/dev/null \
- && echo " => passed" || echo " => failed"; \
- fi
-
-.PHONY: promote
-promote: defaultpromote
-
-.PHONY: clean
-clean: defaultclean
- @rm -f *.result *.exe *.dll *.so *.obj *.o
-
-include $(BASEDIR)/makefiles/Makefile.common
-
-ifneq ($(FLEXLINK_PREFIX),)
-MKDLL=$(WINTOPDIR)/boot/ocamlrun $(WINTOPDIR)/flexdll/flexlink.exe $(FLEXLINK_FLAGS)
-endif
-
-ifeq ($(HOST),msvc)
-CSC_FLAGS=/platform:x86
-else
-CSC_FLAGS=
-endif
diff --git a/testsuite/tests/lib-dynlink-csharp/bytecode.reference b/testsuite/tests/lib-dynlink-csharp/bytecode.reference
deleted file mode 100644
index 1c61c156e7..0000000000
--- a/testsuite/tests/lib-dynlink-csharp/bytecode.reference
+++ /dev/null
@@ -1,7 +0,0 @@
-Now starting the OCaml engine.
-Main is running.
-Loading ../../../otherlibs/win32unix/unix.cma
-Loading ../../../otherlibs/bigarray/bigarray.cma
-Loading plugin.cmo
-I'm the plugin.
-OK.
diff --git a/testsuite/tests/lib-dynlink-csharp/entry.c b/testsuite/tests/lib-dynlink-csharp/entry.c
index 12e39a5b75..12e39a5b75 100755..100644
--- a/testsuite/tests/lib-dynlink-csharp/entry.c
+++ b/testsuite/tests/lib-dynlink-csharp/entry.c
diff --git a/testsuite/tests/lib-dynlink-csharp/main.bytecode.reference b/testsuite/tests/lib-dynlink-csharp/main.bytecode.reference
new file mode 100644
index 0000000000..c162cac001
--- /dev/null
+++ b/testsuite/tests/lib-dynlink-csharp/main.bytecode.reference
@@ -0,0 +1,5 @@
+Now starting the OCaml engine.
+Main is running.
+Loading plugin.cmo
+I'm the plugin.
+OK.
diff --git a/testsuite/tests/lib-dynlink-csharp/main.cs b/testsuite/tests/lib-dynlink-csharp/main.cs
index 5cbb8e8689..5cbb8e8689 100755..100644
--- a/testsuite/tests/lib-dynlink-csharp/main.cs
+++ b/testsuite/tests/lib-dynlink-csharp/main.cs
diff --git a/testsuite/tests/lib-dynlink-csharp/main.ml b/testsuite/tests/lib-dynlink-csharp/main.ml
index 93fe830ce5..eaa2135100 100755..100644
--- a/testsuite/tests/lib-dynlink-csharp/main.ml
+++ b/testsuite/tests/lib-dynlink-csharp/main.ml
@@ -1,3 +1,83 @@
+(* TEST
+
+include dynlink
+
+files = "entry.c main.cs plugin.ml"
+
+* csharp-compiler
+** shared-libraries
+set csharp_cmd = "${csc} ${csc_flags} /out:main.exe main.cs"
+
+*** setup-ocamlc.byte-build-env
+**** ocamlc.byte
+module = "plugin.ml"
+***** ocamlc.byte
+module = ""
+flags = "-output-obj"
+program = "main.dll"
+all_modules = "dynlink.cma main.ml entry.c"
+****** script
+script = "${csharp_cmd}"
+******* run
+program = "./main.exe"
+******** check-program-output
+reference = "${test_source_directory}/main.bytecode.reference"
+
+*** setup-ocamlc.byte-build-env
+compiler_directory_suffix = "-dll"
+**** ocamlc.byte
+module = "plugin.ml"
+***** ocamlc.byte
+module = ""
+flags = "-output-obj"
+program = "main_obj.${objext}"
+all_modules = "dynlink.cma entry.c main.ml"
+****** script
+script = "${mkdll} -maindll -o main.dll main_obj.${objext} entry.${objext} ${ocamlsrcdir}/byterun/libcamlrun.lib ${bytecc_libs}"
+******* script
+script = "${csharp_cmd}"
+******** run
+program = "./main.exe"
+********* check-program-output
+reference = "${test_source_directory}/main.bytecode.reference"
+
+*** setup-ocamlopt.byte-build-env
+**** ocamlopt.byte
+program = "plugin.cmxs"
+flags = "-shared"
+all_modules = "plugin.ml"
+***** ocamlopt.byte
+flags = "-output-obj"
+program= "main.dll"
+all_modules = "dynlink.cmxa entry.c main.ml"
+****** script
+script = "${csharp_cmd}"
+******* run
+program = "./main.exe"
+******** check-program-output
+reference = "${test_source_directory}/main.native.reference"
+
+*** setup-ocamlopt.byte-build-env
+compiler_directory_suffix = "-dll"
+**** ocamlopt.byte
+program = "plugin.cmxs"
+flags = "-shared"
+all_modules = "plugin.ml"
+***** ocamlopt.byte
+flags = "-output-obj"
+program = "main_obj.${objext}"
+all_modules = "dynlink.cmxa entry.c main.ml"
+****** script
+script = "${mkdll} -maindll -o main.dll main_obj.${objext} entry.${objext} ${ocamlsrcdir}/asmrun/libasmrun.lib ${nativecc_libs}"
+******* script
+script = "${csharp_cmd}"
+******** run
+program = "./main.exe"
+********* check-program-output
+reference = "${test_source_directory}/main.native.reference"
+
+*)
+
let load s =
Printf.printf "Loading %s\n%!" s;
try
@@ -14,12 +94,6 @@ let () =
print_endline "Main is running.";
Dynlink.init ();
Dynlink.allow_unsafe_modules true;
- let s1,s2,s3 =
- Dynlink.adapt_filename "../../../otherlibs/win32unix/unix.cma",
- Dynlink.adapt_filename "../../../otherlibs/bigarray/bigarray.cma",
- Dynlink.adapt_filename "plugin.cmo"
- in
- load s1;
- load s2;
- load s3;
+ let plugin_name = Dynlink.adapt_filename "plugin.cmo" in
+ load plugin_name;
print_endline "OK."
diff --git a/testsuite/tests/lib-dynlink-csharp/main.native.reference b/testsuite/tests/lib-dynlink-csharp/main.native.reference
new file mode 100644
index 0000000000..a26525eea8
--- /dev/null
+++ b/testsuite/tests/lib-dynlink-csharp/main.native.reference
@@ -0,0 +1,5 @@
+Now starting the OCaml engine.
+Main is running.
+Loading plugin.cmxs
+I'm the plugin.
+OK.
diff --git a/testsuite/tests/lib-dynlink-csharp/native.reference b/testsuite/tests/lib-dynlink-csharp/native.reference
deleted file mode 100644
index cfb612da6d..0000000000
--- a/testsuite/tests/lib-dynlink-csharp/native.reference
+++ /dev/null
@@ -1,7 +0,0 @@
-Now starting the OCaml engine.
-Main is running.
-Loading ../../../otherlibs/win32unix/unix.cmxs
-Loading ../../../otherlibs/bigarray/bigarray.cmxs
-Loading plugin.cmxs
-I'm the plugin.
-OK.
diff --git a/testsuite/tests/lib-dynlink-csharp/ocamltests b/testsuite/tests/lib-dynlink-csharp/ocamltests
new file mode 100644
index 0000000000..d389d15661
--- /dev/null
+++ b/testsuite/tests/lib-dynlink-csharp/ocamltests
@@ -0,0 +1 @@
+main.ml
diff --git a/testsuite/tests/lib-dynlink-csharp/plugin.ml b/testsuite/tests/lib-dynlink-csharp/plugin.ml
index aacf9f21bc..aacf9f21bc 100755..100644
--- a/testsuite/tests/lib-dynlink-csharp/plugin.ml
+++ b/testsuite/tests/lib-dynlink-csharp/plugin.ml