summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-14 17:38:04 -0400
committerBen Gamari <ben@smart-cactus.org>2019-06-25 18:33:43 -0400
commitbbf5dfa68edac55b6700a981977ae5421ff07536 (patch)
treebd57748937b201667b81b74326427c14e5441d8c
parent1c06d9e7f3d50e712c705a3ca8c6026a2a8cc74b (diff)
downloadhaskell-bbf5dfa68edac55b6700a981977ae5421ff07536.tar.gz
testsuite: Test for #13786
(cherry picked from commit 652b83be7a13f35deefc778d89fd11c9dd46cfa3)
-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..fe02c37543
--- /dev/null
+++ b/testsuite/tests/ghci/T13786/all.T
@@ -0,0 +1,2 @@
+test('T13786', normal, run_command, ['$MAKE -s --no-print-directory T13786'])
+