summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-05-15 14:40:37 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-05-15 15:22:38 -0700
commitab45de12cee5af5dcb68b2afce1826ab9bf71ba0 (patch)
tree34896e53c693b611cce93ad8676127c1495111b4 /testsuite
parent59720370849c0e15f207f059e54b21e4f8e05d82 (diff)
downloadhaskell-ab45de12cee5af5dcb68b2afce1826ab9bf71ba0.tar.gz
Failing test for #10420 using plugins.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/.gitignore2
-rw-r--r--testsuite/tests/plugins/Makefile5
-rw-r--r--testsuite/tests/plugins/Plugins07a.hs2
-rw-r--r--testsuite/tests/plugins/all.T6
-rw-r--r--testsuite/tests/plugins/plugins07.hs10
-rw-r--r--testsuite/tests/plugins/plugins07.stdout1
-rw-r--r--testsuite/tests/plugins/rule-defining-plugin/LICENSE10
-rw-r--r--testsuite/tests/plugins/rule-defining-plugin/Makefile18
-rw-r--r--testsuite/tests/plugins/rule-defining-plugin/RuleDefiningPlugin.hs8
-rw-r--r--testsuite/tests/plugins/rule-defining-plugin/Setup.hs3
-rw-r--r--testsuite/tests/plugins/rule-defining-plugin/rule-defining-plugin.cabal15
11 files changed, 79 insertions, 1 deletions
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 422d42f90e..ecd0e93062 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 ddbc7ebacf..aac3b1257d 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 0000000000..7453a31dea
--- /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 8b2256ac70..e39c049dfa 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 0000000000..78762a3fd1
--- /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 0000000000..d27268d74f
--- /dev/null
+++ b/testsuite/tests/plugins/plugins07.stdout
@@ -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
index 0000000000..6297f71b3f
--- /dev/null
+++ b/testsuite/tests/plugins/rule-defining-plugin/LICENSE
@@ -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
index 0000000000..7d957d0e95
--- /dev/null
+++ b/testsuite/tests/plugins/rule-defining-plugin/Makefile
@@ -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
index 0000000000..ad6657129c
--- /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/rule-defining-plugin/Setup.hs b/testsuite/tests/plugins/rule-defining-plugin/Setup.hs
new file mode 100644
index 0000000000..e8ef27dbba
--- /dev/null
+++ b/testsuite/tests/plugins/rule-defining-plugin/Setup.hs
@@ -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
index 0000000000..b354f6b8c5
--- /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