summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/driver/testglobals.py3
-rw-r--r--testsuite/driver/testlib.py10
-rw-r--r--testsuite/driver/testutil.py13
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex03.stderr2
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex04.stderr2
-rw-r--r--testsuite/tests/determinism/determ002/determ002.stdout2
-rw-r--r--testsuite/tests/determinism/determ005/determ005.stdout2
-rw-r--r--testsuite/tests/determinism/determ006/determ006.stdout2
-rw-r--r--testsuite/tests/driver/Makefile6
-rw-r--r--testsuite/tests/driver/OneShotTH.hs4
-rw-r--r--testsuite/tests/driver/OneShotTH.stdout1
-rw-r--r--testsuite/tests/driver/T16511/B.hs4
-rw-r--r--testsuite/tests/driver/T16511/C.hs2
-rw-r--r--testsuite/tests/driver/T16511/T16511.stdout2
-rw-r--r--testsuite/tests/driver/T16608/T16608_1.stdout2
-rw-r--r--testsuite/tests/driver/T16608/T16608_2.stdout2
-rw-r--r--testsuite/tests/driver/all.T1
-rw-r--r--testsuite/tests/driver/recomp-boot/recomp-boot.stdout2
-rw-r--r--testsuite/tests/driver/recomp-boot2/recomp-boot2.stdout2
-rw-r--r--testsuite/tests/driver/recomp004/Makefile2
-rw-r--r--testsuite/tests/driver/recomp005/recomp005.stdout2
-rw-r--r--testsuite/tests/driver/recomp006/recomp006.stdout2
-rw-r--r--testsuite/tests/driver/recomp007/recomp007.stdout2
-rw-r--r--testsuite/tests/driver/recomp013/recomp013.stdout2
-rw-r--r--testsuite/tests/driver/recomp016/recomp016.stdout2
-rw-r--r--testsuite/tests/driver/recomp017/Makefile1
-rw-r--r--testsuite/tests/driver/recomp019/recomp019.stdout4
-rw-r--r--testsuite/tests/driver/recomp16885/M.hs2
-rw-r--r--testsuite/tests/driver/recomp16885/M1.hs4
-rw-r--r--testsuite/tests/driver/recomp16885/M2A.hs1
-rw-r--r--testsuite/tests/driver/recomp16885/M2B.hs2
-rw-r--r--testsuite/tests/driver/recomp16885/M3.hs1
-rw-r--r--testsuite/tests/driver/recomp16885/Makefile12
-rw-r--r--testsuite/tests/driver/recomp16885/all.T3
-rw-r--r--testsuite/tests/driver/recomp16885/recomp16885.stdout5
-rw-r--r--testsuite/tests/driver/recompChangedPackage/Main.hs6
-rw-r--r--testsuite/tests/driver/recompChangedPackage/Makefile37
-rw-r--r--testsuite/tests/driver/recompChangedPackage/PLib1.hs6
-rw-r--r--testsuite/tests/driver/recompChangedPackage/Setup.hs2
-rw-r--r--testsuite/tests/driver/recompChangedPackage/all.T19
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/CHANGELOG.md5
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/LICENSE1
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/Main.hs6
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/PLib.hs7
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/QLib.hs3
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/Setup.hs2
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/q.cabal25
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/q.cabal125
-rw-r--r--testsuite/tests/driver/recompChangedPackage/q/q.cabal225
-rw-r--r--testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout10
-rw-r--r--testsuite/tests/driver/recompHash/A.hs6
-rw-r--r--testsuite/tests/driver/recompHash/B.hs3
-rw-r--r--testsuite/tests/driver/recompHash/Makefile17
-rw-r--r--testsuite/tests/driver/recompHash/all.T3
-rw-r--r--testsuite/tests/driver/recompHash/recompHash.stdout2
-rw-r--r--testsuite/tests/driver/recompNoTH/A.hs6
-rw-r--r--testsuite/tests/driver/recompNoTH/B1.hs3
-rw-r--r--testsuite/tests/driver/recompNoTH/B2.hs3
-rw-r--r--testsuite/tests/driver/recompNoTH/Makefile19
-rw-r--r--testsuite/tests/driver/recompNoTH/all.T3
-rw-r--r--testsuite/tests/driver/recompNoTH/recompNoTH.stdout3
-rw-r--r--testsuite/tests/driver/recompPluginPackage/Makefile30
-rw-r--r--testsuite/tests/driver/recompPluginPackage/README.md9
-rw-r--r--testsuite/tests/driver/recompPluginPackage/Setup.hs2
-rw-r--r--testsuite/tests/driver/recompPluginPackage/all.T20
-rw-r--r--testsuite/tests/driver/recompPluginPackage/cabal.project2
-rw-r--r--testsuite/tests/driver/recompPluginPackage/p/CHANGELOG.md5
-rw-r--r--testsuite/tests/driver/recompPluginPackage/p/LICENSE1
-rw-r--r--testsuite/tests/driver/recompPluginPackage/p/Lib1.hs5
-rw-r--r--testsuite/tests/driver/recompPluginPackage/p/Lib2.hs5
-rw-r--r--testsuite/tests/driver/recompPluginPackage/p/Main.hs4
-rw-r--r--testsuite/tests/driver/recompPluginPackage/p/Setup.hs2
-rw-r--r--testsuite/tests/driver/recompPluginPackage/p/p.cabal24
-rw-r--r--testsuite/tests/driver/recompPluginPackage/q/CHANGELOG.md5
-rw-r--r--testsuite/tests/driver/recompPluginPackage/q/LICENSE1
-rw-r--r--testsuite/tests/driver/recompPluginPackage/q/Main.hs4
-rw-r--r--testsuite/tests/driver/recompPluginPackage/q/Plugin.hs15
-rw-r--r--testsuite/tests/driver/recompPluginPackage/q/Setup.hs2
-rw-r--r--testsuite/tests/driver/recompPluginPackage/q/q.cabal26
-rw-r--r--testsuite/tests/driver/recompPluginPackage/recompPluginPackage.stderr-mingw3212
-rw-r--r--testsuite/tests/driver/recompPluginPackage/recompPluginPackage.stdout2
-rw-r--r--testsuite/tests/driver/recompTH/A.hs6
-rw-r--r--testsuite/tests/driver/recompTH/B1.hs5
-rw-r--r--testsuite/tests/driver/recompTH/B2.hs5
-rw-r--r--testsuite/tests/driver/recompTH/Makefile20
-rw-r--r--testsuite/tests/driver/recompTH/all.T4
-rw-r--r--testsuite/tests/driver/recompTH/recompTH.stdout4
-rw-r--r--testsuite/tests/driver/recompTHpackage/Makefile32
-rw-r--r--testsuite/tests/driver/recompTHpackage/README.md9
-rw-r--r--testsuite/tests/driver/recompTHpackage/Setup.hs2
-rw-r--r--testsuite/tests/driver/recompTHpackage/all.T19
-rw-r--r--testsuite/tests/driver/recompTHpackage/cabal.project2
-rw-r--r--testsuite/tests/driver/recompTHpackage/p/CHANGELOG.md5
-rw-r--r--testsuite/tests/driver/recompTHpackage/p/LICENSE1
-rw-r--r--testsuite/tests/driver/recompTHpackage/p/Lib1.hs7
-rw-r--r--testsuite/tests/driver/recompTHpackage/p/Lib2.hs7
-rw-r--r--testsuite/tests/driver/recompTHpackage/p/Main.hs4
-rw-r--r--testsuite/tests/driver/recompTHpackage/p/Setup.hs2
-rw-r--r--testsuite/tests/driver/recompTHpackage/p/p.cabal24
-rw-r--r--testsuite/tests/driver/recompTHpackage/q/CHANGELOG.md5
-rw-r--r--testsuite/tests/driver/recompTHpackage/q/LICENSE1
-rw-r--r--testsuite/tests/driver/recompTHpackage/q/Main.hs6
-rw-r--r--testsuite/tests/driver/recompTHpackage/q/Setup.hs2
-rw-r--r--testsuite/tests/driver/recompTHpackage/q/q.cabal25
-rw-r--r--testsuite/tests/driver/recompTHpackage/recompTHpackage.stdout2
-rw-r--r--testsuite/tests/driver/retc001/retc001.stdout2
-rw-r--r--testsuite/tests/driver/th-new-test/A.hs6
-rw-r--r--testsuite/tests/driver/th-new-test/B.hs5
-rw-r--r--testsuite/tests/driver/th-new-test/B1.hs5
-rw-r--r--testsuite/tests/driver/th-new-test/C.hs6
-rw-r--r--testsuite/tests/driver/th-new-test/D.hs5
-rw-r--r--testsuite/tests/driver/th-new-test/D1.hs5
-rw-r--r--testsuite/tests/driver/th-new-test/Main.hs6
-rw-r--r--testsuite/tests/driver/th-new-test/Makefile29
-rw-r--r--testsuite/tests/driver/th-new-test/all.T4
-rw-r--r--testsuite/tests/driver/th-new-test/th-new-test.stdout17
-rw-r--r--testsuite/tests/gadt/Makefile6
-rw-r--r--testsuite/tests/gadt/all.T2
-rw-r--r--testsuite/tests/ghc-api/T6145.hs3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/all.T2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/break022.script6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/all.T2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/break023.script6
-rw-r--r--testsuite/tests/ghci/prog001/prog001.script5
-rw-r--r--testsuite/tests/ghci/prog005/prog005.T2
-rw-r--r--testsuite/tests/ghci/prog005/prog005.script8
-rw-r--r--testsuite/tests/ghci/recompTHghci/A.hs6
-rw-r--r--testsuite/tests/ghci/recompTHghci/B1.hs5
-rw-r--r--testsuite/tests/ghci/recompTHghci/B2.hs5
-rw-r--r--testsuite/tests/ghci/recompTHghci/Makefile3
-rw-r--r--testsuite/tests/ghci/recompTHghci/all.T6
-rw-r--r--testsuite/tests/ghci/recompTHghci/recompTHghci.script24
-rw-r--r--testsuite/tests/ghci/recompTHghci/recompTHghci.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/Defer03_before.hs (renamed from testsuite/tests/ghci/scripts/Defer03.hs)0
-rw-r--r--testsuite/tests/ghci/scripts/T17669.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/T1914.script9
-rw-r--r--testsuite/tests/ghci/scripts/T1914.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/T8042.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/T8353.script14
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T10
-rw-r--r--testsuite/tests/ghci/scripts/ghci063.script25
-rw-r--r--testsuite/tests/ghci/scripts/ghci063.stderr2
-rw-r--r--testsuite/tests/perf/compiler/Makefile4
-rw-r--r--testsuite/tests/perf/compiler/all.T16
-rw-r--r--testsuite/tests/perf/space_leaks/T4029.script216
-rw-r--r--testsuite/tests/perf/space_leaks/all.T2
-rw-r--r--testsuite/tests/plugins/all.T2
-rw-r--r--testsuite/tests/plugins/plugins-ghci.hs4
-rw-r--r--testsuite/tests/plugins/plugins-ghci.stdout1
149 files changed, 1044 insertions, 183 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index c7140387af..dd063f0c73 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -421,6 +421,9 @@ class TestOptions:
# in temporary directory in /tmp? See Note [Running tests in /tmp].
self.local = True
+ # Should we copy the files of symlink the files for the test?
+ self.copy_files = False
+
# The default set of options
global default_testopts
default_testopts = TestOptions()
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 13c32da1f6..57bfe82bae 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -695,6 +695,11 @@ def _outputdir( name, opts, odir ):
# ----
+def copy_files(name, opts):
+ opts.copy_files = True
+
+# ----
+
def pre_cmd( cmd ):
return lambda name, opts, c=cmd: _pre_cmd(name, opts, cmd)
@@ -1133,13 +1138,14 @@ def do_test(name: TestName,
for extra_file in files:
src = in_srcdir(extra_file)
dst = in_testdir(os.path.basename(extra_file.rstrip('/\\')))
+ force_copy = opts.copy_files
if src.is_file():
- link_or_copy_file(src, dst)
+ link_or_copy_file(src, dst, force_copy)
elif src.is_dir():
if dst.exists():
shutil.rmtree(str(dst))
dst.mkdir()
- lndir(src, dst)
+ lndir(src, dst, force_copy)
else:
if not config.haddock and os.path.splitext(extra_file)[1] == '.t':
# When using a ghc built without haddock support, .t
diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py
index bcea98bd17..48f33b1540 100644
--- a/testsuite/driver/testutil.py
+++ b/testsuite/driver/testutil.py
@@ -62,7 +62,7 @@ def getStdout(cmd_and_args: List[str]):
raise Exception("stderr from command: %s\nOutput:\n%s\n" % (cmd_and_args, stderr.decode('utf-8')))
return stdout.decode('utf-8')
-def lndir(srcdir: Path, dstdir: Path):
+def lndir(srcdir: Path, dstdir: Path, force_copy=False):
# Create symlinks for all files in src directory.
# Not all developers might have lndir installed.
# os.system('lndir -silent {0} {1}'.format(srcdir, dstdir))
@@ -71,7 +71,7 @@ def lndir(srcdir: Path, dstdir: Path):
src = srcdir / base
dst = dstdir / base
if src.is_file():
- link_or_copy_file(src, dst)
+ link_or_copy_file(src, dst, force_copy)
else:
dst.mkdir()
lndir(src, dst)
@@ -116,11 +116,14 @@ def symlinks_work() -> bool:
return True
if not symlinks_work():
- def link_or_copy_file(src: Path, dst: Path):
+ def link_or_copy_file(src: Path, dst: Path, force_copy=False):
shutil.copyfile(str(src), str(dst))
else:
- def link_or_copy_file(src: Path, dst: Path):
- os.symlink(str(src), str(dst))
+ def link_or_copy_file(src: Path, dst: Path, force_copy=False):
+ if force_copy:
+ shutil.copyfile(str(src), str(dst))
+ else:
+ os.symlink(str(src), str(dst))
class Watcher(object):
def __init__(self, count: int) -> None:
diff --git a/testsuite/tests/backpack/reexport/bkpreex03.stderr b/testsuite/tests/backpack/reexport/bkpreex03.stderr
index 7d900da7d2..0fc295c018 100644
--- a/testsuite/tests/backpack/reexport/bkpreex03.stderr
+++ b/testsuite/tests/backpack/reexport/bkpreex03.stderr
@@ -2,4 +2,4 @@
[1 of 4] Compiling M1 ( p/M1.hs, nothing )
[2 of 4] Compiling M2 ( p/M2.hs, nothing )
[3 of 4] Compiling A[sig] ( p/A.hsig, nothing )
- [4 of 4] Compiling A[sig] ( p/A.hsig, nothing )
+ [4 of 4] Compiling A[sig] ( p/A.hsig, nothing ) [M2 added]
diff --git a/testsuite/tests/backpack/reexport/bkpreex04.stderr b/testsuite/tests/backpack/reexport/bkpreex04.stderr
index a21cf89027..83c42910d6 100644
--- a/testsuite/tests/backpack/reexport/bkpreex04.stderr
+++ b/testsuite/tests/backpack/reexport/bkpreex04.stderr
@@ -1,4 +1,4 @@
[1 of 1] Processing p
[1 of 3] Compiling A[sig] ( p/A.hsig, nothing )
[2 of 3] Compiling B[sig] ( p/B.hsig, nothing )
- [3 of 3] Compiling A[sig] ( p/A.hsig, nothing )
+ [3 of 3] Compiling A[sig] ( p/A.hsig, nothing ) [B added]
diff --git a/testsuite/tests/determinism/determ002/determ002.stdout b/testsuite/tests/determinism/determ002/determ002.stdout
index 60c2bc368d..c9b56f14dc 100644
--- a/testsuite/tests/determinism/determ002/determ002.stdout
+++ b/testsuite/tests/determinism/determ002/determ002.stdout
@@ -1,2 +1,2 @@
[1 of 1] Compiling A ( A.hs, A.o )
-[1 of 1] Compiling A ( A.hs, A.o )
+[1 of 1] Compiling A ( A.hs, A.o ) [Missing object file]
diff --git a/testsuite/tests/determinism/determ005/determ005.stdout b/testsuite/tests/determinism/determ005/determ005.stdout
index 60c2bc368d..c9b56f14dc 100644
--- a/testsuite/tests/determinism/determ005/determ005.stdout
+++ b/testsuite/tests/determinism/determ005/determ005.stdout
@@ -1,2 +1,2 @@
[1 of 1] Compiling A ( A.hs, A.o )
-[1 of 1] Compiling A ( A.hs, A.o )
+[1 of 1] Compiling A ( A.hs, A.o ) [Missing object file]
diff --git a/testsuite/tests/determinism/determ006/determ006.stdout b/testsuite/tests/determinism/determ006/determ006.stdout
index 138d4023c5..d238fdd391 100644
--- a/testsuite/tests/determinism/determ006/determ006.stdout
+++ b/testsuite/tests/determinism/determ006/determ006.stdout
@@ -1,2 +1,2 @@
[1 of 1] Compiling Roman ( spec-inline-determ.hs, spec-inline-determ.o )
-[1 of 1] Compiling Roman ( spec-inline-determ.hs, spec-inline-determ.o )
+[1 of 1] Compiling Roman ( spec-inline-determ.hs, spec-inline-determ.o ) [Missing object file]
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 84601a3512..0242b1aed4 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -679,3 +679,9 @@ T14452:
T17786:
# N.B. Check for the presence of caret diagnostics.
"$(TEST_HC)" $(TEST_HC_OPTS) -v "$(shell cygpath -w -a T17786.hs)" 2>&1 | grep --quiet '3 |'
+
+.PHONY: OneShotTH
+OneShotTH:
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c OneShotTH.hs
+ # The module should *not* be recompiled
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c OneShotTH.hs
diff --git a/testsuite/tests/driver/OneShotTH.hs b/testsuite/tests/driver/OneShotTH.hs
new file mode 100644
index 0000000000..4338e24527
--- /dev/null
+++ b/testsuite/tests/driver/OneShotTH.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE TemplateHaskell #-}
+module OneShotTH where
+
+main = $([| print () |])
diff --git a/testsuite/tests/driver/OneShotTH.stdout b/testsuite/tests/driver/OneShotTH.stdout
new file mode 100644
index 0000000000..ae02c1f7a8
--- /dev/null
+++ b/testsuite/tests/driver/OneShotTH.stdout
@@ -0,0 +1 @@
+compilation IS NOT required
diff --git a/testsuite/tests/driver/T16511/B.hs b/testsuite/tests/driver/T16511/B.hs
new file mode 100644
index 0000000000..f290969805
--- /dev/null
+++ b/testsuite/tests/driver/T16511/B.hs
@@ -0,0 +1,4 @@
+module B (name) where
+
+name :: String
+name = "Samantha"
diff --git a/testsuite/tests/driver/T16511/C.hs b/testsuite/tests/driver/T16511/C.hs
index 34283b3701..4db28b6731 100644
--- a/testsuite/tests/driver/T16511/C.hs
+++ b/testsuite/tests/driver/T16511/C.hs
@@ -1,4 +1,4 @@
module C where
name :: String
-name = "Samantha"
+name = "SamanthaC"
diff --git a/testsuite/tests/driver/T16511/T16511.stdout b/testsuite/tests/driver/T16511/T16511.stdout
index c54cfe1f12..de74e6bbf8 100644
--- a/testsuite/tests/driver/T16511/T16511.stdout
+++ b/testsuite/tests/driver/T16511/T16511.stdout
@@ -1,6 +1,6 @@
Hello
Samantha
Hello
-Samantha
+SamanthaC
Hello
Samantha
diff --git a/testsuite/tests/driver/T16608/T16608_1.stdout b/testsuite/tests/driver/T16608/T16608_1.stdout
index 05c44cb5a8..f925d67b8c 100644
--- a/testsuite/tests/driver/T16608/T16608_1.stdout
+++ b/testsuite/tests/driver/T16608/T16608_1.stdout
@@ -2,6 +2,6 @@
[2 of 2] Compiling Main ( T16608_1.hs, T16608_1.o )
Linking T16608_1 ...
41
-[1 of 2] Compiling MyInteger ( MyInteger.hs, MyInteger.o )
+[1 of 2] Compiling MyInteger ( MyInteger.hs, MyInteger.o ) [Source file changed]
Linking T16608_1 ...
42
diff --git a/testsuite/tests/driver/T16608/T16608_2.stdout b/testsuite/tests/driver/T16608/T16608_2.stdout
index 9ca19a6dba..af2de7e698 100644
--- a/testsuite/tests/driver/T16608/T16608_2.stdout
+++ b/testsuite/tests/driver/T16608/T16608_2.stdout
@@ -2,6 +2,6 @@
[2 of 2] Compiling Main ( T16608_2.hs, T16608_2.o )
Linking T16608_2 ...
41
-[1 of 2] Compiling MyInteger ( MyInteger.hs, MyInteger.o )
+[1 of 2] Compiling MyInteger ( MyInteger.hs, MyInteger.o ) [Source file changed]
Linking T16608_2 ...
42
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 3b4162c95d..1c64f9905a 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -289,3 +289,4 @@ test('T17143', exit_code(1), run_command, ['{compiler} T17143.hs -S -fno-code'])
test('T17786', unless(opsys('mingw32'), skip), makefile_test, [])
test('T18369', normal, compile, ['-O'])
test('FullGHCVersion', normal, compile_and_run, ['-package ghc-boot'])
+test('OneShotTH', normal, makefile_test, [])
diff --git a/testsuite/tests/driver/recomp-boot/recomp-boot.stdout b/testsuite/tests/driver/recomp-boot/recomp-boot.stdout
index 77f5a1794a..5c122e2e34 100644
--- a/testsuite/tests/driver/recomp-boot/recomp-boot.stdout
+++ b/testsuite/tests/driver/recomp-boot/recomp-boot.stdout
@@ -2,5 +2,5 @@
[2 of 3] Compiling B ( B.hs, B.o )
[3 of 3] Compiling A ( A.hs, A.o )
[1 of 4] Compiling C[boot] ( C.hs-boot, C.o-boot )
-[3 of 4] Compiling B ( B.hs, B.o )
+[3 of 4] Compiling B ( B.hs, B.o ) [Source file changed]
[4 of 4] Compiling A ( A.hs, A.o ) [B changed]
diff --git a/testsuite/tests/driver/recomp-boot2/recomp-boot2.stdout b/testsuite/tests/driver/recomp-boot2/recomp-boot2.stdout
index aec38b5f06..cac737564c 100644
--- a/testsuite/tests/driver/recomp-boot2/recomp-boot2.stdout
+++ b/testsuite/tests/driver/recomp-boot2/recomp-boot2.stdout
@@ -4,7 +4,7 @@
[4 of 5] Compiling M ( M.hs, M.o )
[5 of 5] Compiling Top ( Top.hs, Top.o )
[1 of 6] Compiling C[boot] ( C.hs-boot, C.o-boot )
-[3 of 6] Compiling B ( B.hs, B.o )
+[3 of 6] Compiling B ( B.hs, B.o ) [Source file changed]
[4 of 6] Compiling A ( A.hs, A.o ) [B changed]
[5 of 6] Compiling M ( M.hs, M.o ) [A changed]
[6 of 6] Compiling Top ( Top.hs, Top.o ) [M changed]
diff --git a/testsuite/tests/driver/recomp004/Makefile b/testsuite/tests/driver/recomp004/Makefile
index 4ad51d8f60..52489dcf57 100644
--- a/testsuite/tests/driver/recomp004/Makefile
+++ b/testsuite/tests/driver/recomp004/Makefile
@@ -19,7 +19,7 @@ recomp004:
$(CP) c2.c c.c
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -c c.c -o c.o
# Hack to make sure c.o is really newer
- touch -t 01010000 MainX.hs MainX.hi MainX.o c.c $(EXECUTABLE)
+ touch -t 01010000 MainX.hi MainX.o c.c $(EXECUTABLE)
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make MainX.hs c.o -o $(EXECUTABLE)
./$(EXECUTABLE)
diff --git a/testsuite/tests/driver/recomp005/recomp005.stdout b/testsuite/tests/driver/recomp005/recomp005.stdout
index 6e2581ed04..0726b49f9a 100644
--- a/testsuite/tests/driver/recomp005/recomp005.stdout
+++ b/testsuite/tests/driver/recomp005/recomp005.stdout
@@ -3,6 +3,6 @@
[3 of 5] Compiling C ( C.hs, C.o )
[4 of 5] Compiling D ( D.hs, D.o )
[5 of 5] Compiling E ( E.hs, E.o )
-[3 of 5] Compiling C ( C.hs, C.o )
+[3 of 5] Compiling C ( C.hs, C.o ) [Source file changed]
[4 of 5] Compiling D ( D.hs, D.o ) [C changed]
[5 of 5] Compiling E ( E.hs, E.o ) [D changed]
diff --git a/testsuite/tests/driver/recomp006/recomp006.stdout b/testsuite/tests/driver/recomp006/recomp006.stdout
index 499b06f08b..0de9d4d334 100644
--- a/testsuite/tests/driver/recomp006/recomp006.stdout
+++ b/testsuite/tests/driver/recomp006/recomp006.stdout
@@ -1,2 +1,2 @@
-[1 of 2] Compiling B ( B.hs, B.o )
+[1 of 2] Compiling B ( B.hs, B.o ) [Source file changed]
[2 of 2] Compiling A ( A.hs, A.o ) [B changed]
diff --git a/testsuite/tests/driver/recomp007/recomp007.stdout b/testsuite/tests/driver/recomp007/recomp007.stdout
index 51b9a2a30c..1160663b4d 100644
--- a/testsuite/tests/driver/recomp007/recomp007.stdout
+++ b/testsuite/tests/driver/recomp007/recomp007.stdout
@@ -1,6 +1,6 @@
"1.0"
Preprocessing executable 'test' for b-1.0..
Building executable 'test' for b-1.0..
-[1 of 2] Compiling B ( B.hs, dist/build/test/test-tmp/B.o ) [A changed]
+[1 of 2] Compiling B ( B.hs, dist/build/test/test-tmp/B.o ) [A package changed]
Linking dist/build/test/test ...
"2.0"
diff --git a/testsuite/tests/driver/recomp013/recomp013.stdout b/testsuite/tests/driver/recomp013/recomp013.stdout
index 0a5aef7356..2720bb501f 100644
--- a/testsuite/tests/driver/recomp013/recomp013.stdout
+++ b/testsuite/tests/driver/recomp013/recomp013.stdout
@@ -3,5 +3,5 @@ first run
[2 of 3] Compiling B ( B.hs, B.o )
[3 of 3] Compiling C ( C.hs, C.o )
second run
-[2 of 3] Compiling B ( B.hs, B.o )
+[2 of 3] Compiling B ( B.hs, B.o ) [Source file changed]
[3 of 3] Compiling C ( C.hs, C.o ) [B changed]
diff --git a/testsuite/tests/driver/recomp016/recomp016.stdout b/testsuite/tests/driver/recomp016/recomp016.stdout
index eb6c6fce42..1114de90aa 100644
--- a/testsuite/tests/driver/recomp016/recomp016.stdout
+++ b/testsuite/tests/driver/recomp016/recomp016.stdout
@@ -6,7 +6,7 @@ first run
[5 of 5] Compiling E ( E.hs, E.o )
second run
[1 of 5] Compiling A2 ( A2.hs, A2.o )
-[2 of 5] Compiling B ( B.hs, B.o )
+[2 of 5] Compiling B ( B.hs, B.o ) [Source file changed]
[3 of 5] Compiling C ( C.hs, C.o ) [B changed]
[4 of 5] Compiling D ( D.hs, D.o ) [C changed]
[5 of 5] Compiling E ( E.hs, E.o ) [B changed]
diff --git a/testsuite/tests/driver/recomp017/Makefile b/testsuite/tests/driver/recomp017/Makefile
index 6a2f92a875..4b1bdda191 100644
--- a/testsuite/tests/driver/recomp017/Makefile
+++ b/testsuite/tests/driver/recomp017/Makefile
@@ -16,6 +16,5 @@ recomp017: clean
# A simple 'cp' would overwrite the original file,
# pointed to by the symlink
mv -f C2.hs C.hs
- touch C.hs
echo 'second run'
! '$(TEST_HC)' $(TEST_HC_OPTS) --make E.hs
diff --git a/testsuite/tests/driver/recomp019/recomp019.stdout b/testsuite/tests/driver/recomp019/recomp019.stdout
index f1e4cd4d73..413dad2e0f 100644
--- a/testsuite/tests/driver/recomp019/recomp019.stdout
+++ b/testsuite/tests/driver/recomp019/recomp019.stdout
@@ -4,8 +4,8 @@ first run
[3 of 3] Compiling Main ( Main.hs, Main.o )
Linking Main ...
5
-[1 of 1] Compiling B ( B.hs, nothing )
+[1 of 1] Compiling B ( B.hs, nothing ) [Source file changed]
second run
-[2 of 3] Compiling B ( B.hs, B.o )
+[1 of 3] Compiling B ( B.hs, B.o ) [Missing object file]
Linking Main ...
15
diff --git a/testsuite/tests/driver/recomp16885/M.hs b/testsuite/tests/driver/recomp16885/M.hs
new file mode 100644
index 0000000000..180dff6a79
--- /dev/null
+++ b/testsuite/tests/driver/recomp16885/M.hs
@@ -0,0 +1,2 @@
+module M where
+import M1
diff --git a/testsuite/tests/driver/recomp16885/M1.hs b/testsuite/tests/driver/recomp16885/M1.hs
new file mode 100644
index 0000000000..f9c1cb5a46
--- /dev/null
+++ b/testsuite/tests/driver/recomp16885/M1.hs
@@ -0,0 +1,4 @@
+module M1 where
+
+import M2
+
diff --git a/testsuite/tests/driver/recomp16885/M2A.hs b/testsuite/tests/driver/recomp16885/M2A.hs
new file mode 100644
index 0000000000..a99090730d
--- /dev/null
+++ b/testsuite/tests/driver/recomp16885/M2A.hs
@@ -0,0 +1 @@
+module M2 where
diff --git a/testsuite/tests/driver/recomp16885/M2B.hs b/testsuite/tests/driver/recomp16885/M2B.hs
new file mode 100644
index 0000000000..bdd17a4922
--- /dev/null
+++ b/testsuite/tests/driver/recomp16885/M2B.hs
@@ -0,0 +1,2 @@
+module M2 where
+import M3
diff --git a/testsuite/tests/driver/recomp16885/M3.hs b/testsuite/tests/driver/recomp16885/M3.hs
new file mode 100644
index 0000000000..44866309ad
--- /dev/null
+++ b/testsuite/tests/driver/recomp16885/M3.hs
@@ -0,0 +1 @@
+module M3 where
diff --git a/testsuite/tests/driver/recomp16885/Makefile b/testsuite/tests/driver/recomp16885/Makefile
new file mode 100644
index 0000000000..baa2c9e6c7
--- /dev/null
+++ b/testsuite/tests/driver/recomp16885/Makefile
@@ -0,0 +1,12 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+recomp16885:
+ cp M2A.hs M2.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make M.hs
+ sleep 1
+ cp M2B.hs M2.hs
+ -'$(TEST_HC)' $(TEST_HC_OPTS) --make M.hs
diff --git a/testsuite/tests/driver/recomp16885/all.T b/testsuite/tests/driver/recomp16885/all.T
new file mode 100644
index 0000000000..b9821f9b42
--- /dev/null
+++ b/testsuite/tests/driver/recomp16885/all.T
@@ -0,0 +1,3 @@
+test('recomp16885', [extra_files(['M2A.hs', 'M.hs', 'M1.hs', 'M2B.hs', 'M3.hs']),
+ when(fast(), skip)],
+ makefile_test, [])
diff --git a/testsuite/tests/driver/recomp16885/recomp16885.stdout b/testsuite/tests/driver/recomp16885/recomp16885.stdout
new file mode 100644
index 0000000000..506b99c6ac
--- /dev/null
+++ b/testsuite/tests/driver/recomp16885/recomp16885.stdout
@@ -0,0 +1,5 @@
+[1 of 3] Compiling M2 ( M2.hs, M2.o )
+[2 of 3] Compiling M1 ( M1.hs, M1.o )
+[3 of 3] Compiling M ( M.hs, M.o )
+[1 of 4] Compiling M3 ( M3.hs, M3.o )
+[2 of 4] Compiling M2 ( M2.hs, M2.o ) [Source file changed]
diff --git a/testsuite/tests/driver/recompChangedPackage/Main.hs b/testsuite/tests/driver/recompChangedPackage/Main.hs
new file mode 100644
index 0000000000..abdd92d83f
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/Main.hs
@@ -0,0 +1,6 @@
+module Main where
+
+import PLib
+import QLib
+
+main = print [q]
diff --git a/testsuite/tests/driver/recompChangedPackage/Makefile b/testsuite/tests/driver/recompChangedPackage/Makefile
new file mode 100644
index 0000000000..ecbf49ec03
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/Makefile
@@ -0,0 +1,37 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP='$(PWD)/Setup' -v0
+CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(filter-out -rtsopts,$(TEST_HC_OPTS))' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' $(VANILLA) $(PROF) $(DYN)
+
+recompChangedPackage:
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
+ # build q
+ (cd q; cp q.cabal1 q.cabal)
+ rm -rf q/dist
+ (cd q; $(CONFIGURE) --ipid "q-0.1")
+ (cd q; $(SETUP) build)
+ (cd q; $(SETUP) copy)
+ (cd q; $(SETUP) register)
+
+ cp PLib1.hs PLib.hs
+ '$(TEST_HC)' -package-db tmp.d Main.hs
+ ./Main
+
+ # Now add PLib to q.. Main should be recompiled
+
+ $(GHC_PKG) --package-db tmp.d list
+ $(GHC_PKG) --package-db tmp.d unregister q-0.1.0.0
+ rm PLib.hs
+
+ (cd q; cp q.cabal2 q.cabal)
+ rm -rf q/dist
+ (cd q; $(CONFIGURE) --ipid "q-0.1")
+ (cd q; $(SETUP) build)
+ (cd q; $(SETUP) copy)
+ (cd q; $(SETUP) register)
+
+ '$(TEST_HC)' -package-db tmp.d Main.hs
+ ./Main
diff --git a/testsuite/tests/driver/recompChangedPackage/PLib1.hs b/testsuite/tests/driver/recompChangedPackage/PLib1.hs
new file mode 100644
index 0000000000..439dcf1f43
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/PLib1.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE FlexibleInstances #-}
+module PLib where
+
+p = 'p'
+
+
diff --git a/testsuite/tests/driver/recompChangedPackage/Setup.hs b/testsuite/tests/driver/recompChangedPackage/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recompChangedPackage/all.T b/testsuite/tests/driver/recompChangedPackage/all.T
new file mode 100644
index 0000000000..8acd1655b9
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/all.T
@@ -0,0 +1,19 @@
+if config.have_vanilla:
+ vanilla = '--enable-library-vanilla'
+else:
+ vanilla = '--disable-library-vanilla'
+
+if config.have_profiling:
+ prof = '--enable-library-profiling'
+else:
+ prof = '--disable-library-profiling'
+
+if not config.compiler_profiled and config.have_shared_libs:
+ dyn = '--enable-shared'
+else:
+ dyn = '--disable-shared'
+
+test('recompChangedPackage', [extra_files(['q', 'Main.hs', 'Setup.hs', 'PLib1.hs']),
+ when(fast(), skip)],
+ run_command,
+ ['$MAKE -s --no-print-directory recompChangedPackage VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn])
diff --git a/testsuite/tests/driver/recompChangedPackage/q/CHANGELOG.md b/testsuite/tests/driver/recompChangedPackage/q/CHANGELOG.md
new file mode 100644
index 0000000000..62632c5376
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for q
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/testsuite/tests/driver/recompChangedPackage/q/LICENSE b/testsuite/tests/driver/recompChangedPackage/q/LICENSE
new file mode 100644
index 0000000000..bca70f3531
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/LICENSE
@@ -0,0 +1 @@
+q
diff --git a/testsuite/tests/driver/recompChangedPackage/q/Main.hs b/testsuite/tests/driver/recompChangedPackage/q/Main.hs
new file mode 100644
index 0000000000..b566f91285
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/Main.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Main where
+
+import Lib
+
+main = print $(p)
diff --git a/testsuite/tests/driver/recompChangedPackage/q/PLib.hs b/testsuite/tests/driver/recompChangedPackage/q/PLib.hs
new file mode 100644
index 0000000000..ee009a196d
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/PLib.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE FlexibleInstances #-}
+module PLib where
+
+p = 'e'
+
+instance {-# OVERLAPPING #-} Show [Char] where
+ show _ = "empty"
diff --git a/testsuite/tests/driver/recompChangedPackage/q/QLib.hs b/testsuite/tests/driver/recompChangedPackage/q/QLib.hs
new file mode 100644
index 0000000000..b98aa33300
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/QLib.hs
@@ -0,0 +1,3 @@
+module QLib where
+
+q = 'q'
diff --git a/testsuite/tests/driver/recompChangedPackage/q/Setup.hs b/testsuite/tests/driver/recompChangedPackage/q/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recompChangedPackage/q/q.cabal b/testsuite/tests/driver/recompChangedPackage/q/q.cabal
new file mode 100644
index 0000000000..f9f1e871cb
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/q.cabal
@@ -0,0 +1,25 @@
+cabal-version: >=1.10
+-- Initial package description 'q.cabal' generated by 'cabal init'. For
+-- further documentation, see http://haskell.org/cabal/users-guide/
+
+name: q
+version: 0.1.0.0
+-- synopsis:
+-- description:
+-- bug-reports:
+-- license:
+license-file: LICENSE
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+-- copyright:
+-- category:
+build-type: Simple
+extra-source-files: CHANGELOG.md
+
+library
+ exposed-modules: QLib PLib
+ -- other-modules:
+ -- other-extensions:
+ build-depends: base >=4 && <5
+ -- hs-source-dirs:
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/recompChangedPackage/q/q.cabal1 b/testsuite/tests/driver/recompChangedPackage/q/q.cabal1
new file mode 100644
index 0000000000..01c41cd9d0
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/q.cabal1
@@ -0,0 +1,25 @@
+cabal-version: >=1.10
+-- Initial package description 'q.cabal' generated by 'cabal init'. For
+-- further documentation, see http://haskell.org/cabal/users-guide/
+
+name: q
+version: 0.1.0.0
+-- synopsis:
+-- description:
+-- bug-reports:
+-- license:
+license-file: LICENSE
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+-- copyright:
+-- category:
+build-type: Simple
+extra-source-files: CHANGELOG.md
+
+library
+ exposed-modules: QLib
+ -- other-modules:
+ -- other-extensions:
+ build-depends: base >=4 && <5
+ -- hs-source-dirs:
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/recompChangedPackage/q/q.cabal2 b/testsuite/tests/driver/recompChangedPackage/q/q.cabal2
new file mode 100644
index 0000000000..f9f1e871cb
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/q/q.cabal2
@@ -0,0 +1,25 @@
+cabal-version: >=1.10
+-- Initial package description 'q.cabal' generated by 'cabal init'. For
+-- further documentation, see http://haskell.org/cabal/users-guide/
+
+name: q
+version: 0.1.0.0
+-- synopsis:
+-- description:
+-- bug-reports:
+-- license:
+license-file: LICENSE
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+-- copyright:
+-- category:
+build-type: Simple
+extra-source-files: CHANGELOG.md
+
+library
+ exposed-modules: QLib PLib
+ -- other-modules:
+ -- other-extensions:
+ build-depends: base >=4 && <5
+ -- hs-source-dirs:
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout b/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout
new file mode 100644
index 0000000000..86d6324225
--- /dev/null
+++ b/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout
@@ -0,0 +1,10 @@
+[1 of 2] Compiling PLib ( PLib.hs, PLib.o )
+[2 of 2] Compiling Main ( Main.hs, Main.o )
+Linking Main ...
+"q"
+tmp.d
+ q-0.1.0.0
+
+[1 of 1] Compiling Main ( Main.hs, Main.o ) [PLib removed]
+Linking Main ...
+empty
diff --git a/testsuite/tests/driver/recompHash/A.hs b/testsuite/tests/driver/recompHash/A.hs
new file mode 100644
index 0000000000..905110c8cf
--- /dev/null
+++ b/testsuite/tests/driver/recompHash/A.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module A where
+
+import B
+
+main = print 0
diff --git a/testsuite/tests/driver/recompHash/B.hs b/testsuite/tests/driver/recompHash/B.hs
new file mode 100644
index 0000000000..7b1456b488
--- /dev/null
+++ b/testsuite/tests/driver/recompHash/B.hs
@@ -0,0 +1,3 @@
+module B where
+
+c = print 0
diff --git a/testsuite/tests/driver/recompHash/Makefile b/testsuite/tests/driver/recompHash/Makefile
new file mode 100644
index 0000000000..6155169cba
--- /dev/null
+++ b/testsuite/tests/driver/recompHash/Makefile
@@ -0,0 +1,17 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+ rm -f *.o*
+ rm -f *.dyn_o*
+ rm -f *.hi*
+
+# Touching a file should not cause recompilation
+
+recompHash: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs -fhide-source-paths
+ touch B.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs -fhide-source-paths
diff --git a/testsuite/tests/driver/recompHash/all.T b/testsuite/tests/driver/recompHash/all.T
new file mode 100644
index 0000000000..ab0814b62b
--- /dev/null
+++ b/testsuite/tests/driver/recompHash/all.T
@@ -0,0 +1,3 @@
+test('recompHash', [extra_files(['A.hs', 'B.hs']),
+ when(fast(), skip)],
+ makefile_test, [])
diff --git a/testsuite/tests/driver/recompHash/recompHash.stdout b/testsuite/tests/driver/recompHash/recompHash.stdout
new file mode 100644
index 0000000000..2c8a019066
--- /dev/null
+++ b/testsuite/tests/driver/recompHash/recompHash.stdout
@@ -0,0 +1,2 @@
+[1 of 2] Compiling B
+[2 of 2] Compiling A
diff --git a/testsuite/tests/driver/recompNoTH/A.hs b/testsuite/tests/driver/recompNoTH/A.hs
new file mode 100644
index 0000000000..905110c8cf
--- /dev/null
+++ b/testsuite/tests/driver/recompNoTH/A.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module A where
+
+import B
+
+main = print 0
diff --git a/testsuite/tests/driver/recompNoTH/B1.hs b/testsuite/tests/driver/recompNoTH/B1.hs
new file mode 100644
index 0000000000..7b1456b488
--- /dev/null
+++ b/testsuite/tests/driver/recompNoTH/B1.hs
@@ -0,0 +1,3 @@
+module B where
+
+c = print 0
diff --git a/testsuite/tests/driver/recompNoTH/B2.hs b/testsuite/tests/driver/recompNoTH/B2.hs
new file mode 100644
index 0000000000..c7f392c91a
--- /dev/null
+++ b/testsuite/tests/driver/recompNoTH/B2.hs
@@ -0,0 +1,3 @@
+module B where
+
+c = print 1
diff --git a/testsuite/tests/driver/recompNoTH/Makefile b/testsuite/tests/driver/recompNoTH/Makefile
new file mode 100644
index 0000000000..113af9f204
--- /dev/null
+++ b/testsuite/tests/driver/recompNoTH/Makefile
@@ -0,0 +1,19 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+ rm -f *.o*
+ rm -f *.dyn_o*
+ rm -f *.hi*
+
+# If the source changes, but not the ABI, then only B should be recompiled.
+
+recompNoTH: clean
+ '$(CP)' B1.hs B.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs -fhide-source-paths
+ '$(CP)' B2.hs B.hs
+ # Should print that only B has been recompiled.
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs -fhide-source-paths
diff --git a/testsuite/tests/driver/recompNoTH/all.T b/testsuite/tests/driver/recompNoTH/all.T
new file mode 100644
index 0000000000..db66a0af41
--- /dev/null
+++ b/testsuite/tests/driver/recompNoTH/all.T
@@ -0,0 +1,3 @@
+test('recompNoTH', [extra_files(['A.hs', 'B1.hs', 'B2.hs' ]),
+ when(fast(), skip)],
+ makefile_test, [])
diff --git a/testsuite/tests/driver/recompNoTH/recompNoTH.stdout b/testsuite/tests/driver/recompNoTH/recompNoTH.stdout
new file mode 100644
index 0000000000..39bfe897f0
--- /dev/null
+++ b/testsuite/tests/driver/recompNoTH/recompNoTH.stdout
@@ -0,0 +1,3 @@
+[1 of 2] Compiling B
+[2 of 2] Compiling A
+[1 of 2] Compiling B [Source file changed]
diff --git a/testsuite/tests/driver/recompPluginPackage/Makefile b/testsuite/tests/driver/recompPluginPackage/Makefile
new file mode 100644
index 0000000000..1748c86481
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/Makefile
@@ -0,0 +1,30 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP='$(PWD)/Setup' -v0
+CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(filter-out -rtsopts,$(TEST_HC_OPTS))' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' $(VANILLA) $(PROF) $(DYN)
+
+recompPluginPackage:
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
+ # build p
+ cp p/Lib1.hs p/Lib.hs
+ rm -rf p/dist
+ (cd p; $(CONFIGURE) --ipid "p-0.1")
+ (cd p; $(SETUP) build)
+ (cd p; $(SETUP) copy)
+ (cd p; $(SETUP) register)
+ # build q
+ rm -rf q/dist
+ (cd q; $(CONFIGURE) --ipid "q-0.1")
+ (cd q; $(SETUP) build)
+ (cd q; $(SETUP) copy)
+ (cd q; $(SETUP) register)
+ cp p/Lib2.hs p/Lib.hs
+ (cd p; $(SETUP) build)
+ (cd p; $(SETUP) copy)
+ (cd p; $(SETUP) register)
+ (cd q; $(SETUP) build)
+ (cd q; $(SETUP) copy)
+ (cd q; $(SETUP) register)
diff --git a/testsuite/tests/driver/recompPluginPackage/README.md b/testsuite/tests/driver/recompPluginPackage/README.md
new file mode 100644
index 0000000000..45d4b1d817
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/README.md
@@ -0,0 +1,9 @@
+Modifying the definition of `p` in `Lib.hs` does not cause `q` to be recompiled.
+
+```
+> cabal new-run q
+0
+-- Change p = [| 1 |]
+> cabal new-run q
+-- Prints 1.. used to print 0
+1
diff --git a/testsuite/tests/driver/recompPluginPackage/Setup.hs b/testsuite/tests/driver/recompPluginPackage/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recompPluginPackage/all.T b/testsuite/tests/driver/recompPluginPackage/all.T
new file mode 100644
index 0000000000..ea6cce4baa
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/all.T
@@ -0,0 +1,20 @@
+if config.have_vanilla:
+ vanilla = '--enable-library-vanilla'
+else:
+ vanilla = '--disable-library-vanilla'
+
+if config.have_profiling:
+ prof = '--enable-library-profiling'
+else:
+ prof = '--disable-library-profiling'
+
+if not config.compiler_profiled and config.have_shared_libs:
+ dyn = '--enable-shared'
+else:
+ dyn = '--disable-shared'
+
+test('recompPluginPackage', [extra_files(['p', 'q', 'Setup.hs']),
+ when(opsys('mingw32'), fragile(16405)),
+ when(fast(), skip)],
+ run_command,
+ ['$MAKE -s --no-print-directory recompPluginPackage VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn])
diff --git a/testsuite/tests/driver/recompPluginPackage/cabal.project b/testsuite/tests/driver/recompPluginPackage/cabal.project
new file mode 100644
index 0000000000..838e7f9a75
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/cabal.project
@@ -0,0 +1,2 @@
+packages: p q
+
diff --git a/testsuite/tests/driver/recompPluginPackage/p/CHANGELOG.md b/testsuite/tests/driver/recompPluginPackage/p/CHANGELOG.md
new file mode 100644
index 0000000000..9ede8b27d4
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/p/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for p
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/testsuite/tests/driver/recompPluginPackage/p/LICENSE b/testsuite/tests/driver/recompPluginPackage/p/LICENSE
new file mode 100644
index 0000000000..05bef1a55a
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/p/LICENSE
@@ -0,0 +1 @@
+L
diff --git a/testsuite/tests/driver/recompPluginPackage/p/Lib1.hs b/testsuite/tests/driver/recompPluginPackage/p/Lib1.hs
new file mode 100644
index 0000000000..942c536874
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/p/Lib1.hs
@@ -0,0 +1,5 @@
+module Lib where
+
+{-# NOINLINE p #-}
+p = 1
+
diff --git a/testsuite/tests/driver/recompPluginPackage/p/Lib2.hs b/testsuite/tests/driver/recompPluginPackage/p/Lib2.hs
new file mode 100644
index 0000000000..259ae46461
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/p/Lib2.hs
@@ -0,0 +1,5 @@
+module Lib where
+
+{-# NOINLINE p #-}
+p = 2
+
diff --git a/testsuite/tests/driver/recompPluginPackage/p/Main.hs b/testsuite/tests/driver/recompPluginPackage/p/Main.hs
new file mode 100644
index 0000000000..65ae4a05d5
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/p/Main.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello, Haskell!"
diff --git a/testsuite/tests/driver/recompPluginPackage/p/Setup.hs b/testsuite/tests/driver/recompPluginPackage/p/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/p/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recompPluginPackage/p/p.cabal b/testsuite/tests/driver/recompPluginPackage/p/p.cabal
new file mode 100644
index 0000000000..ebf8f3dc5c
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/p/p.cabal
@@ -0,0 +1,24 @@
+cabal-version: >=1.10
+-- Initial package description 'p.cabal' generated by 'cabal init'. For
+-- further documentation, see http://haskell.org/cabal/users-guide/
+
+name: p
+version: 0.1.0.0
+-- synopsis:
+-- description:
+-- bug-reports:
+-- license:
+license-file: LICENSE
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+-- copyright:
+-- category:
+build-type: Simple
+extra-source-files: CHANGELOG.md
+
+library
+ exposed-modules: Lib
+ -- other-extensions:
+ build-depends: base >=4.14 && < 5
+ -- hs-source-dirs:
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/recompPluginPackage/q/CHANGELOG.md b/testsuite/tests/driver/recompPluginPackage/q/CHANGELOG.md
new file mode 100644
index 0000000000..62632c5376
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/q/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for q
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/testsuite/tests/driver/recompPluginPackage/q/LICENSE b/testsuite/tests/driver/recompPluginPackage/q/LICENSE
new file mode 100644
index 0000000000..bca70f3531
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/q/LICENSE
@@ -0,0 +1 @@
+q
diff --git a/testsuite/tests/driver/recompPluginPackage/q/Main.hs b/testsuite/tests/driver/recompPluginPackage/q/Main.hs
new file mode 100644
index 0000000000..60fd0cc6f5
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/q/Main.hs
@@ -0,0 +1,4 @@
+{-# OPTIONS_GHC -fplugin=Plugin #-}
+module Main where
+
+main = print ()
diff --git a/testsuite/tests/driver/recompPluginPackage/q/Plugin.hs b/testsuite/tests/driver/recompPluginPackage/q/Plugin.hs
new file mode 100644
index 0000000000..32ce1bd96b
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/q/Plugin.hs
@@ -0,0 +1,15 @@
+module Plugin where
+
+import GHC.Plugins
+import Lib
+
+plugin :: Plugin
+plugin = defaultPlugin {
+ installCoreToDos = install
+ , pluginRecompile = purePlugin
+ }
+
+install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
+install _ todo = do
+ liftIO (print p)
+ return todo
diff --git a/testsuite/tests/driver/recompPluginPackage/q/Setup.hs b/testsuite/tests/driver/recompPluginPackage/q/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/q/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recompPluginPackage/q/q.cabal b/testsuite/tests/driver/recompPluginPackage/q/q.cabal
new file mode 100644
index 0000000000..8216113fce
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/q/q.cabal
@@ -0,0 +1,26 @@
+cabal-version: >=1.10
+-- Initial package description 'q.cabal' generated by 'cabal init'. For
+-- further documentation, see http://haskell.org/cabal/users-guide/
+
+name: q
+version: 0.1.0.0
+-- synopsis:
+-- description:
+-- bug-reports:
+-- license:
+license-file: LICENSE
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+-- copyright:
+-- category:
+build-type: Simple
+extra-source-files: CHANGELOG.md
+
+executable q
+ main-is: Main.hs
+ other-modules: Plugin
+ -- other-extensions:
+ build-depends: base >=4.14 && <5, p, ghc
+ -- hs-source-dirs:
+ ghc-options: -dynamic-too
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/recompPluginPackage/recompPluginPackage.stderr-mingw32 b/testsuite/tests/driver/recompPluginPackage/recompPluginPackage.stderr-mingw32
new file mode 100644
index 0000000000..46497c6618
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/recompPluginPackage.stderr-mingw32
@@ -0,0 +1,12 @@
+
+when making flags consistent: warning:
+ -dynamic-too is not supported on Windows
+
+when making flags consistent: warning:
+ -dynamic-too is not supported on Windows
+
+when making flags consistent: warning:
+ -dynamic-too is not supported on Windows
+
+when making flags consistent: warning:
+ -dynamic-too is not supported on Windows
diff --git a/testsuite/tests/driver/recompPluginPackage/recompPluginPackage.stdout b/testsuite/tests/driver/recompPluginPackage/recompPluginPackage.stdout
new file mode 100644
index 0000000000..1191247b6d
--- /dev/null
+++ b/testsuite/tests/driver/recompPluginPackage/recompPluginPackage.stdout
@@ -0,0 +1,2 @@
+1
+2
diff --git a/testsuite/tests/driver/recompTH/A.hs b/testsuite/tests/driver/recompTH/A.hs
new file mode 100644
index 0000000000..df7dfdab91
--- /dev/null
+++ b/testsuite/tests/driver/recompTH/A.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module A where
+
+import B
+
+main = $(b)
diff --git a/testsuite/tests/driver/recompTH/B1.hs b/testsuite/tests/driver/recompTH/B1.hs
new file mode 100644
index 0000000000..c57def3417
--- /dev/null
+++ b/testsuite/tests/driver/recompTH/B1.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module B where
+
+b = [| print 0 |]
diff --git a/testsuite/tests/driver/recompTH/B2.hs b/testsuite/tests/driver/recompTH/B2.hs
new file mode 100644
index 0000000000..99c3171111
--- /dev/null
+++ b/testsuite/tests/driver/recompTH/B2.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module B where
+
+b = [| print 1 |]
diff --git a/testsuite/tests/driver/recompTH/Makefile b/testsuite/tests/driver/recompTH/Makefile
new file mode 100644
index 0000000000..1ab14f8f9a
--- /dev/null
+++ b/testsuite/tests/driver/recompTH/Makefile
@@ -0,0 +1,20 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+ rm -f *.o*
+ rm -f *.dyn_o*
+ rm -f *.hi*
+
+# Test that using a TH splice in a module causes recompilation when the *source*
+# of a dependency changes.
+
+recompTH: clean
+ '$(CP)' B1.hs B.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs -fhide-source-paths
+ '$(CP)' B2.hs B.hs
+ # Should print that A has been recompiled.
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs -fhide-source-paths
diff --git a/testsuite/tests/driver/recompTH/all.T b/testsuite/tests/driver/recompTH/all.T
new file mode 100644
index 0000000000..be28961173
--- /dev/null
+++ b/testsuite/tests/driver/recompTH/all.T
@@ -0,0 +1,4 @@
+test('recompTH', [extra_files(['A.hs', 'B1.hs', 'B2.hs' ]),
+ when(fast(), skip)
+ , normalise_slashes],
+ makefile_test, [])
diff --git a/testsuite/tests/driver/recompTH/recompTH.stdout b/testsuite/tests/driver/recompTH/recompTH.stdout
new file mode 100644
index 0000000000..482191e1d5
--- /dev/null
+++ b/testsuite/tests/driver/recompTH/recompTH.stdout
@@ -0,0 +1,4 @@
+[1 of 2] Compiling B
+[2 of 2] Compiling A
+[1 of 2] Compiling B [Source file changed]
+[2 of 2] Compiling A [B[TH] changed]
diff --git a/testsuite/tests/driver/recompTHpackage/Makefile b/testsuite/tests/driver/recompTHpackage/Makefile
new file mode 100644
index 0000000000..ed865b9cc2
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/Makefile
@@ -0,0 +1,32 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP='$(PWD)/Setup' -v0
+CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(filter-out -rtsopts,$(TEST_HC_OPTS))' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' $(VANILLA) $(PROF) $(DYN)
+
+recompTHpackage:
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
+ # build p
+ cp p/Lib1.hs p/Lib.hs
+ rm -rf p/dist
+ (cd p; $(CONFIGURE) --ipid "p-0.1")
+ (cd p; $(SETUP) build)
+ (cd p; $(SETUP) copy)
+ (cd p; $(SETUP) register)
+ # build q
+ rm -rf q/dist
+ (cd q; $(CONFIGURE) --ipid "q-0.1")
+ (cd q; $(SETUP) build)
+ (cd q; $(SETUP) copy)
+ (cd q; $(SETUP) register)
+ ./inst/bin/q
+ cp p/Lib2.hs p/Lib.hs
+ (cd p; $(SETUP) build)
+ (cd p; $(SETUP) copy)
+ (cd p; $(SETUP) register)
+ (cd q; $(SETUP) build)
+ (cd q; $(SETUP) copy)
+ (cd q; $(SETUP) register)
+ ./inst/bin/q
diff --git a/testsuite/tests/driver/recompTHpackage/README.md b/testsuite/tests/driver/recompTHpackage/README.md
new file mode 100644
index 0000000000..8253a75272
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/README.md
@@ -0,0 +1,9 @@
+Modifying the definition of `p` in `Lib.hs` does not cause `q` to be recompiled.
+
+```
+> cabal new-run q
+0
+-- Change p = [| 1 |]
+> cabal new-run q
+-- BUG: Should be 1
+0
diff --git a/testsuite/tests/driver/recompTHpackage/Setup.hs b/testsuite/tests/driver/recompTHpackage/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recompTHpackage/all.T b/testsuite/tests/driver/recompTHpackage/all.T
new file mode 100644
index 0000000000..6e2826300c
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/all.T
@@ -0,0 +1,19 @@
+if config.have_vanilla:
+ vanilla = '--enable-library-vanilla'
+else:
+ vanilla = '--disable-library-vanilla'
+
+if config.have_profiling:
+ prof = '--enable-library-profiling'
+else:
+ prof = '--disable-library-profiling'
+
+if not config.compiler_profiled and config.have_shared_libs:
+ dyn = '--enable-shared'
+else:
+ dyn = '--disable-shared'
+
+test('recompTHpackage', [extra_files(['p', 'q', 'Setup.hs']),
+ when(fast(), skip)],
+ run_command,
+ ['$MAKE -s --no-print-directory recompTHpackage VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn])
diff --git a/testsuite/tests/driver/recompTHpackage/cabal.project b/testsuite/tests/driver/recompTHpackage/cabal.project
new file mode 100644
index 0000000000..838e7f9a75
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/cabal.project
@@ -0,0 +1,2 @@
+packages: p q
+
diff --git a/testsuite/tests/driver/recompTHpackage/p/CHANGELOG.md b/testsuite/tests/driver/recompTHpackage/p/CHANGELOG.md
new file mode 100644
index 0000000000..9ede8b27d4
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/p/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for p
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/testsuite/tests/driver/recompTHpackage/p/LICENSE b/testsuite/tests/driver/recompTHpackage/p/LICENSE
new file mode 100644
index 0000000000..05bef1a55a
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/p/LICENSE
@@ -0,0 +1 @@
+L
diff --git a/testsuite/tests/driver/recompTHpackage/p/Lib1.hs b/testsuite/tests/driver/recompTHpackage/p/Lib1.hs
new file mode 100644
index 0000000000..f50e3a830c
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/p/Lib1.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module Lib where
+
+{-# NOINLINE p #-}
+p = [| 1 |]
+
diff --git a/testsuite/tests/driver/recompTHpackage/p/Lib2.hs b/testsuite/tests/driver/recompTHpackage/p/Lib2.hs
new file mode 100644
index 0000000000..8bbee29e74
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/p/Lib2.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module Lib where
+
+{-# NOINLINE p #-}
+p = [| 2 |]
+
diff --git a/testsuite/tests/driver/recompTHpackage/p/Main.hs b/testsuite/tests/driver/recompTHpackage/p/Main.hs
new file mode 100644
index 0000000000..65ae4a05d5
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/p/Main.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello, Haskell!"
diff --git a/testsuite/tests/driver/recompTHpackage/p/Setup.hs b/testsuite/tests/driver/recompTHpackage/p/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/p/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recompTHpackage/p/p.cabal b/testsuite/tests/driver/recompTHpackage/p/p.cabal
new file mode 100644
index 0000000000..3ae74c4b13
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/p/p.cabal
@@ -0,0 +1,24 @@
+cabal-version: >=1.10
+-- Initial package description 'p.cabal' generated by 'cabal init'. For
+-- further documentation, see http://haskell.org/cabal/users-guide/
+
+name: p
+version: 0.1.0.0
+-- synopsis:
+-- description:
+-- bug-reports:
+-- license:
+license-file: LICENSE
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+-- copyright:
+-- category:
+build-type: Simple
+extra-source-files: CHANGELOG.md
+
+library
+ exposed-modules: Lib
+ -- other-extensions:
+ build-depends: base >=4.14 && < 5, template-haskell
+ -- hs-source-dirs:
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/recompTHpackage/q/CHANGELOG.md b/testsuite/tests/driver/recompTHpackage/q/CHANGELOG.md
new file mode 100644
index 0000000000..62632c5376
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/q/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for q
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/testsuite/tests/driver/recompTHpackage/q/LICENSE b/testsuite/tests/driver/recompTHpackage/q/LICENSE
new file mode 100644
index 0000000000..bca70f3531
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/q/LICENSE
@@ -0,0 +1 @@
+q
diff --git a/testsuite/tests/driver/recompTHpackage/q/Main.hs b/testsuite/tests/driver/recompTHpackage/q/Main.hs
new file mode 100644
index 0000000000..b566f91285
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/q/Main.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Main where
+
+import Lib
+
+main = print $(p)
diff --git a/testsuite/tests/driver/recompTHpackage/q/Setup.hs b/testsuite/tests/driver/recompTHpackage/q/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/q/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recompTHpackage/q/q.cabal b/testsuite/tests/driver/recompTHpackage/q/q.cabal
new file mode 100644
index 0000000000..0537ef0d9b
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/q/q.cabal
@@ -0,0 +1,25 @@
+cabal-version: >=1.10
+-- Initial package description 'q.cabal' generated by 'cabal init'. For
+-- further documentation, see http://haskell.org/cabal/users-guide/
+
+name: q
+version: 0.1.0.0
+-- synopsis:
+-- description:
+-- bug-reports:
+-- license:
+license-file: LICENSE
+author: Matthew Pickering
+maintainer: matthewtpickering@gmail.com
+-- copyright:
+-- category:
+build-type: Simple
+extra-source-files: CHANGELOG.md
+
+executable q
+ main-is: Main.hs
+ -- other-modules:
+ -- other-extensions:
+ build-depends: base >=4.14 && <5, p
+ -- hs-source-dirs:
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/recompTHpackage/recompTHpackage.stdout b/testsuite/tests/driver/recompTHpackage/recompTHpackage.stdout
new file mode 100644
index 0000000000..1191247b6d
--- /dev/null
+++ b/testsuite/tests/driver/recompTHpackage/recompTHpackage.stdout
@@ -0,0 +1,2 @@
+1
+2
diff --git a/testsuite/tests/driver/retc001/retc001.stdout b/testsuite/tests/driver/retc001/retc001.stdout
index 381850d9a4..e5d374608e 100644
--- a/testsuite/tests/driver/retc001/retc001.stdout
+++ b/testsuite/tests/driver/retc001/retc001.stdout
@@ -3,5 +3,5 @@
[3 of 3] Compiling Main ( C.hs, nothing )
Middle
End
-[2 of 3] Compiling B ( B.hs, nothing )
+[2 of 3] Compiling B ( B.hs, nothing ) [Source file changed]
[3 of 3] Compiling Main ( C.hs, nothing ) [B changed]
diff --git a/testsuite/tests/driver/th-new-test/A.hs b/testsuite/tests/driver/th-new-test/A.hs
new file mode 100644
index 0000000000..700e87789d
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/A.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module A where
+
+import B
+
+a = print $(b)
diff --git a/testsuite/tests/driver/th-new-test/B.hs b/testsuite/tests/driver/th-new-test/B.hs
new file mode 100644
index 0000000000..c59d95459f
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/B.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE NoMonomorphismRestriction #-}
+{-# LANGUAGE TemplateHaskell #-}
+module B where
+
+b = [| 'b' |]
diff --git a/testsuite/tests/driver/th-new-test/B1.hs b/testsuite/tests/driver/th-new-test/B1.hs
new file mode 100644
index 0000000000..6723d49b15
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/B1.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE NoMonomorphismRestriction #-}
+{-# LANGUAGE TemplateHaskell #-}
+module B where
+
+b = [| "b1" |]
diff --git a/testsuite/tests/driver/th-new-test/C.hs b/testsuite/tests/driver/th-new-test/C.hs
new file mode 100644
index 0000000000..eed7c6556d
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/C.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module C where
+
+import D
+
+c = print $(d)
diff --git a/testsuite/tests/driver/th-new-test/D.hs b/testsuite/tests/driver/th-new-test/D.hs
new file mode 100644
index 0000000000..0dcddfde2d
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/D.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module D where
+
+d = [| 'd' |]
diff --git a/testsuite/tests/driver/th-new-test/D1.hs b/testsuite/tests/driver/th-new-test/D1.hs
new file mode 100644
index 0000000000..1db6c126e4
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/D1.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module D where
+
+d = [| "d1" |]
diff --git a/testsuite/tests/driver/th-new-test/Main.hs b/testsuite/tests/driver/th-new-test/Main.hs
new file mode 100644
index 0000000000..0b8ce305b8
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/Main.hs
@@ -0,0 +1,6 @@
+module Main where
+
+import A
+import C
+
+main = a >> c
diff --git a/testsuite/tests/driver/th-new-test/Makefile b/testsuite/tests/driver/th-new-test/Makefile
new file mode 100644
index 0000000000..63b10db4aa
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/Makefile
@@ -0,0 +1,29 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+ rm -f *.o*
+ rm -f *.dyn_o*
+ rm -f *.hi*
+ rm -f *.dyn_hi*
+
+th-new-test: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make Main.hs -fhide-source-paths
+ # No recompilation
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make Main.hs -fhide-source-paths
+ cp B.hs B_O.hs
+ cp B1.hs B.hs
+ # Recompile just B and A
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make Main.hs -fhide-source-paths
+ cp D.hs D_O.hs
+ cp D1.hs D.hs
+ # Recompile just D and C
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make Main.hs -fhide-source-paths
+ cp D_O.hs D.hs
+ cp B_O.hs B.hs
+ # Recompile A B C D
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make Main.hs -fhide-source-paths
+
diff --git a/testsuite/tests/driver/th-new-test/all.T b/testsuite/tests/driver/th-new-test/all.T
new file mode 100644
index 0000000000..8a98d69919
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/all.T
@@ -0,0 +1,4 @@
+test('th-new-test', [extra_files(['A.hs', 'B.hs', 'C.hs', 'D.hs', 'B1.hs', 'D1.hs', 'Main.hs']),
+ when(fast(), skip)
+ , normalise_slashes],
+ makefile_test, [])
diff --git a/testsuite/tests/driver/th-new-test/th-new-test.stdout b/testsuite/tests/driver/th-new-test/th-new-test.stdout
new file mode 100644
index 0000000000..7f31ce608f
--- /dev/null
+++ b/testsuite/tests/driver/th-new-test/th-new-test.stdout
@@ -0,0 +1,17 @@
+[1 of 5] Compiling B
+[2 of 5] Compiling A
+[3 of 5] Compiling D
+[4 of 5] Compiling C
+[5 of 5] Compiling Main
+Linking Main ...
+[1 of 5] Compiling B [Source file changed]
+[2 of 5] Compiling A [B[TH] changed]
+Linking Main ...
+[3 of 5] Compiling D [Source file changed]
+[4 of 5] Compiling C [D[TH] changed]
+Linking Main ...
+[1 of 5] Compiling B [Source file changed]
+[2 of 5] Compiling A [B[TH] changed]
+[3 of 5] Compiling D [Source file changed]
+[4 of 5] Compiling C [D[TH] changed]
+Linking Main ...
diff --git a/testsuite/tests/gadt/Makefile b/testsuite/tests/gadt/Makefile
index db4e0521a4..aa5271d3fd 100644
--- a/testsuite/tests/gadt/Makefile
+++ b/testsuite/tests/gadt/Makefile
@@ -19,9 +19,7 @@ T7321:
gadt23:
$(RM) gadt23 gadt23.hi gadt23.o Gadt23_AST.hi Gadt23_AST.o
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make gadt23.hs
- # We want to "touch gadt23.hs" really, but we then have issues with
- # everything happening in the same second so the touch having no
- # effect. Thus make gadt23.hi/o older instead.
- touch -t 01010000 gadt23.hi gadt23.o
+ # Append a blank line to gadt23.hs to trigger a recompile
+ echo >> gadt23.hs
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make gadt23.hs
diff --git a/testsuite/tests/gadt/all.T b/testsuite/tests/gadt/all.T
index 225d8e8650..91ba74b722 100644
--- a/testsuite/tests/gadt/all.T
+++ b/testsuite/tests/gadt/all.T
@@ -27,7 +27,7 @@ test('gadt20', normal, compile, [''])
test('gadt21', normal, compile_fail, [''])
test('gadt22', normal, compile, [''])
-test('gadt23', [extra_files(['Gadt23_AST.hs'])], makefile_test, ['gadt23'])
+test('gadt23', [copy_files, extra_files(['Gadt23_AST.hs'])], makefile_test, ['gadt23'])
test('gadt24', normal, compile, [''])
diff --git a/testsuite/tests/ghc-api/T6145.hs b/testsuite/tests/ghc-api/T6145.hs
index 3d929c8c9d..392c318768 100644
--- a/testsuite/tests/ghc-api/T6145.hs
+++ b/testsuite/tests/ghc-api/T6145.hs
@@ -30,8 +30,7 @@ main = do
p <- parseModule modSum
t <- typecheckModule p
d <- desugarModule t
- l <- loadModule d
- let ts=typecheckedSource l
+ let ts=typecheckedSource d
-- liftIO (putStr (showSDocDebug (ppr ts)))
let fs=filterBag isDataCon ts
return $ not $ isEmptyBag fs
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/all.T b/testsuite/tests/ghci.debugger/scripts/break022/all.T
index a4acedea38..87fb764f69 100644
--- a/testsuite/tests/ghci.debugger/scripts/break022/all.T
+++ b/testsuite/tests/ghci.debugger/scripts/break022/all.T
@@ -1,3 +1,3 @@
setTestOpts(extra_run_opts('-ignore-dot-ghci'))
-test('break022', [extra_files(['A1.hs', 'B.hs', 'B.hs-boot', 'C.hs'])], ghci_script, ['break022.script'])
+test('break022', [extra_files(['../../../ghci/shell.hs', 'A1.hs', 'B.hs', 'B.hs-boot', 'C.hs'])], ghci_script, ['break022.script'])
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/break022.script b/testsuite/tests/ghci.debugger/scripts/break022/break022.script
index 33780a1408..42cc8979ea 100644
--- a/testsuite/tests/ghci.debugger/scripts/break022/break022.script
+++ b/testsuite/tests/ghci.debugger/scripts/break022/break022.script
@@ -1,3 +1,5 @@
+:l shell.hs
+:def shell (\s -> do shell s; return "")
-- We have this structure of modules:
@@ -10,9 +12,9 @@
-- But first we touch A, and reload. B.boot will be reloaded, but not B, which will end up with an empty modbreaks. When we :step into B, ghci will die with an out of bounds access in B's break array.
-- The effect we want is B.boot being reloaded while B is not.
-:! cp A1.hs A.hs
+:shell cp A1.hs A.hs
:l C
-:! touch A.hs
+:shell echo >> A.hs
:r
:break a
a ()
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/all.T b/testsuite/tests/ghci.debugger/scripts/break023/all.T
index 7a5dd1b3cb..794c4c4a38 100644
--- a/testsuite/tests/ghci.debugger/scripts/break023/all.T
+++ b/testsuite/tests/ghci.debugger/scripts/break023/all.T
@@ -1,3 +1,3 @@
setTestOpts(extra_run_opts('-ignore-dot-ghci'))
-test('break023', [extra_files(['A1.hs', 'B.hs', 'B.hs-boot', 'C.hs'])], ghci_script, ['break023.script'])
+test('break023', [extra_files(['../../../ghci/shell.hs', 'A1.hs', 'B.hs', 'B.hs-boot', 'C.hs'])], ghci_script, ['break023.script'])
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/break023.script b/testsuite/tests/ghci.debugger/scripts/break023/break023.script
index a7a0916863..080dcd2c24 100644
--- a/testsuite/tests/ghci.debugger/scripts/break023/break023.script
+++ b/testsuite/tests/ghci.debugger/scripts/break023/break023.script
@@ -1,3 +1,5 @@
+:l shell.hs
+:def shell (\s -> do shell s; return "")
-- We have this structure of modules:
@@ -10,9 +12,9 @@
-- But first we touch A, and reload. B.boot will be reloaded, but not B, which will end up with an empty modbreaks. We can no longer set a breakpoint in B.b
-- The effect we want is B.boot being reloaded while B is not.
-:! cp A1.hs A.hs
+:shell cp A1.hs A.hs
:l C
:break b -- it works ok at this point
-:! touch A.hs
+:shell echo >> A.hs
:r
:break b -- it does not work anymore
diff --git a/testsuite/tests/ghci/prog001/prog001.script b/testsuite/tests/ghci/prog001/prog001.script
index 3d0e973c57..f08b8b0155 100644
--- a/testsuite/tests/ghci/prog001/prog001.script
+++ b/testsuite/tests/ghci/prog001/prog001.script
@@ -17,9 +17,8 @@
-- make sure `main' works
main
--- touch a module + recompile
-:shell sleep 1
-:shell touch C.hs
+-- change a module + recompile
+:shell echo >> C.hs
:reload
-- make sure `main' still works
diff --git a/testsuite/tests/ghci/prog005/prog005.T b/testsuite/tests/ghci/prog005/prog005.T
index c9ca987c87..5327832b71 100644
--- a/testsuite/tests/ghci/prog005/prog005.T
+++ b/testsuite/tests/ghci/prog005/prog005.T
@@ -1 +1 @@
-test('prog005', [extra_files(['A1.hs', 'B.hs'])], ghci_script, ['prog005.script'])
+test('prog005', [extra_files(['../shell.hs', 'A1.hs', 'B.hs'])], ghci_script, ['prog005.script'])
diff --git a/testsuite/tests/ghci/prog005/prog005.script b/testsuite/tests/ghci/prog005/prog005.script
index d720edbd0f..44b8f8dd31 100644
--- a/testsuite/tests/ghci/prog005/prog005.script
+++ b/testsuite/tests/ghci/prog005/prog005.script
@@ -1,14 +1,16 @@
+:l shell.hs
+:def shell (\s -> do shell s; return "")
+
:unset +s
:unset +t
-:!cp A1.hs A.hs
+:shell cp A1.hs A.hs
:load B
-- eval something that isn't exported from B
z
-:!sleep 1
-:!touch A.hs
+:shell echo >> A.hs
:reload
-- A should be recompiled, B will be skipped. We should still have
diff --git a/testsuite/tests/ghci/recompTHghci/A.hs b/testsuite/tests/ghci/recompTHghci/A.hs
new file mode 100644
index 0000000000..df7dfdab91
--- /dev/null
+++ b/testsuite/tests/ghci/recompTHghci/A.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module A where
+
+import B
+
+main = $(b)
diff --git a/testsuite/tests/ghci/recompTHghci/B1.hs b/testsuite/tests/ghci/recompTHghci/B1.hs
new file mode 100644
index 0000000000..c57def3417
--- /dev/null
+++ b/testsuite/tests/ghci/recompTHghci/B1.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module B where
+
+b = [| print 0 |]
diff --git a/testsuite/tests/ghci/recompTHghci/B2.hs b/testsuite/tests/ghci/recompTHghci/B2.hs
new file mode 100644
index 0000000000..99c3171111
--- /dev/null
+++ b/testsuite/tests/ghci/recompTHghci/B2.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module B where
+
+b = [| print 1 |]
diff --git a/testsuite/tests/ghci/recompTHghci/Makefile b/testsuite/tests/ghci/recompTHghci/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/ghci/recompTHghci/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/ghci/recompTHghci/all.T b/testsuite/tests/ghci/recompTHghci/all.T
new file mode 100644
index 0000000000..033712aef0
--- /dev/null
+++ b/testsuite/tests/ghci/recompTHghci/all.T
@@ -0,0 +1,6 @@
+test('recompTHghci',
+ [extra_files(['../shell.hs', 'A.hs', 'B1.hs', 'B2.hs']),
+ cmd_prefix('ghciWayFlags=' + config.ghci_way_flags),
+ req_interp,
+ unless(opsys('mingw32') or not config.have_RTS_linker, extra_ways(['ghci-ext']))],
+ ghci_script, ['recompTHghci.script'])
diff --git a/testsuite/tests/ghci/recompTHghci/recompTHghci.script b/testsuite/tests/ghci/recompTHghci/recompTHghci.script
new file mode 100644
index 0000000000..fc61500a09
--- /dev/null
+++ b/testsuite/tests/ghci/recompTHghci/recompTHghci.script
@@ -0,0 +1,24 @@
+:unset +s
+
+:l shell.hs
+:def shell (\s -> do shell s; return "")
+
+-- first, tidy up:
+:shell rm -f *.hi *.o *~
+:shell cp B1.hs B.hs
+
+-- load the program (all interpreted)
+:load A.hs
+
+-- reloading should do nothing
+:reload
+
+-- make sure `main' works
+main
+
+-- change a module + recompile
+:shell cp B2.hs B.hs
+:reload
+
+-- make sure `main' still works
+main
diff --git a/testsuite/tests/ghci/recompTHghci/recompTHghci.stdout b/testsuite/tests/ghci/recompTHghci/recompTHghci.stdout
new file mode 100644
index 0000000000..0d66ea1aee
--- /dev/null
+++ b/testsuite/tests/ghci/recompTHghci/recompTHghci.stdout
@@ -0,0 +1,2 @@
+0
+1
diff --git a/testsuite/tests/ghci/scripts/Defer03.hs b/testsuite/tests/ghci/scripts/Defer03_before.hs
index b0f65fbade..b0f65fbade 100644
--- a/testsuite/tests/ghci/scripts/Defer03.hs
+++ b/testsuite/tests/ghci/scripts/Defer03_before.hs
diff --git a/testsuite/tests/ghci/scripts/T17669.stdout b/testsuite/tests/ghci/scripts/T17669.stdout
index a62c5ee82e..4d3d1718ba 100644
--- a/testsuite/tests/ghci/scripts/T17669.stdout
+++ b/testsuite/tests/ghci/scripts/T17669.stdout
@@ -1,6 +1,6 @@
[1 of 1] Compiling T17669 ( T17669.hs, T17669.o )
Ok, one module loaded.
this
-[1 of 1] Compiling T17669 ( T17669.hs, T17669.o )
+[1 of 1] Compiling T17669 ( T17669.hs, T17669.o ) [Source file changed]
Ok, one module loaded.
that
diff --git a/testsuite/tests/ghci/scripts/T1914.script b/testsuite/tests/ghci/scripts/T1914.script
index 5a74350341..85bd74a63c 100644
--- a/testsuite/tests/ghci/scripts/T1914.script
+++ b/testsuite/tests/ghci/scripts/T1914.script
@@ -1,16 +1,15 @@
+:l shell.hs
+:def shell (\s -> do shell s; return "")
+
:set -v1
System.IO.writeFile "T1914A.hs" "module T1914A where { import T1914B; }"
System.IO.writeFile "T1914B.hs" "module T1914B where { type T = Int; }"
--- hack: avoid the need for sleep by using specific timestamps:
-:! touch -t 01010000 T1914A.hs
-:! touch -t 01010000 T1914B.hs
:load T1914A
System.IO.writeFile "T1914A.hs" "module T1914A where { import T1914B; oops }"
-:! touch -t 01010001 T1914A.hs
:reload
-- T1914B should still be loaded
:module *T1914B
System.IO.writeFile "T1914A.hs" "module T1914A where { import T1914B; }"
-:! touch -t 01010002 T1914A.hs
+:shell echo >> T1914A.hs
:reload
-- should not have to reload T1914B
diff --git a/testsuite/tests/ghci/scripts/T1914.stdout b/testsuite/tests/ghci/scripts/T1914.stdout
index 6612564354..dfeeeca727 100644
--- a/testsuite/tests/ghci/scripts/T1914.stdout
+++ b/testsuite/tests/ghci/scripts/T1914.stdout
@@ -1,7 +1,7 @@
[1 of 2] Compiling T1914B ( T1914B.hs, interpreted )
[2 of 2] Compiling T1914A ( T1914A.hs, interpreted )
Ok, two modules loaded.
-[2 of 2] Compiling T1914A ( T1914A.hs, interpreted )
+[2 of 2] Compiling T1914A ( T1914A.hs, interpreted ) [Source file changed]
Failed, one module loaded.
[2 of 2] Compiling T1914A ( T1914A.hs, interpreted )
Ok, two modules loaded.
diff --git a/testsuite/tests/ghci/scripts/T8042.stdout b/testsuite/tests/ghci/scripts/T8042.stdout
index fe2720d35d..9a06c41189 100644
--- a/testsuite/tests/ghci/scripts/T8042.stdout
+++ b/testsuite/tests/ghci/scripts/T8042.stdout
@@ -2,7 +2,7 @@
[2 of 3] Compiling T8042C ( T8042C.hs, interpreted )
[3 of 3] Compiling T8042A ( T8042A.hs, interpreted )
Ok, three modules loaded.
-[3 of 3] Compiling T8042A ( T8042A.hs, T8042A.o )
+[3 of 3] Compiling T8042A ( T8042A.hs, T8042A.o ) [Source file changed]
Ok, three modules loaded.
[2 of 3] Compiling T8042C ( T8042C.hs, interpreted )
[3 of 3] Compiling T8042A ( T8042A.hs, interpreted )
diff --git a/testsuite/tests/ghci/scripts/T8353.script b/testsuite/tests/ghci/scripts/T8353.script
index d93fb6e4cb..7e68cee238 100644
--- a/testsuite/tests/ghci/scripts/T8353.script
+++ b/testsuite/tests/ghci/scripts/T8353.script
@@ -1,3 +1,9 @@
+:l shell.hs
+:def shell (\s -> do shell s; return "")
+:l
+
+:shell cp Defer03_before.hs Defer03.hs
+
-- Test :load! and :reload!
-- main is independent of functions with type errors and thus
@@ -11,12 +17,14 @@
-- succeeds again to load module
:reload!
--- also succeeds, because the module has not been touched since load
+-- also succeeds, because the module has not been changed since load
:reload
--- now, after touching, reloading should fail
-:! touch Defer03.hs
+-- now, after modifying, reloading should fail
+:shell echo "-- an extra comment so that the hash changes" >> Defer03.hs
:reload
-- using the deferred version of reload, loading should succeed again
:reload!
+
+:shell rm Defer03.hs
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 10c224b46b..e4fae93e6b 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -102,7 +102,7 @@ test('ghci061', normal, ghci_script, ['ghci061.script'])
test('ghci062', [extra_files(['ghci062/', 'ghci062/Test.hs']),
when(config.have_ext_interp, extra_ways(['ghci-ext']))],
ghci_script, ['ghci062.script'])
-test('ghci063', normal, ghci_script, ['ghci063.script'])
+test('ghci063', [extra_files(['../shell.hs'])], ghci_script, ['ghci063.script'])
test('ghci064', normal, ghci_script, ['ghci064.script'])
test('ghci065', [extra_hc_opts("-haddock")], ghci_script, ['ghci065.script'])
test('ghci066', normal, ghci_script, ['ghci066.script'])
@@ -110,7 +110,7 @@ test('T2452', [extra_hc_opts("-fno-implicit-import-qualified")],
ghci_script, ['T2452.script'])
test('T2766', normal, ghci_script, ['T2766.script'])
-test('T1914', [], ghci_script, ['T1914.script'])
+test('T1914', [extra_files(['../shell.hs'])], ghci_script, ['T1914.script'])
test('T2182ghci', normal, ghci_script, ['T2182ghci.script'])
test('T2182ghci2', [extra_hc_opts("-XNoImplicitPrelude")], ghci_script, ['T2182ghci2.script'])
@@ -142,10 +142,10 @@ test('T5979',
normalise_version("transformers")],
ghci_script, ['T5979.script'])
test('T5975a',
- pre_cmd('touch föøbàr1.hs'),
+ pre_cmd('echo >> föøbàr1.hs'),
ghci_script, ['T5975a.script'])
test('T5975b',
- [pre_cmd('touch föøbàr2.hs'), extra_hc_opts('föøbàr2.hs')],
+ [pre_cmd('echo >> föøbàr2.hs'), extra_hc_opts('föøbàr2.hs')],
ghci_script, ['T5975b.script'])
test('T6027ghci', normal, ghci_script, ['T6027ghci.script'])
@@ -181,7 +181,7 @@ test('T8172', when(opsys('mingw32'), normalise_drive_letter),
ghci_script, ['T8172.script'])
test('T8215', normal, ghci_script, ['T8215.script'])
test('T8305', normal, ghci_script, ['T8305.script'])
-test('T8353', extra_files(['Defer03.hs']), ghci_script, ['T8353.script'])
+test('T8353', extra_files(['../shell.hs', 'Defer03_before.hs']), ghci_script, ['T8353.script'])
test('T8357', normal, ghci_script, ['T8357.script'])
test('T8383', normal, ghci_script, ['T8383.script'])
test('T8469', normal, ghci_script, ['T8469.script'])
diff --git a/testsuite/tests/ghci/scripts/ghci063.script b/testsuite/tests/ghci/scripts/ghci063.script
index 6cba37b9ab..5b74e1841d 100644
--- a/testsuite/tests/ghci/scripts/ghci063.script
+++ b/testsuite/tests/ghci/scripts/ghci063.script
@@ -1,5 +1,9 @@
-:! echo module A where {} >A.hs
-:! echo module B where { import A } >B.hs
+:l shell.hs
+:def shell (\s -> do shell s; return "")
+:l
+
+:shell echo module A where {} >A.hs
+:shell echo module B where { import A } >B.hs
-- Workaround for #16201. We use "touch -r" to set modification
-- timestamps, which leads to precision loss on Darwin. For example,
@@ -11,20 +15,21 @@
-- by restoring its old timestamp, as we cannot faithfully restore all digits.
--
-- The solution is to nullify the insignificant digits before the first load.
-:! touch -r B.hs B.hs
+:shell touch -r B.hs B.hs
:load B
-- We're going to replace B.hs with an invalid module but without
--- changing its timestamp. A :reload should *not* look at the
--- contents of the file, because the timestamp hasn't changed.
-:! cp B.hs B.hs-copy
-:! touch -r B.hs B.hs-copy
-:! echo "*** INVALID ***" >B.hs
-:! touch -r B.hs-copy B.hs
+-- changing its timestamp. A :reload should look at the contents of the
+-- file, because the hash has changed. Note that this test previously tested
+-- for the opposite behaviour, but was changed as a result of #19439 / #16495.
+:shell cp B.hs B.hs-copy
+:shell touch -r B.hs B.hs-copy
+:shell echo "*** INVALID ***" >B.hs
+:shell touch -r B.hs-copy B.hs
:reload
-- Put the original file back, now it should work
-:! cp B.hs-copy B.hs
+:shell cp B.hs-copy B.hs
:reload
diff --git a/testsuite/tests/ghci/scripts/ghci063.stderr b/testsuite/tests/ghci/scripts/ghci063.stderr
new file mode 100644
index 0000000000..cc357499a2
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci063.stderr
@@ -0,0 +1,2 @@
+
+B.hs:1:1: error: parse error on input ‘***’
diff --git a/testsuite/tests/perf/compiler/Makefile b/testsuite/tests/perf/compiler/Makefile
index 66597883b6..20f5704450 100644
--- a/testsuite/tests/perf/compiler/Makefile
+++ b/testsuite/tests/perf/compiler/Makefile
@@ -12,3 +12,7 @@ T11068:
'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T11068a.hs
'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T11068b.hs
-'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T11068.hs -ddump-simpl | grep 'Generic'
+
+MultiModulesRecomp:
+ ./genMultiLayerModules
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 MultiLayerModules.hs
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 04d03e0568..eadf2ff920 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -276,6 +276,22 @@ test('MultiLayerModules',
multimod_compile,
['MultiLayerModules', '-v0'])
+# MultiLayerModules flip flops by 2.5%, depending on the
+# number of modules within GHC (#19293). Just widen the
+# acceptance window until we figured out how to fix it.
+test('MultiLayerModulesRecomp',
+ [ collect_compiler_stats('bytes allocated',3),
+ pre_cmd('$MAKE -s --no-print-directory MultiModulesRecomp'),
+ extra_files(['genMultiLayerModules']),
+ compile_timeout_multiplier(5)
+ # this is _a lot_
+ # but this test has been failing every now and then,
+ # especially on i386. Let's just give it some room
+ # to complete successfully reliably everywhere.
+ ],
+ multimod_compile,
+ ['MultiLayerModules', '-v0'])
+
test('ManyConstructors',
[ collect_compiler_stats('bytes allocated',2),
pre_cmd('./genManyConstructors'),
diff --git a/testsuite/tests/perf/space_leaks/T4029.script b/testsuite/tests/perf/space_leaks/T4029.script
index 91135c9477..f2faa4fd1a 100644
--- a/testsuite/tests/perf/space_leaks/T4029.script
+++ b/testsuite/tests/perf/space_leaks/T4029.script
@@ -102,203 +102,203 @@
-- Load a minimalist module and reload it 99 times
:load T4029a
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-:! touch T4029a.hs
+:! echo >> T4029a.hs
:reload
-- Load a more complex module 10 times
@@ -315,21 +315,21 @@
-- Load a more complex module and reload it 9 times
:load T4029b
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
-:! touch T4029b.hs
+:! echo >> T4029b.hs
:reload
diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T
index deb5ea38e4..f6638555c9 100644
--- a/testsuite/tests/perf/space_leaks/all.T
+++ b/testsuite/tests/perf/space_leaks/all.T
@@ -31,7 +31,7 @@ test('T4018',
compile_and_run, ['-fno-state-hack'])
test('T4029',
- [collect_runtime_residency(10),
+ [copy_files, collect_runtime_residency(10),
],
ghci_script,
['T4029.script'])
diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T
index e02681d7c0..12aba63022 100644
--- a/testsuite/tests/plugins/all.T
+++ b/testsuite/tests/plugins/all.T
@@ -225,3 +225,5 @@ test('test-hooks-plugin',
],
compile_and_run,
['-package-db hooks-plugin/pkg.hooks-plugin/local.package.conf '+ config.plugin_way_flags])
+
+test('plugins-ghci', [extra_files(['HomePackagePlugin.hs']), only_ways(['ghci'])], compile_and_run, ['-package ghc'])
diff --git a/testsuite/tests/plugins/plugins-ghci.hs b/testsuite/tests/plugins/plugins-ghci.hs
new file mode 100644
index 0000000000..57efb9e7e7
--- /dev/null
+++ b/testsuite/tests/plugins/plugins-ghci.hs
@@ -0,0 +1,4 @@
+{-# OPTIONS_GHC -fplugin=HomePackagePlugin #-}
+module Main where
+
+main = print ()
diff --git a/testsuite/tests/plugins/plugins-ghci.stdout b/testsuite/tests/plugins/plugins-ghci.stdout
new file mode 100644
index 0000000000..6a452c185a
--- /dev/null
+++ b/testsuite/tests/plugins/plugins-ghci.stdout
@@ -0,0 +1 @@
+()