summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2011-07-20 15:39:46 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2011-07-20 15:39:46 +0100
commitae6129e489a4995a184fa52e8ea643595fbb68f4 (patch)
treed507bfa4ae74a865a4fc85b354b6bfb418ab412d
parentfda1f8adc9a8ea4c4e0ab23df252bc9c4c6ac60e (diff)
parentcc4d1ffbb959dac8c6936487ef361fb063020bf2 (diff)
downloadhaskell-ae6129e489a4995a184fa52e8ea643595fbb68f4.tar.gz
Merge branch 'master' of http://darcs.haskell.org/testsuite
-rw-r--r--testsuite/driver/testlib.py14
-rw-r--r--testsuite/tests/ghc-regress/driver/all.T4
-rw-r--r--testsuite/tests/ghc-regress/driver/recomp009/Main.hs4
-rw-r--r--testsuite/tests/ghc-regress/driver/recomp009/Makefile20
-rw-r--r--testsuite/tests/ghc-regress/driver/recomp009/Sub1.hs3
-rw-r--r--testsuite/tests/ghc-regress/driver/recomp009/Sub2.hs3
-rw-r--r--testsuite/tests/ghc-regress/driver/recomp009/all.T7
-rw-r--r--testsuite/tests/ghc-regress/driver/recomp009/recomp009.stdout2
8 files changed, 51 insertions, 6 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 2ad5764e2a..75d641f2f6 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1418,14 +1418,20 @@ def compare_outputs( kind, normaliser, extra_normaliser,
# Ignore whitespace when diffing. We should only get to this
# point if there are non-whitespace differences
- r = os.system( 'diff -uw ' + expected_normalised_file + \
- ' ' + actual_normalised_file )
+ #
+ # Note we are diffing the *actual* output, not the normalised
+ # output. The normalised output may have whitespace squashed
+ # (including newlines) so the diff would be hard to read.
+ # This does mean that the diff might contain changes that
+ # would be normalised away.
+ r = os.system( 'diff -uw ' + expected_file + \
+ ' ' + actual_file )
# If for some reason there were no non-whitespace differences,
# then do a full diff
if r == 0:
- r = os.system( 'diff -u ' + expected_normalised_file + \
- ' ' + actual_normalised_file )
+ r = os.system( 'diff -u ' + expected_file + \
+ ' ' + actual_file )
if config.accept:
if expected_file == '':
diff --git a/testsuite/tests/ghc-regress/driver/all.T b/testsuite/tests/ghc-regress/driver/all.T
index 2c8d4d9a69..1907087a5a 100644
--- a/testsuite/tests/ghc-regress/driver/all.T
+++ b/testsuite/tests/ghc-regress/driver/all.T
@@ -304,10 +304,10 @@ test('dynHelloWorld',
# simple test that we can load and use the GHC package in all ways
# (in #5313 it was failing the dyn way)
p = subprocess.Popen([config.compiler, "--print-libdir"], stdout=subprocess.PIPE)
-libdir = p.stdout.read()
+libdir = chop(p.stdout.read())
p.stdout.close
-test('5313', extra_run_opts(libdir), compile_and_run, ['-package ghc'])
+test('5313', extra_run_opts('"' + libdir + '"'), compile_and_run, ['-package ghc'])
test('2464', normal, compile, [''])
test('3674', ignore_output, run_command,
diff --git a/testsuite/tests/ghc-regress/driver/recomp009/Main.hs b/testsuite/tests/ghc-regress/driver/recomp009/Main.hs
new file mode 100644
index 0000000000..b5e5424f9b
--- /dev/null
+++ b/testsuite/tests/ghc-regress/driver/recomp009/Main.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Main where
+import Sub
+main = print $x
diff --git a/testsuite/tests/ghc-regress/driver/recomp009/Makefile b/testsuite/tests/ghc-regress/driver/recomp009/Makefile
new file mode 100644
index 0000000000..7ebcae66af
--- /dev/null
+++ b/testsuite/tests/ghc-regress/driver/recomp009/Makefile
@@ -0,0 +1,20 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+ rm -f *.o *.hi
+ rm -f B.hs C
+
+# bug #481
+
+recomp009: clean
+ cp Sub1.hs Sub.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Main.hs
+ ./Main
+ sleep 1
+ cp Sub2.hs Sub.hs
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Main.hs
+ ./Main
diff --git a/testsuite/tests/ghc-regress/driver/recomp009/Sub1.hs b/testsuite/tests/ghc-regress/driver/recomp009/Sub1.hs
new file mode 100644
index 0000000000..25ea7552e4
--- /dev/null
+++ b/testsuite/tests/ghc-regress/driver/recomp009/Sub1.hs
@@ -0,0 +1,3 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Sub where
+x = [| 1 |]
diff --git a/testsuite/tests/ghc-regress/driver/recomp009/Sub2.hs b/testsuite/tests/ghc-regress/driver/recomp009/Sub2.hs
new file mode 100644
index 0000000000..7ca8b12c33
--- /dev/null
+++ b/testsuite/tests/ghc-regress/driver/recomp009/Sub2.hs
@@ -0,0 +1,3 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Sub where
+x = [| 2 |]
diff --git a/testsuite/tests/ghc-regress/driver/recomp009/all.T b/testsuite/tests/ghc-regress/driver/recomp009/all.T
new file mode 100644
index 0000000000..368f6cf2f8
--- /dev/null
+++ b/testsuite/tests/ghc-regress/driver/recomp009/all.T
@@ -0,0 +1,7 @@
+# Test for #481, a recompilation bug with Template Haskell
+
+test('recomp009',
+ [ clean_cmd('$MAKE -s clean') ],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp009'])
+
diff --git a/testsuite/tests/ghc-regress/driver/recomp009/recomp009.stdout b/testsuite/tests/ghc-regress/driver/recomp009/recomp009.stdout
new file mode 100644
index 0000000000..1191247b6d
--- /dev/null
+++ b/testsuite/tests/ghc-regress/driver/recomp009/recomp009.stdout
@@ -0,0 +1,2 @@
+1
+2