[commit: ghc] master: Failing test for #10420 using plugins. (ab45de1)

git at git.haskell.org git at git.haskell.org
Fri May 15 22:22:54 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ab45de12cee5af5dcb68b2afce1826ab9bf71ba0/ghc

>---------------------------------------------------------------

commit ab45de12cee5af5dcb68b2afce1826ab9bf71ba0
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Fri May 15 14:40:37 2015 -0700

    Failing test for #10420 using plugins.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>


>---------------------------------------------------------------

ab45de12cee5af5dcb68b2afce1826ab9bf71ba0
 testsuite/.gitignore                                      |  2 ++
 testsuite/tests/plugins/Makefile                          |  5 ++++-
 testsuite/tests/plugins/Plugins07a.hs                     |  2 ++
 testsuite/tests/plugins/all.T                             |  6 ++++++
 testsuite/tests/plugins/plugins07.hs                      | 10 ++++++++++
 testsuite/tests/plugins/plugins07.stdout                  |  1 +
 .../{simple-plugin => rule-defining-plugin}/LICENSE       |  0
 .../{simple-plugin => rule-defining-plugin}/Makefile      |  2 --
 .../plugins/rule-defining-plugin/RuleDefiningPlugin.hs    |  8 ++++++++
 .../{simple-plugin => rule-defining-plugin}/Setup.hs      |  0
 .../rule-defining-plugin/rule-defining-plugin.cabal       | 15 +++++++++++++++
 11 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 422d42f..ecd0e93 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1197,6 +1197,7 @@ mk/ghcconfig*_inplace_bin_ghc-stage2.exe.mk
 /tests/plugins/plugins01
 /tests/plugins/plugins05
 /tests/plugins/plugins06
+/tests/plugins/plugins07
 /tests/plugins/simple-plugin/dist/
 /tests/plugins/simple-plugin/install/
 /tests/plugins/simple-plugin/local.package.conf
@@ -1204,6 +1205,7 @@ mk/ghcconfig*_inplace_bin_ghc-stage2.exe.mk
 /tests/plugins/simple-plugin/pkg.plugins02/
 /tests/plugins/simple-plugin/pkg.plugins03/
 /tests/plugins/simple-plugin/setup
+/tests/plugins/rule-defining-plugin/pkg.plugins07/
 /tests/polykinds/Freeman
 /tests/polykinds/MonoidsFD
 /tests/polykinds/MonoidsTF
diff --git a/testsuite/tests/plugins/Makefile b/testsuite/tests/plugins/Makefile
index ddbc7eb..aac3b12 100644
--- a/testsuite/tests/plugins/Makefile
+++ b/testsuite/tests/plugins/Makefile
@@ -2,9 +2,12 @@ TOP=../..
 include $(TOP)/mk/boilerplate.mk
 include $(TOP)/mk/test.mk
 
-.PHONY: plugins01
+.PHONY: plugins01 plugins07
 
 plugins01:
 	"$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 plugins01.hs -package-db simple-plugin/pkg.plugins01/local.package.conf -fplugin Simple.Plugin -fplugin-opt Simple.Plugin:Irrelevant_Option -package simple-plugin
 	./plugins01
 
+plugins07:
+	"$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 -O plugins07.hs -package-db rule-defining-plugin/pkg.plugins07/local.package.conf -package rule-defining-plugin
+	./plugins07
diff --git a/testsuite/tests/plugins/Plugins07a.hs b/testsuite/tests/plugins/Plugins07a.hs
new file mode 100644
index 0000000..7453a31
--- /dev/null
+++ b/testsuite/tests/plugins/Plugins07a.hs
@@ -0,0 +1,2 @@
+{-# OPTIONS_GHC -fplugin RuleDefiningPlugin #-}
+module Plugins07a where
diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T
index 8b2256a..e39c049 100644
--- a/testsuite/tests/plugins/all.T
+++ b/testsuite/tests/plugins/all.T
@@ -38,3 +38,9 @@ test('plugins06',
        only_ways([config.ghc_plugin_way]) ],
      multimod_compile_and_run, ['plugins06', '-package ghc'])
 
