summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver/dynamicToo/dynamicTooMake
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/driver/dynamicToo/dynamicTooMake')
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/Makefile28
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/README.md5
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/Setup.hs2
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/dynamicTooMake.stderr9
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/p/CHANGELOG.md5
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/p/Lib.hs4
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/p/p.cabal34
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/q/CHANGELOG.md5
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/q/app/AppLib.hs5
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/q/app/Main.hs8
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/q/q.cabal34
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicTooMake/test.T9
12 files changed, 148 insertions, 0 deletions
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/Makefile b/testsuite/tests/driver/dynamicToo/dynamicTooMake/Makefile
new file mode 100644
index 0000000000..8e24b5a31c
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/Makefile
@@ -0,0 +1,28 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP='$(PWD)/Setup' -v0
+CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' --enable-executable-dynamic
+
+dynamicTooMake: clean
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
+ # build p
+ rm -rf p/dist
+ (cd p; $(CONFIGURE) --enable-shared --ipid "p-0.1")
+ (cd p; $(SETUP) build)
+ (cd p; $(SETUP) copy)
+ (cd p; $(SETUP) register)
+ (cd p; echo "q = 0" >> Lib.hs)
+ # build p, but only rebuild hi
+ (cd p; $(CONFIGURE) --disable-shared --ipid "p-0.1")
+ (cd p; $(SETUP) build)
+ (cd p; $(SETUP) copy)
+ (cd p; $(SETUP) register)
+ (cd q; $(CONFIGURE) --disable-shared --ipid "q-0.1")
+ # build q, should be an error as p has mismatched .hi and .dyn_hi files
+ (cd q; $(SETUP) build) || true
+
+clean :
+ $(RM) -r tmp.d inst dist Setup$(exeext)
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/README.md b/testsuite/tests/driver/dynamicToo/dynamicTooMake/README.md
new file mode 100644
index 0000000000..5b9ecd01f1
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/README.md
@@ -0,0 +1,5 @@
+Reproducer for broken implementation of DT_Failed
+
+```
+./run
+```
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/Setup.hs b/testsuite/tests/driver/dynamicToo/dynamicTooMake/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/dynamicTooMake.stderr b/testsuite/tests/driver/dynamicToo/dynamicTooMake/dynamicTooMake.stderr
new file mode 100644
index 0000000000..23225fc4fc
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/dynamicTooMake.stderr
@@ -0,0 +1,9 @@
+Warning: -rtsopts and -with-rtsopts have no effect with -shared.
+ Call hs_init_ghc() from your main() function to set these options.
+
+app/Main.hs:4:1: error:
+ Dynamic hash doesn't match for ‘Lib’
+ Normal interface file from /run/user/1000/ghctest-hbhb_f3v/test spaces/testsuite/tests/driver/dynamicToo/dynamicTooMake/dynamicTooMake.run/inst/lib/x86_64-linux-ghc-9.3.20210922/p-0.1/Lib.hi
+ Dynamic interface file from /run/user/1000/ghctest-hbhb_f3v/test spaces/testsuite/tests/driver/dynamicToo/dynamicTooMake/dynamicTooMake.run/inst/lib/x86_64-linux-ghc-9.3.20210922/p-0.1/Lib.dyn_hi
+ You probably need to recompile ‘Lib’
+make: *** [Makefile:26: dynamicTooMake] Error 1
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/CHANGELOG.md b/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/CHANGELOG.md
new file mode 100644
index 0000000000..9ede8b27d4
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for p
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/Lib.hs b/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/Lib.hs
new file mode 100644
index 0000000000..4e718cafbf
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/Lib.hs
@@ -0,0 +1,4 @@
+module Lib where
+
+{-# NOINLINE l #-}
+l = 1
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/p.cabal b/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/p.cabal
new file mode 100644
index 0000000000..a0d6c17515
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/p/p.cabal
@@ -0,0 +1,34 @@
+cabal-version: 2.4
+name: p
+version: 0.1.0.0
+
+-- A short (one-line) description of the package.
+-- synopsis:
+
+-- A longer description of the package.
+-- description:
+
+-- A URL where users can report bugs.
+-- bug-reports:
+
+-- The license under which the package is released.
+-- license:
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+
+-- A copyright notice.
+-- copyright:
+-- category:
+extra-source-files: CHANGELOG.md
+
+library
+ exposed-modules: Lib
+
+ -- Modules included in this executable, other than Main.
+ -- other-modules:
+
+ -- LANGUAGE extensions used by modules in this package.
+ -- other-extensions:
+ build-depends: base >=4.14.1.0 && <5
+ hs-source-dirs: .
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/CHANGELOG.md b/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/CHANGELOG.md
new file mode 100644
index 0000000000..62632c5376
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for q
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/app/AppLib.hs b/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/app/AppLib.hs
new file mode 100644
index 0000000000..acbae9417c
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/app/AppLib.hs
@@ -0,0 +1,5 @@
+module AppLib where
+
+a = 10
+
+
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/app/Main.hs b/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/app/Main.hs
new file mode 100644
index 0000000000..ea2b9aef96
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/app/Main.hs
@@ -0,0 +1,8 @@
+module Main where
+
+import AppLib
+import Lib
+
+main :: IO ()
+main = print (a + l )
+
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/q.cabal b/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/q.cabal
new file mode 100644
index 0000000000..723e1082d5
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/q/q.cabal
@@ -0,0 +1,34 @@
+cabal-version: 2.4
+name: q
+version: 0.1.0.0
+
+-- A short (one-line) description of the package.
+-- synopsis:
+
+-- A longer description of the package.
+-- description:
+
+-- A URL where users can report bugs.
+-- bug-reports:
+
+-- The license under which the package is released.
+-- license:
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+
+-- A copyright notice.
+-- copyright:
+-- category:
+extra-source-files: CHANGELOG.md
+
+library
+
+ -- Modules included in this executable, other than Main.
+ exposed-modules: AppLib Main
+
+ -- LANGUAGE extensions used by modules in this package.
+ -- other-extensions:
+ ghc-options: -dynamic-too
+ build-depends: base >=4.14.1.0 && < 5, p
+ hs-source-dirs: app
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/dynamicToo/dynamicTooMake/test.T b/testsuite/tests/driver/dynamicToo/dynamicTooMake/test.T
new file mode 100644
index 0000000000..f771282e69
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicTooMake/test.T
@@ -0,0 +1,9 @@
+
+test('dynamicTooMake',
+ [extra_files(['p', 'q', 'Setup.hs']),
+ when(opsys('mingw32'), expect_broken(7665)), unless(have_vanilla(), skip),
+ unless(have_dynamic(), skip),
+ copy_files,
+ grep_errmsg("Dynamic hash")
+ ],
+ makefile_test, [])