summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/T13082
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2017-01-15 13:07:36 +0000
committerTamar Christina <tamar@zhox.com>2017-01-15 13:07:36 +0000
commit331f88d0d878eae926b3c1c61a3ff344916b62ed (patch)
treeaa58aa1558ad924c4bb01ca77bc34943866c9a71 /testsuite/tests/rts/T13082
parentf63c8ef33ec9666688163abe4ccf2d6c0428a7e7 (diff)
downloadhaskell-331f88d0d878eae926b3c1c61a3ff344916b62ed.tar.gz
Fix abort and import lib search on Windows
Summary: Apparently `sysErrorBelch` doesn't terminate the program anymore making previously unreachable code now execute. If a dll is not found the error message we return needs to be a heap value. Secondly also allow the pattern `lib<name>` to be allowed for finding an import library with the name `lib<name>.dll.a`. Test Plan: ./validate, new tests T13082_good and T13082_fail Reviewers: austin, RyanGlScott, hvr, erikd, simonmar, bgamari Reviewed By: RyanGlScott, bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2941 GHC Trac Issues: #13082
Diffstat (limited to 'testsuite/tests/rts/T13082')
-rw-r--r--testsuite/tests/rts/T13082/Makefile15
-rw-r--r--testsuite/tests/rts/T13082/T13082_fail.stderr3
-rw-r--r--testsuite/tests/rts/T13082/T13082_good.stdout1
-rw-r--r--testsuite/tests/rts/T13082/all.T11
-rw-r--r--testsuite/tests/rts/T13082/main.hs5
5 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/tests/rts/T13082/Makefile b/testsuite/tests/rts/T13082/Makefile
new file mode 100644
index 0000000000..1f023b0039
--- /dev/null
+++ b/testsuite/tests/rts/T13082/Makefile
@@ -0,0 +1,15 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+.PHONY: T13082_good
+T13082_good:
+ '$(TEST_CC)' -c foo.c -o foo.o
+ '$(AR)' rsc libfoo.a foo.o
+ '$(TEST_HC)' -shared foo_dll.c -o libfoo-1.dll
+ mv libfoo-1.dll.a libfoo.dll.a
+ echo main | '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) main.hs -llibfoo -L"$(PWD)"
+
+.PHONY: T13082_fail
+T13082_fail:
+ ! echo main | '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) main.hs -ldoesnotexist
diff --git a/testsuite/tests/rts/T13082/T13082_fail.stderr b/testsuite/tests/rts/T13082/T13082_fail.stderr
new file mode 100644
index 0000000000..281e16a1b5
--- /dev/null
+++ b/testsuite/tests/rts/T13082/T13082_fail.stderr
@@ -0,0 +1,3 @@
+<command line>: user specified .o/.so/.DLL could not be loaded (addDLL: doesnotexist or dependencies not loaded. (Win32 error 126))
+Whilst trying to load: (dynamic) doesnotexist
+Additional directories searched: (none)
diff --git a/testsuite/tests/rts/T13082/T13082_good.stdout b/testsuite/tests/rts/T13082/T13082_good.stdout
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/testsuite/tests/rts/T13082/T13082_good.stdout
@@ -0,0 +1 @@
+1
diff --git a/testsuite/tests/rts/T13082/all.T b/testsuite/tests/rts/T13082/all.T
new file mode 100644
index 0000000000..dd94766c48
--- /dev/null
+++ b/testsuite/tests/rts/T13082/all.T
@@ -0,0 +1,11 @@
+test('T13082_good', [ extra_clean(['libfoo.a', 'libfoo-1.dll', 'foo.o', 'main.o'])
+ , extra_files(['foo.c', 'main.hs', 'foo_dll.c'])
+ , unless(opsys('mingw32'), skip)
+ ],
+ run_command, ['$MAKE -s --no-print-directory T13082_good'])
+
+test('T13082_fail', [ extra_clean(['main.o'])
+ , extra_files(['main.hs'])
+ , unless(opsys('mingw32'), skip)
+ ],
+ run_command, ['$MAKE -s --no-print-directory T13082_fail'])
diff --git a/testsuite/tests/rts/T13082/main.hs b/testsuite/tests/rts/T13082/main.hs
new file mode 100644
index 0000000000..fbc8f5603c
--- /dev/null
+++ b/testsuite/tests/rts/T13082/main.hs
@@ -0,0 +1,5 @@
+module Main where
+
+foreign import ccall "foo" c_foo :: Int
+
+main = print c_foo