diff --git a/testsuite/tests/ghci/T13786/Makefile b/testsuite/tests/ghci/T13786/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..560fc6bb36028cad98a62799c4d934e9caabb502 --- /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 0000000000000000000000000000000000000000..c9b9a7363f70d79cebe18ba47d731b60eacc9873 --- /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 0000000000000000000000000000000000000000..e649e6553cb4ab33c211977cfdbb14ee885b319c --- /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 0000000000000000000000000000000000000000..a53815ed9c7fb91a2bbb0650bf6a42caae7e660c --- /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 0000000000000000000000000000000000000000..70a27742647465be4ceebff3824e06e971572d56 --- /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 0000000000000000000000000000000000000000..77314ea171962a8e90b6805b65c3d9d251543419 --- /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 0000000000000000000000000000000000000000..252657a4c1af3a8dda7e55832bacd3c3ba6fce52 --- /dev/null +++ b/testsuite/tests/ghci/T13786/all.T @@ -0,0 +1,2 @@ +test('T13786', normal, makefile_test, []) +