summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2015-11-18 16:42:24 +0000
committerSimon Marlow <marlowsd@gmail.com>2015-12-17 09:39:52 +0000
commit4905b83a2d448c65ccced385343d4e8124548a3b (patch)
tree070cf9e48f6fce668cd01d888b8da8b3772d1f53 /testsuite/tests
parent7221ad70daa363d77f60d96c3f6e1baa1d9bec81 (diff)
downloadhaskell-4905b83a2d448c65ccced385343d4e8124548a3b.tar.gz
Remote GHCi, -fexternal-interpreter
Summary: (Apologies for the size of this patch, I couldn't make a smaller one that was validate-clean and also made sense independently) (Some of this code is derived from GHCJS.) This commit adds support for running interpreted code (for GHCi and TemplateHaskell) in a separate process. The functionality is experimental, so for now it is off by default and enabled by the flag -fexternal-interpreter. Reaosns we want this: * compiling Template Haskell code with -prof does not require building the code without -prof first * when GHC itself is profiled, it can interpret unprofiled code, and the same applies to dynamic linking. We would no longer need to force -dynamic-too with TemplateHaskell, and we can load ordinary objects into a dynamically-linked GHCi (and vice versa). * An unprofiled GHCi can load and run profiled code, which means it can use the stack-trace functionality provided by profiling without taking the performance hit on the compiler that profiling would entail. Amongst other things; see https://ghc.haskell.org/trac/ghc/wiki/RemoteGHCi for more details. Notes on the implementation are in Note [Remote GHCi] in the new module compiler/ghci/GHCi.hs. It probably needs more documenting, feel free to suggest things I could elaborate on. Things that are not currently implemented for -fexternal-interpreter: * The GHCi debugger * :set prog, :set args in GHCi * `recover` in Template Haskell * Redirecting stdin/stdout for the external process These are all doable, I just wanted to get to a working validate-clean patch first. I also haven't done any benchmarking yet. I expect there to be slight hit to link times for byte code and some penalty due to having to serialize/deserialize TH syntax, but I don't expect it to be a serious problem. There's also lots of low-hanging fruit in the byte code generator/linker that we could exploit to speed things up. Test Plan: * validate * I've run parts of the test suite with EXTRA_HC_OPTS=-fexternal-interpreter, notably tests/ghci and tests/th. There are a few failures due to the things not currently implemented (see above). Reviewers: simonpj, goldfire, ezyang, austin, alanz, hvr, niteria, bgamari, gibiansky, luite Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1562
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/annotations/should_run/annrun01.hs2
-rw-r--r--testsuite/tests/cabal/cabal04/Makefile3
-rw-r--r--testsuite/tests/cabal/cabal04/all.T2
-rw-r--r--testsuite/tests/ghc-api/T4891/T4891.hs19
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break006.stderr4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break011.script3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break011.stdout12
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break013.stdout2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break024.stdout4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print019.stderr2
-rw-r--r--testsuite/tests/ghci/prog001/prog001-ext.stdout4
-rw-r--r--testsuite/tests/ghci/prog001/prog001.T4
-rw-r--r--testsuite/tests/ghci/scripts/T10110A.hs1
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T12
-rw-r--r--testsuite/tests/profiling/should_run/scc003.prof.sample48
-rw-r--r--testsuite/tests/rts/LinkerUnload.hs4
-rw-r--r--testsuite/tests/rts/T2615.hs2
-rw-r--r--testsuite/tests/th/Makefile7
-rw-r--r--testsuite/tests/th/TH_Roles2.stderr5
-rw-r--r--testsuite/tests/th/TH_finalizer.hs11
-rw-r--r--testsuite/tests/th/TH_finalizer.stderr2
-rw-r--r--testsuite/tests/th/TH_spliceE5_prof_ext.hs14
-rw-r--r--testsuite/tests/th/TH_spliceE5_prof_ext.stdout1
-rw-r--r--testsuite/tests/th/TH_spliceE5_prof_ext_Lib.hs8
-rw-r--r--testsuite/tests/th/all.T10
25 files changed, 136 insertions, 50 deletions
diff --git a/testsuite/tests/annotations/should_run/annrun01.hs b/testsuite/tests/annotations/should_run/annrun01.hs
index 6fd07252cc..0dbd44dd92 100644
--- a/testsuite/tests/annotations/should_run/annrun01.hs
+++ b/testsuite/tests/annotations/should_run/annrun01.hs
@@ -6,7 +6,7 @@ import GHC
import MonadUtils ( liftIO )
import DynFlags ( defaultFatalMessager, defaultFlushOut )
import Annotations ( AnnTarget(..), CoreAnnTarget )
-import Serialized ( deserializeWithData )
+import GHC.Serialized ( deserializeWithData )
import Panic
import Config
diff --git a/testsuite/tests/cabal/cabal04/Makefile b/testsuite/tests/cabal/cabal04/Makefile
index 9aaa25f404..6c43dde45d 100644
--- a/testsuite/tests/cabal/cabal04/Makefile
+++ b/testsuite/tests/cabal/cabal04/Makefile
@@ -14,7 +14,7 @@ cabal04:
$(MAKE) clean
'$(TEST_HC)' -v0 --make Setup
$(SETUP) clean
- $(SETUP) configure --with-ghc='$(TEST_HC)' --ghc-options='$(filter-out -rtsopts,$(TEST_HC_OPTS))' $(VANILLA) $(PROF) $(DYN) --ghc-options='$(ghcThWayFlags)'
+ $(SETUP) configure --with-ghc='$(TEST_HC)' --ghc-options='$(filter-out -rtsopts,$(TEST_HC_OPTS))' $(VANILLA) $(PROF) $(DYN)
$(SETUP) build 2> err
! grep -v "Creating library file" err
ifneq "$(CLEANUP)" ""
@@ -23,4 +23,3 @@ endif
clean :
$(RM) -r *.o *.hi dist Setup$(exeext) err
-
diff --git a/testsuite/tests/cabal/cabal04/all.T b/testsuite/tests/cabal/cabal04/all.T
index 53d90145ce..b2794a5e10 100644
--- a/testsuite/tests/cabal/cabal04/all.T
+++ b/testsuite/tests/cabal/cabal04/all.T
@@ -20,5 +20,5 @@ else:
test('cabal04',
normal,
- run_command,
+ run_command,
['$MAKE -s --no-print-directory cabal04 VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn + ' ' + cleanup])
diff --git a/testsuite/tests/ghc-api/T4891/T4891.hs b/testsuite/tests/ghc-api/T4891/T4891.hs
index 854bf62998..b2f8cc464d 100644
--- a/testsuite/tests/ghc-api/T4891/T4891.hs
+++ b/testsuite/tests/ghc-api/T4891/T4891.hs
@@ -35,17 +35,16 @@ doit = do
dflags' <- getSessionDynFlags
primPackages <- setSessionDynFlags dflags'
dflags <- getSessionDynFlags
- defaultCleanupHandler dflags $ do
- target <- guessTarget "X.hs" Nothing
- setTargets [target]
- load LoadAllTargets
+ target <- guessTarget "X.hs" Nothing
+ setTargets [target]
+ load LoadAllTargets
- () <- chaseConstructor (unsafeCoerce False)
- () <- chaseConstructor (unsafeCoerce [1,2,3])
- () <- chaseConstructor (unsafeCoerce (3 :-> 2))
- () <- chaseConstructor (unsafeCoerce (4 :->. 4))
- () <- chaseConstructor (unsafeCoerce (4 :->.+ 4))
- return ()
+ () <- chaseConstructor (unsafeCoerce False)
+ () <- chaseConstructor (unsafeCoerce [1,2,3])
+ () <- chaseConstructor (unsafeCoerce (3 :-> 2))
+ () <- chaseConstructor (unsafeCoerce (4 :->. 4))
+ () <- chaseConstructor (unsafeCoerce (4 :->.+ 4))
+ return ()
chaseConstructor :: (GhcMonad m) => HValue -> m ()
chaseConstructor !hv = do
diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr
index 16ba5ec004..58faa697c5 100644
--- a/testsuite/tests/ghci.debugger/scripts/break006.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr
@@ -10,7 +10,7 @@
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
...plus 23 others
- ...plus 13 instance involving out-of-scope typess
+ ...plus 19 instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
@@ -25,6 +25,6 @@
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
...plus 23 others
- ...plus 13 instance involving out-of-scope typess
+ ...plus 19 instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci.debugger/scripts/break011.script b/testsuite/tests/ghci.debugger/scripts/break011.script
index f9ca3fe393..e913a2f240 100644
--- a/testsuite/tests/ghci.debugger/scripts/break011.script
+++ b/testsuite/tests/ghci.debugger/scripts/break011.script
@@ -15,4 +15,7 @@ error "foo"
:force _exception
:show bindings
:force _result
+-- the exception is caught by the withProg/withArgs wrappers, hence 3 :continues
+:continue
+:continue
:continue
diff --git a/testsuite/tests/ghci.debugger/scripts/break011.stdout b/testsuite/tests/ghci.debugger/scripts/break011.stdout
index dee4d94360..ec0b3e9609 100644
--- a/testsuite/tests/ghci.debugger/scripts/break011.stdout
+++ b/testsuite/tests/ghci.debugger/scripts/break011.stdout
@@ -32,6 +32,18 @@ _exception :: SomeException = SomeException
*** Exception: foo
CallStack (from ImplicitParams):
error, called at ../Test7.hs:2:18 in main:Main
+Stopped at <exception thrown>
+_exception :: e = SomeException
+ (ErrorCallWithLocation
+ "foo"
+ "CallStack (from ImplicitParams):
+ error, called at ../Test7.hs:2:18 in main:Main")
+Stopped at <exception thrown>
+_exception :: e = SomeException
+ (ErrorCallWithLocation
+ "foo"
+ "CallStack (from ImplicitParams):
+ error, called at ../Test7.hs:2:18 in main:Main")
*** Exception: foo
CallStack (from ImplicitParams):
error, called at ../Test7.hs:2:18 in main:Main
diff --git a/testsuite/tests/ghci.debugger/scripts/break013.stdout b/testsuite/tests/ghci.debugger/scripts/break013.stdout
index 4c3d5f3d76..13d203f0b3 100644
--- a/testsuite/tests/ghci.debugger/scripts/break013.stdout
+++ b/testsuite/tests/ghci.debugger/scripts/break013.stdout
@@ -5,7 +5,7 @@ _result :: (Bool, Bool, ()) = _
a :: Bool = _
b :: Bool = _
c :: () = _
-c :: () = _
b :: Bool = _
+c :: () = _
a :: Bool = _
_result :: (Bool, Bool, ()) = _
diff --git a/testsuite/tests/ghci.debugger/scripts/break024.stdout b/testsuite/tests/ghci.debugger/scripts/break024.stdout
index dc3bd73425..548e7a4470 100644
--- a/testsuite/tests/ghci.debugger/scripts/break024.stdout
+++ b/testsuite/tests/ghci.debugger/scripts/break024.stdout
@@ -10,7 +10,9 @@ _exception :: e = _
_exception = SomeException
(GHC.IO.Exception.IOError
Nothing GHC.IO.Exception.UserError [] "error" Nothing Nothing)
-*** Exception: user error (error)
+Stopped at <exception thrown>
+_exception :: e = SomeException
+ (GHC.IO.Exception.IOError Nothing GHC.IO.Exception.UserError ....)
Stopped at <exception thrown>
_exception :: e = _
_exception = SomeException
diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stderr b/testsuite/tests/ghci.debugger/scripts/print019.stderr
index fa53d94701..c1dc48bf21 100644
--- a/testsuite/tests/ghci.debugger/scripts/print019.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr
@@ -9,6 +9,6 @@
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show TyCon -- Defined in ‘GHC.Show’
...plus 30 others
- ...plus two instance involving out-of-scope typess
+ ...plus 8 instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci/prog001/prog001-ext.stdout b/testsuite/tests/ghci/prog001/prog001-ext.stdout
new file mode 100644
index 0000000000..eef24c2153
--- /dev/null
+++ b/testsuite/tests/ghci/prog001/prog001-ext.stdout
@@ -0,0 +1,4 @@
+"hello world84"
+"hello world84"
+"hello world84"
+44
diff --git a/testsuite/tests/ghci/prog001/prog001.T b/testsuite/tests/ghci/prog001/prog001.T
index 1ef3c0430c..af221e6fd9 100644
--- a/testsuite/tests/ghci/prog001/prog001.T
+++ b/testsuite/tests/ghci/prog001/prog001.T
@@ -1,5 +1,5 @@
test('prog001',
[extra_clean(['C.hs', 'D.hs', 'D.hi', 'D.o']),
- cmd_prefix('ghciWayFlags=' + config.ghci_way_flags)],
+ cmd_prefix('ghciWayFlags=' + config.ghci_way_flags),
+ unless(opsys('mingw32'),extra_ways(['ghci-ext']))],
ghci_script, ['prog001.script'])
-
diff --git a/testsuite/tests/ghci/scripts/T10110A.hs b/testsuite/tests/ghci/scripts/T10110A.hs
index 8482e7f673..ab64cfd016 100644
--- a/testsuite/tests/ghci/scripts/T10110A.hs
+++ b/testsuite/tests/ghci/scripts/T10110A.hs
@@ -1,4 +1,5 @@
module T10110A (a) where
+import Debug.Trace
{-# NOINLINE a #-}
a :: Int
a = 3
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 1a664d128d..5c25cf8bb0 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -3,9 +3,13 @@
test('ghci001', combined_output, ghci_script, ['ghci001.script'])
test('ghci002', combined_output, ghci_script, ['ghci002.script'])
test('ghci003', combined_output, ghci_script, ['ghci003.script'])
-test('ghci004', combined_output, ghci_script, ['ghci004.script'])
+test('ghci004', [ combined_output,
+ unless(opsys('mingw32'),extra_ways(['ghci-ext'])) ],
+ ghci_script, ['ghci004.script'])
test('ghci005', combined_output, ghci_script, ['ghci005.script'])
-test('ghci006', combined_output, ghci_script, ['ghci006.script'])
+test('ghci006', [ combined_output,
+ unless(opsys('mingw32'),extra_ways(['ghci-ext'])) ],
+ ghci_script, ['ghci006.script'])
test('ghci007', combined_output, ghci_script, ['ghci007.script'])
test('ghci008', combined_output, ghci_script, ['ghci008.script'])
test('ghci009', combined_output, ghci_script, ['ghci009.script'])
@@ -84,7 +88,7 @@ test('ghci056',
],
ghci_script, ['ghci056.script'])
-test('ghci057', normal, ghci_script_without_flag('-fno-warn-tabs'), ['ghci057.script'])
+test('ghci057', extra_hc_opts('-fwarn-tabs'), ghci_script, ['ghci057.script'])
test('T2452', normal, ghci_script, ['T2452.script'])
test('T2766', normal, ghci_script, ['T2766.script'])
@@ -192,7 +196,7 @@ test('T9181', normal, ghci_script, ['T9181.script'])
test('T9086b', normal, ghci_script, ['T9086b.script'])
test('T9140', combined_output, ghci_script, ['T9140.script'])
test('T9658', normal, ghci_script, ['T9658.script'])
-test('T9293', normal, ghci_script_without_flag('-fno-warn-tabs'), ['T9293.script'])
+test('T9293', extra_hc_opts('-fwarn-tabs'), ghci_script, ['T9293.script'])
test('T9762',
[ unless(have_dynamic(),skip)
, pre_cmd('$MAKE -s --no-print-directory T9762_prep')
diff --git a/testsuite/tests/profiling/should_run/scc003.prof.sample b/testsuite/tests/profiling/should_run/scc003.prof.sample
index e1d0b64464..69633d4c91 100644
--- a/testsuite/tests/profiling/should_run/scc003.prof.sample
+++ b/testsuite/tests/profiling/should_run/scc003.prof.sample
@@ -1,27 +1,35 @@
- Thu Apr 2 19:44 2015 Time and Allocation Profiling Report (Final)
+ Tue Dec 8 08:29 2015 Time and Allocation Profiling Report (Final)
- scc003 +RTS -p -RTS
+ scc003 +RTS -hc -p -RTS
- total time = 0.13 secs (132 ticks @ 1000 us, 1 processor)
- total alloc = 195,487,784 bytes (excludes profiling overheads)
+ total time = 0.04 secs (40 ticks @ 1000 us, 1 processor)
+ total alloc = 48,912 bytes (excludes profiling overheads)
-COST CENTRE MODULE %time %alloc
+COST CENTRE MODULE %time %alloc
-fib Main 100.0 100.0
+fib Main 100.0 0.0
+MAIN MAIN 0.0 1.8
+main Main 0.0 19.6
+CAF GHC.Conc.Signal 0.0 1.3
+CAF GHC.IO.Encoding 0.0 5.9
+CAF GHC.IO.Handle.FD 0.0 70.6
- individual inherited
-COST CENTRE MODULE no. entries %time %alloc %time %alloc
+ individual inherited
+COST CENTRE MODULE no. entries %time %alloc %time %alloc
-MAIN MAIN 99 0 0.0 0.0 100.0 100.0
- CAF Main 197 0 0.0 0.0 100.0 100.0
- main Main 198 1 0.0 0.0 100.0 100.0
- f Main 199 1 0.0 0.0 100.0 100.0
- f.\ Main 201 1 0.0 0.0 99.2 99.2
- fib Main 202 2692537 99.2 99.2 99.2 99.2
- fib Main 200 21891 0.8 0.8 0.8 0.8
- CAF GHC.Conc.Signal 179 0 0.0 0.0 0.0 0.0
- CAF GHC.IO.Encoding 163 0 0.0 0.0 0.0 0.0
- CAF GHC.IO.Encoding.Iconv 161 0 0.0 0.0 0.0 0.0
- CAF GHC.IO.Handle.FD 152 0 0.0 0.0 0.0 0.0
- CAF GHC.IO.Handle.Text 150 0 0.0 0.0 0.0 0.0
+MAIN MAIN 105 0 0.0 1.8 100.0 100.0
+ main Main 211 0 0.0 18.9 0.0 18.9
+ CAF GHC.IO.Handle.Text 140 0 0.0 0.2 0.0 0.2
+ CAF GHC.IO.Handle.FD 138 0 0.0 70.6 0.0 70.6
+ CAF GHC.IO.Encoding.Iconv 130 0 0.0 0.5 0.0 0.5
+ CAF GHC.IO.Encoding 128 0 0.0 5.9 0.0 5.9
+ CAF GHC.Conc.Signal 118 0 0.0 1.3 0.0 1.3
+ CAF Main 112 0 0.0 0.0 100.0 0.8
+ main Main 210 1 0.0 0.7 100.0 0.8
+ f Main 212 1 0.0 0.0 100.0 0.1
+ f.\ Main 216 1 0.0 0.0 100.0 0.0
+ fib Main 217 2692537 100.0 0.0 100.0 0.0
+ f.x' Main 213 1 0.0 0.0 0.0 0.0
+ f.(...) Main 214 1 0.0 0.0 0.0 0.0
+ fib Main 215 21891 0.0 0.0 0.0 0.0
diff --git a/testsuite/tests/rts/LinkerUnload.hs b/testsuite/tests/rts/LinkerUnload.hs
index 7e9d1dd38a..9d6b243256 100644
--- a/testsuite/tests/rts/LinkerUnload.hs
+++ b/testsuite/tests/rts/LinkerUnload.hs
@@ -16,5 +16,5 @@ loadPackages = do
let dflags' = dflags { hscTarget = HscNothing
, ghcLink = LinkInMemory }
pkgs <- setSessionDynFlags dflags'
- dflags <- getSessionDynFlags
- liftIO $ Linker.linkPackages dflags pkgs
+ hsc_env <- getSession
+ liftIO $ Linker.linkPackages hsc_env pkgs
diff --git a/testsuite/tests/rts/T2615.hs b/testsuite/tests/rts/T2615.hs
index 53c2d13ceb..6a81185e9e 100644
--- a/testsuite/tests/rts/T2615.hs
+++ b/testsuite/tests/rts/T2615.hs
@@ -1,4 +1,4 @@
-import ObjLink
+import GHCi.ObjLink
library_name = "libfoo_script_T2615.so" -- this is really a linker script
diff --git a/testsuite/tests/th/Makefile b/testsuite/tests/th/Makefile
index 5d2be1eb34..b759a81b67 100644
--- a/testsuite/tests/th/Makefile
+++ b/testsuite/tests/th/Makefile
@@ -20,6 +20,13 @@ TH_spliceE5_prof::
'$(TEST_HC)' $(TEST_HC_OPTS) $(HC_OPTS) --make -v0 TH_spliceE5_prof.hs -prof -auto-all -osuf p.o -o $@
./$@
+# With -fexternal-interpreter, we don't have to build the non-profiled
+# objects first.
+TH_spliceE5_prof_ext::
+ $(RM) TH_spliceE5_prof_ext*.o TH_spliceE5_prof_ext*.hi TH_spliceE5_prof_ext*.p.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) $(HC_OPTS) --make -v0 TH_spliceE5_prof_ext.hs -prof -auto-all -fexternal-interpreter -o $@
+ ./$@
+
.PHONY: TH_Depends
TH_Depends:
$(RM) TH_Depends_external.txt
diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr
index e4a9a47858..c44e5b9d9d 100644
--- a/testsuite/tests/th/TH_Roles2.stderr
+++ b/testsuite/tests/th/TH_Roles2.stderr
@@ -5,9 +5,10 @@ TYPE CONSTRUCTORS
Kind: forall k1. k1 -> *
COERCION AXIOMS
Dependent modules: []
-Dependent packages: [array-0.5.1.0, base-4.9.0.0, deepseq-1.4.2.0,
+Dependent packages: [array-0.5.1.0, base-4.9.0.0, binary-0.7.5.0,
+ bytestring-0.10.7.0, containers-0.5.6.3, deepseq-1.4.2.0,
ghc-boot-0.0.0.0, ghc-prim-0.5.0.0, integer-gmp-1.0.0.0,
- pretty-1.1.2.0, template-haskell-2.11.0.0]
+ pretty-1.1.3.2, template-haskell-2.11.0.0]
==================== Typechecker ====================
TH_Roles2.$tcT
diff --git a/testsuite/tests/th/TH_finalizer.hs b/testsuite/tests/th/TH_finalizer.hs
new file mode 100644
index 0000000000..f59364edaf
--- /dev/null
+++ b/testsuite/tests/th/TH_finalizer.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module ShouldCompile where
+
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+
+$( do
+ addModFinalizer (do b <- getQ; reportWarning (show (b::Maybe Bool)))
+ return [] )
+$( putQ True >> return [] )
diff --git a/testsuite/tests/th/TH_finalizer.stderr b/testsuite/tests/th/TH_finalizer.stderr
new file mode 100644
index 0000000000..e89d434adb
--- /dev/null
+++ b/testsuite/tests/th/TH_finalizer.stderr
@@ -0,0 +1,2 @@
+
+TH_finalizer.hs:1:1: warning: Just True
diff --git a/testsuite/tests/th/TH_spliceE5_prof_ext.hs b/testsuite/tests/th/TH_spliceE5_prof_ext.hs
new file mode 100644
index 0000000000..255b1c5b8d
--- /dev/null
+++ b/testsuite/tests/th/TH_spliceE5_prof_ext.hs
@@ -0,0 +1,14 @@
+module Main where
+
+import TH_spliceE5_prof_ext_Lib
+
+v1 = "foo"
+
+main = putStrLn $(expandVars ["v1","v2"])
+-- The splice expands to refer to both v1 and v2,
+-- and the test checks that we don't dependency-analyse
+-- the program so that one or the other isn't in scope
+-- to the type checker
+
+
+v2 = "bar"
diff --git a/testsuite/tests/th/TH_spliceE5_prof_ext.stdout b/testsuite/tests/th/TH_spliceE5_prof_ext.stdout
new file mode 100644
index 0000000000..323fae03f4
--- /dev/null
+++ b/testsuite/tests/th/TH_spliceE5_prof_ext.stdout
@@ -0,0 +1 @@
+foobar
diff --git a/testsuite/tests/th/TH_spliceE5_prof_ext_Lib.hs b/testsuite/tests/th/TH_spliceE5_prof_ext_Lib.hs
new file mode 100644
index 0000000000..eb598c03d7
--- /dev/null
+++ b/testsuite/tests/th/TH_spliceE5_prof_ext_Lib.hs
@@ -0,0 +1,8 @@
+module TH_spliceE5_prof_ext_Lib where
+
+import Language.Haskell.TH
+
+expandVars :: [String] -> Q Exp
+expandVars s = [| concat $(return (ListE (map f s))) |]
+ where
+ f x = VarE (mkName x)
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index af8531c8b1..45ee2df13b 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -51,6 +51,14 @@ test('TH_spliceE5_prof',
run_command,
['$MAKE -s --no-print-directory TH_spliceE5_prof'])
+test('TH_spliceE5_prof_ext',
+ [req_profiling,
+ omit_ways(['ghci']),
+ extra_clean(['TH_spliceE5_prof_ext_Lib.hi',
+ 'TH_spliceE5_prof_ext_Lib.o'])],
+ run_command,
+ ['$MAKE -s --no-print-directory TH_spliceE5_prof_ext'])
+
test('TH_spliceD1',
extra_clean(['TH_spliceD1_Lib.hi', 'TH_spliceD1_Lib.o']),
multimod_compile_fail,
@@ -370,3 +378,5 @@ test('T10819',
multimod_compile,
['T10819.hs', '-v0 ' + config.ghc_th_way_flags])
test('T10820', normal, compile_and_run, ['-v0'])
+
+test('TH_finalizer', normal, compile, ['-v0'])