+test('plugins07',
+     [pre_cmd('$MAKE -s --no-print-directory -C rule-defining-plugin package.plugins07'),
+      clean_cmd('$MAKE -s --no-print-directory -C rule-defining-plugin clean.plugins07'),
+      expect_broken(10420)],
+     run_command,
+     ['$MAKE -s --no-print-directory plugins07'])
diff --git a/testsuite/tests/plugins/plugins07.hs b/testsuite/tests/plugins/plugins07.hs
new file mode 100644
index 0000000..78762a3
--- /dev/null
+++ b/testsuite/tests/plugins/plugins07.hs
@@ -0,0 +1,10 @@
+module Main where
+
+import Plugins07a
+
+import RuleDefiningPlugin
+
+{-# NOINLINE x #-}
+x = "foo"
+
+main = putStrLn (show x)
diff --git a/testsuite/tests/plugins/plugins07.stdout b/testsuite/tests/plugins/plugins07.stdout
new file mode 100644
index 0000000..d27268d
--- /dev/null
+++ b/testsuite/tests/plugins/plugins07.stdout
@@ -0,0 +1 @@
+SHOWED
diff --git a/testsuite/tests/plugins/simple-plugin/LICENSE b/testsuite/tests/plugins/rule-defining-plugin/LICENSE
similarity index 100%
copy from testsuite/tests/plugins/simple-plugin/LICENSE
copy to testsuite/tests/plugins/rule-defining-plugin/LICENSE
diff --git a/testsuite/tests/plugins/simple-plugin/Makefile b/testsuite/tests/plugins/rule-defining-plugin/Makefile
similarity index 99%
copy from testsuite/tests/plugins/simple-plugin/Makefile
copy to testsuite/tests/plugins/rule-defining-plugin/Makefile
index eb7cc6a..7d957d0 100644
--- a/testsuite/tests/plugins/simple-plugin/Makefile
+++ b/testsuite/tests/plugins/rule-defining-plugin/Makefile
@@ -12,9 +12,7 @@ package.%:
 	$(MAKE) clean.$*
 	mkdir pkg.$*
 	"$(TEST_HC)" -outputdir pkg.$* --make -v0 -o pkg.$*/setup Setup.hs
-	
 	"$(GHC_PKG)" init pkg.$*/local.package.conf
-	
 	pkg.$*/setup configure --distdir pkg.$*/dist -v0 $(CABAL_PLUGIN_BUILD) --prefix="$(HERE)/pkg.$*/install" --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=pkg.$*/local.package.conf
 	pkg.$*/setup build     --distdir pkg.$*/dist -v0
 	pkg.$*/setup install   --distdir pkg.$*/dist -v0
diff --git a/testsuite/tests/plugins/rule-defining-plugin/RuleDefiningPlugin.hs b/testsuite/tests/plugins/rule-defining-plugin/RuleDefiningPlugin.hs
new file mode 100644
index 0000000..ad66571
--- /dev/null
+++ b/testsuite/tests/plugins/rule-defining-plugin/RuleDefiningPlugin.hs
@@ -0,0 +1,8 @@
+module RuleDefiningPlugin where
+
+import GhcPlugins
+
+{-# RULES "unsound" forall x. show x = "SHOWED" #-}
+
+plugin :: Plugin
+plugin = defaultPlugin
diff --git a/testsuite/tests/plugins/simple-plugin/Setup.hs b/testsuite/tests/plugins/rule-defining-plugin/Setup.hs
similarity index 100%
copy from testsuite/tests/plugins/simple-plugin/Setup.hs
copy to testsuite/tests/plugins/rule-defining-plugin/Setup.hs
diff --git a/testsuite/tests/plugins/rule-defining-plugin/rule-defining-plugin.cabal b/testsuite/tests/plugins/rule-defining-plugin/rule-defining-plugin.cabal
new file mode 100644
index 0000000..b354f6b
--- /dev/null
+++ b/testsuite/tests/plugins/rule-defining-plugin/rule-defining-plugin.cabal
@@ -0,0 +1,15 @@
+Name:           rule-defining-plugin
+Version:        0.1
+Synopsis:       For testing
+Cabal-Version:  >= 1.2
+Build-Type:     Simple
+License:        BSD3
+License-File:   LICENSE
+Author:         Edward Z. Yang
+Homepage:       http://ezyang.com
+
+Library
+    Build-Depends: base, ghc
+    ghc-options: -O
+    Exposed-Modules:
+        RuleDefiningPlugin



More information about the ghc-commits mailing list