summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-14 17:38:04 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-23 17:19:48 -0400
commitade3db5392d0f98cbd2e917fca926f4e08ca4fa7 (patch)
treebeb317944e361a5db31691bcc5261491a6d6c14e
parent1f2fff89afebb065b27eba0f6e1f89e25c1c158d (diff)
downloadhaskell-ade3db5392d0f98cbd2e917fca926f4e08ca4fa7.tar.gz
testsuite: Test for #13786
-rw-r--r--testsuite/tests/ghci/T13786/Makefile9
-rw-r--r--testsuite/tests/ghci/T13786/T13786.hs4
-rw-r--r--testsuite/tests/ghci/T13786/T13786.script1
-rw-r--r--testsuite/tests/ghci/T13786/T13786.stdout4
-rw-r--r--testsuite/tests/ghci/T13786/T13786a.c15
-rw-r--r--testsuite/tests/ghci/T13786/T13786b.c16
-rw-r--r--testsuite/tests/ghci/T13786/all.T2
7 files changed, 51 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/T13786/Makefile b/testsuite/tests/ghci/T13786/Makefile
new file mode 100644
index 0000000000..560fc6bb36
--- /dev/null
+++ b/testsuite/tests/ghci/T13786/Makefile
@@ -0,0 +1,9 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+.PHONY: T13786
+T13786 :
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -c -fPIC T13786a.c
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -c -fPIC T13786b.c
+ cat T13786.script | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) -v0 T13786a.o T13786b.o T13786.hs
diff --git a/testsuite/tests/ghci/T13786/T13786.hs b/testsuite/tests/ghci/T13786/T13786.hs
new file mode 100644
index 0000000000..c9b9a7363f
--- /dev/null
+++ b/testsuite/tests/ghci/T13786/T13786.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+foreign import ccall unsafe "hello_a" helloA :: IO ()
+
diff --git a/testsuite/tests/ghci/T13786/T13786.script b/testsuite/tests/ghci/T13786/T13786.script
new file mode 100644
index 0000000000..e649e6553c
--- /dev/null
+++ b/testsuite/tests/ghci/T13786/T13786.script
@@ -0,0 +1 @@
+helloA
diff --git a/testsuite/tests/ghci/T13786/T13786.stdout b/testsuite/tests/ghci/T13786/T13786.stdout
new file mode 100644
index 0000000000..a53815ed9c
--- /dev/null
+++ b/testsuite/tests/ghci/T13786/T13786.stdout
@@ -0,0 +1,4 @@
+hello world A
+hello world B
+hello world A
+
diff --git a/testsuite/tests/ghci/T13786/T13786a.c b/testsuite/tests/ghci/T13786/T13786a.c
new file mode 100644
index 0000000000..70a2774264
--- /dev/null
+++ b/testsuite/tests/ghci/T13786/T13786a.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdbool.h>
+
+static bool flag_a = false;
+
+extern void hello_b();
+
+void hello_a() {
+ if (! flag_a) {
+ flag_a = true;
+ hello_b();
+ }
+
+ printf("hello world A\n");
+}
diff --git a/testsuite/tests/ghci/T13786/T13786b.c b/testsuite/tests/ghci/T13786/T13786b.c
new file mode 100644
index 0000000000..77314ea171
--- /dev/null
+++ b/testsuite/tests/ghci/T13786/T13786b.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdbool.h>
+
+static bool flag_b = false;
+
+extern void hello_a();
+
+void hello_b() {
+ if (! flag_b) {
+ flag_b = true;
+ hello_a();
+ }
+
+ printf("hello world B\n");
+}
+
diff --git a/testsuite/tests/ghci/T13786/all.T b/testsuite/tests/ghci/T13786/all.T
new file mode 100644
index 0000000000..252657a4c1
--- /dev/null
+++ b/testsuite/tests/ghci/T13786/all.T
@@ -0,0 +1,2 @@
+test('T13786', normal, makefile_test, [])
+