[commit: testsuite] master: add a test for #7215 (416ebfc)

Simon Marlow <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/416ebfc8d159c9e8c86257cc4958bfd607e9c35f

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

commit 416ebfc8d159c9e8c86257cc4958bfd607e9c35f
Author: Simon Marlow <[email protected]>
Date:   Wed Sep 5 16:18:01 2012 +0100

    add a test for #7215

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

 tests/driver/recomp012/Makefile         |   30 ++++++++++++++++++++++++++++++
 tests/driver/recomp012/all.T            |    7 +++++++
 tests/driver/recomp012/recomp012.stdout |    2 ++
 3 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/tests/driver/recomp012/Makefile b/tests/driver/recomp012/Makefile
new file mode 100644
index 0000000..180f08d
--- /dev/null
+++ b/tests/driver/recomp012/Makefile
@@ -0,0 +1,30 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# -fforce-recomp makes lots of driver tests trivially pass, so we
+# filter it out from $(TEST_HC_OPTS).
+TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS))
+
+# Recompilation tests
+
+clean:
+	rm -f *.o *.hi
+	rm -f MyBool.hs Foo.hs Main.hs
+	rm -f Main$(exeext)
+
+# bug #7215
+
+recomp012: clean
+	echo 'module MyBool where data MyBool = MyFalse | MyTrue deriving Show' >MyBool.hs
+	echo 'module Foo where import MyBool; foo = MyFalse' > Foo.hs
+	echo 'import Foo; main = print foo' > Main.hs
+	'$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -v0 -c -O2 MyBool.hs
+	'$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -v0 -c -O2 Foo.hs
+	'$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -v0 -O2 Main.hs
+	./Main
+	sleep 1
+	echo 'module Foo where import MyBool; foo = MyTrue' > Foo.hs
+	'$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -v0 -c -O2 Foo.hs
+	'$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -v0 -O2 Main.hs
+	./Main
diff --git a/tests/driver/recomp012/all.T b/tests/driver/recomp012/all.T
new file mode 100644
index 0000000..869fae7
--- /dev/null
+++ b/tests/driver/recomp012/all.T
@@ -0,0 +1,7 @@
+# Test for #7215, a recompilation bug
+
+test('recomp012',
+     [ clean_cmd('$MAKE -s clean') ],
+     run_command,
+     ['$MAKE -s --no-print-directory recomp012'])
+
diff --git a/tests/driver/recomp012/recomp012.stdout b/tests/driver/recomp012/recomp012.stdout
new file mode 100644
index 0000000..568a17c
--- /dev/null
+++ b/tests/driver/recomp012/recomp012.stdout
@@ -0,0 +1,2 @@
+MyFalse
+MyTrue
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.