Failing test for #10420 using plugins.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Fri, 15 May 2015 21:40:37 +0000 (14:40 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Fri, 15 May 2015 22:22:38 +0000 (15:22 -0700)
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
testsuite/.gitignore
testsuite/tests/plugins/Makefile
testsuite/tests/plugins/Plugins07a.hs [new file with mode: 0644]
testsuite/tests/plugins/all.T
testsuite/tests/plugins/plugins07.hs [new file with mode: 0644]
testsuite/tests/plugins/plugins07.stdout [new file with mode: 0644]
testsuite/tests/plugins/rule-defining-plugin/LICENSE [new file with mode: 0644]
testsuite/tests/plugins/rule-defining-plugin/Makefile [new file with mode: 0644]
testsuite/tests/plugins/rule-defining-plugin/RuleDefiningPlugin.hs [new file with mode: 0644]
testsuite/tests/plugins/rule-defining-plugin/Setup.hs [new file with mode: 0644]
testsuite/tests/plugins/rule-defining-plugin/rule-defining-plugin.cabal [new file with mode: 0644]

index 422d42f..ecd0e93 100644 (file)
@@ -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
index ddbc7eb..aac3b12 100644 (file)
@@ -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 (file)
index 0000000..7453a31
--- /dev/null
@@ -0,0 +1,2 @@
+{-# OPTIONS_GHC -fplugin RuleDefiningPlugin #-}
+module Plugins07a where
index 8b2256a..e39c049 100644 (file)
@@ -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 (file)
index 0000000..78762a3
--- /dev/null
@@ -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 (file)
index 0000000..d27268d
--- /dev/null
@@ -0,0 +1 @@
+SHOWED
diff --git a/testsuite/tests/plugins/rule-defining-plugin/LICENSE b/testsuite/tests/plugins/rule-defining-plugin/LICENSE
new file mode 100644 (file)
index 0000000..6297f71
--- /dev/null
@@ -0,0 +1,10 @@
+Copyright (c) 2008, Max Bolingbroke
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the name of Max Bolingbroke nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/testsuite/tests/plugins/rule-defining-plugin/Makefile b/testsuite/tests/plugins/rule-defining-plugin/Makefile
new file mode 100644 (file)
index 0000000..7d957d0
--- /dev/null
@@ -0,0 +1,18 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+clean.%:
+       rm -rf pkg.$*
+
+HERE := $(abspath .)
+$(eval $(call canonicalise,HERE))
+
+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 (file)
index 0000000..ad66571
--- /dev/null
@@ -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/rule-defining-plugin/Setup.hs b/testsuite/tests/plugins/rule-defining-plugin/Setup.hs
new file mode 100644 (file)
index 0000000..e8ef27d
--- /dev/null
@@ -0,0 +1,3 @@
+import Distribution.Simple
+
+main = defaultMain
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 (file)
index 0000000..b354f6b
--- /dev/null
@@ -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