summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bolingbroke <batterseapower@hotmail.com>2011-06-30 11:35:46 +0100
committerMax Bolingbroke <batterseapower@hotmail.com>2011-06-30 11:35:46 +0100
commit7d672220abe43ee8e4688e8babbc1c70ba6bfe88 (patch)
treea9364525ff89f336bf6eda6bac119e2824c7b2de
parent08b9bccd5254c191ef6b3ade61c94f4e0b696d99 (diff)
downloadhaskell-7d672220abe43ee8e4688e8babbc1c70ba6bfe88.tar.gz
Add expected-fail test showing plugin linking is faulty
-rw-r--r--testsuite/tests/ghc-regress/plugins/LinkerTicklingPlugin.hs15
-rw-r--r--testsuite/tests/ghc-regress/plugins/all.T2
-rw-r--r--testsuite/tests/ghc-regress/plugins/plugins06.hs6
-rw-r--r--testsuite/tests/ghc-regress/plugins/plugins06.stdout0
4 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-regress/plugins/LinkerTicklingPlugin.hs b/testsuite/tests/ghc-regress/plugins/LinkerTicklingPlugin.hs
new file mode 100644
index 0000000000..52d5e177bb
--- /dev/null
+++ b/testsuite/tests/ghc-regress/plugins/LinkerTicklingPlugin.hs
@@ -0,0 +1,15 @@
+module LinkerTicklingPlugin where
+
+import GhcPlugins
+import StaticFlags
+
+plugin :: Plugin
+plugin = defaultPlugin {
+ installCoreToDos = install
+ }
+
+-- This tests whether plugins are linking against the *running* GHC
+-- or a new instance of it. If it is a new instance the staticFlags
+-- won't have been initialised, so we'll get a GHC panic here:
+install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
+install _options todos = length staticFlags `seq` return todos
diff --git a/testsuite/tests/ghc-regress/plugins/all.T b/testsuite/tests/ghc-regress/plugins/all.T
index 41435d120b..b9d4e4497d 100644
--- a/testsuite/tests/ghc-regress/plugins/all.T
+++ b/testsuite/tests/ghc-regress/plugins/all.T
@@ -12,5 +12,7 @@ test('plugins03', normal, compile_fail, ['-package-conf simple-plugin/local.pack
test('plugins04', extra_clean(['HomePackagePlugin.hi', 'HomePackagePlugin.o']), multimod_compile_fail, ['plugins04', '-package ghc -fplugin HomePackagePlugin'])
test('plugins05', extra_clean(['HomePackagePlugin.hi', 'HomePackagePlugin.o']), multimod_compile_and_run, ['plugins05', '-package ghc'])
+test('plugins06', compose(expect_broken(3843), extra_clean(['LinkerTicklingPlugin.hi', 'LinkerTicklingPlugin.o'])), multimod_compile_and_run, ['plugins06', '-package ghc'])
+
if default_testopts.cleanup != '':
runCmd('$MAKE -C ' + in_testdir('') + ' clean')
diff --git a/testsuite/tests/ghc-regress/plugins/plugins06.hs b/testsuite/tests/ghc-regress/plugins/plugins06.hs
new file mode 100644
index 0000000000..ad80d2c636
--- /dev/null
+++ b/testsuite/tests/ghc-regress/plugins/plugins06.hs
@@ -0,0 +1,6 @@
+{-# OPTIONS_GHC -fplugin LinkerTicklingPlugin #-}
+
+module Main where
+
+main :: IO ()
+main = return ()
diff --git a/testsuite/tests/ghc-regress/plugins/plugins06.stdout b/testsuite/tests/ghc-regress/plugins/plugins06.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/ghc-regress/plugins/plugins06.stdout