summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--testsuite/tests/unwind/Makefile41
-rw-r--r--testsuite/tests/unwind/check-linker-version16
-rw-r--r--testsuite/tests/unwind/driver.ml20
-rw-r--r--testsuite/tests/unwind/ocamltests1
5 files changed, 37 insertions, 43 deletions
diff --git a/.gitignore b/.gitignore
index 7520f42faf..1d26a3b4f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -291,8 +291,6 @@ _ocamltestd
/testsuite/tests/unboxed-primitive-args/main.ml
/testsuite/tests/unboxed-primitive-args/stubs.c
-/testsuite/tests/unwind/unwind_test
-
/testsuite/tests/win-unicode/symlink_tests.precheck
/testsuite/tools/expect_test
diff --git a/testsuite/tests/unwind/Makefile b/testsuite/tests/unwind/Makefile
deleted file mode 100644
index ad88faf936..0000000000
--- a/testsuite/tests/unwind/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-BASEDIR=../..
-
-# The -keep_dwarf_unwind option of ld was introduced in ld version 224.1.
-# (The last released version where it is not supported is version 136.)
-default:
- @printf " ... testing 'unwind_test':"
- @if [ ! $(SYSTEM) = macosx ]; then \
- echo " => skipped (not on Mac OSX)"; \
- elif $(BYTECODE_ONLY); then \
- echo " => skipped (bytecode only)"; \
- else \
- LDFULL="`ld -v 2>&1`"; \
- LD="`echo $$LDFULL | grep -o \"ld64-[0-9]*\"`"; \
- LDVER="`echo $$LD | sed \"s/ld64-//\"`"; \
- if [[ -z "$$LD" ]]; then \
- echo " => skipped (unknown linker: pattern ld64-[0-9]* not found" \
- echo " in 'ld -v' output)"; \
- elif [[ $$LDVER -lt 224 ]]; then \
- echo " => skipped (ld version is $$LDVER, only 224 or above " \
- echo " are supported)"; \
- else \
- $(MAKE) native_macosx_tests; \
- fi; \
- fi
-
-native_macosx_tests:
- @$(MAKE) clean ; $(MAKE) unwind_test && \
- ./unwind_test >/dev/null 2>&1 && echo " => passed" || echo " => failed"
-
-unwind_test:
- @$(OCAMLOPT) -c -opaque mylib.mli
- @$(OCAMLOPT) -c driver.ml
- @$(OCAMLOPT) -c mylib.ml
- @$(OCAMLOPT) -ccopt -I -ccopt $(CTOPDIR)/byterun -c stack_walker.c
- @$(OCAMLOPT) -cclib -Wl,-keep_dwarf_unwind -o unwind_test mylib.cmx \
- driver.cmx stack_walker.o
-
-clean:
- @rm -f *.cm* *.o unwind_test
-
-include $(BASEDIR)/makefiles/Makefile.common
diff --git a/testsuite/tests/unwind/check-linker-version b/testsuite/tests/unwind/check-linker-version
new file mode 100644
index 0000000000..0b15681e5d
--- /dev/null
+++ b/testsuite/tests/unwind/check-linker-version
@@ -0,0 +1,16 @@
+#!/bin/sh
+exec > ${ocamltest_response} 2>&1
+LDFULL="`ld -v 2>&1`"
+LD="`echo $LDFULL | grep -o \"ld64-[0-9]*\"`"
+LDVER="`echo $LD | sed \"s/ld64-//\"`"
+if [[ -z "$LD" ]]; then
+ echo "unknown linker: pattern ld64-[0-9]* not found in 'ld -v' output";
+ test_result=${TEST_SKIP};
+elif [[ $LDVER -lt 224 ]]; then
+ echo "ld version is $LDVER, only 224 or above are supported";
+ test_result=${TEST_SKIP};
+else
+ test_reslut=${TEST_PASS};
+fi
+
+exit ${TEST_RESULT}
diff --git a/testsuite/tests/unwind/driver.ml b/testsuite/tests/unwind/driver.ml
index cd289b6b35..e756ef5075 100644
--- a/testsuite/tests/unwind/driver.ml
+++ b/testsuite/tests/unwind/driver.ml
@@ -1,3 +1,23 @@
+(* TEST
+
+script = "sh ${test_source_directory}/check-linker-version"
+files = "mylib.mli mylib.ml stack_walker.c"
+
+* macos
+** script
+*** setup-ocamlopt.byte-build-env
+**** ocamlopt.byte
+flags = "-opaque"
+module = "mylib.mli"
+***** ocamlopt.byte
+module = ""
+flags = "-cclib -Wl,-keep_dwarf_unwind"
+all_modules = "mylib.ml driver.ml stack_walker.c"
+program = "${test_build_directory}/unwind_test"
+****** run
+
+*)
+
let () =
Mylib.foo1 Mylib.bar 1 2 3 4 5 6 7 8 9 10;
Mylib.foo2 Mylib.baz 1 2 3 4 5 6 7 8 9 10
diff --git a/testsuite/tests/unwind/ocamltests b/testsuite/tests/unwind/ocamltests
new file mode 100644
index 0000000000..6550b8e3dc
--- /dev/null
+++ b/testsuite/tests/unwind/ocamltests
@@ -0,0 +1 @@
+driver.ml