summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/driver
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/driver')
-rw-r--r--testsuite/tests/driver/1372/1372.stderr2
-rw-r--r--testsuite/tests/driver/1372/Makefile37
-rw-r--r--testsuite/tests/driver/1372/all.T5
-rw-r--r--testsuite/tests/driver/1372/p1/A1.hs2
-rw-r--r--testsuite/tests/driver/1372/p1/A2.hs2
-rw-r--r--testsuite/tests/driver/1372/p1/Setup.hs6
-rw-r--r--testsuite/tests/driver/1372/p1/p1.cabal4
-rw-r--r--testsuite/tests/driver/1372/p2/Main.hs7
-rw-r--r--testsuite/tests/driver/1372/p2/Setup.hs6
-rw-r--r--testsuite/tests/driver/1372/p2/p2.cabal5
-rw-r--r--testsuite/tests/driver/1959/1959.stdout2
-rw-r--r--testsuite/tests/driver/1959/B.hs6
-rw-r--r--testsuite/tests/driver/1959/C.hs5
-rw-r--r--testsuite/tests/driver/1959/D.hs7
-rw-r--r--testsuite/tests/driver/1959/E1.hs4
-rw-r--r--testsuite/tests/driver/1959/E2.hs4
-rw-r--r--testsuite/tests/driver/1959/Makefile25
-rw-r--r--testsuite/tests/driver/1959/test.T5
-rw-r--r--testsuite/tests/driver/2464.hs12
-rw-r--r--testsuite/tests/driver/2464.stderr3
-rw-r--r--testsuite/tests/driver/2499.hs2
-rw-r--r--testsuite/tests/driver/2499.stderr4
-rw-r--r--testsuite/tests/driver/2566.stderr3
-rw-r--r--testsuite/tests/driver/3674.hs5
-rw-r--r--testsuite/tests/driver/3674_pre.hs5
-rw-r--r--testsuite/tests/driver/5313.hs18
-rw-r--r--testsuite/tests/driver/A011.hs1
-rw-r--r--testsuite/tests/driver/A012.hs1
-rw-r--r--testsuite/tests/driver/A013.hs1
-rw-r--r--testsuite/tests/driver/A014.hs1
-rw-r--r--testsuite/tests/driver/A015.hs1
-rw-r--r--testsuite/tests/driver/A031.hs1
-rw-r--r--testsuite/tests/driver/A032.hs1
-rw-r--r--testsuite/tests/driver/A033.hs1
-rw-r--r--testsuite/tests/driver/A061a.hs1
-rw-r--r--testsuite/tests/driver/A061b.hs1
-rw-r--r--testsuite/tests/driver/A063.hs1
-rw-r--r--testsuite/tests/driver/A064.hs1
-rw-r--r--testsuite/tests/driver/A065.hs1
-rw-r--r--testsuite/tests/driver/A066.hs1
-rw-r--r--testsuite/tests/driver/A067.hs1
-rw-r--r--testsuite/tests/driver/A070.hs1
-rw-r--r--testsuite/tests/driver/A071.hs1
-rw-r--r--testsuite/tests/driver/A200.hs1
-rw-r--r--testsuite/tests/driver/B021/C.hs1
-rw-r--r--testsuite/tests/driver/B022/C.hs1
-rw-r--r--testsuite/tests/driver/B023/C.hs1
-rw-r--r--testsuite/tests/driver/B024/C.hs1
-rw-r--r--testsuite/tests/driver/B025/C.hs1
-rw-r--r--testsuite/tests/driver/B027/F.hs5
-rw-r--r--testsuite/tests/driver/B028/F.hs5
-rw-r--r--testsuite/tests/driver/B041/C.hs1
-rw-r--r--testsuite/tests/driver/B042/C.hs1
-rw-r--r--testsuite/tests/driver/B043/C.hs1
-rw-r--r--testsuite/tests/driver/B044/F.hs5
-rw-r--r--testsuite/tests/driver/B045/F.hs5
-rw-r--r--testsuite/tests/driver/B200/C.hs1
-rw-r--r--testsuite/tests/driver/D063.hs2
-rw-r--r--testsuite/tests/driver/D200.hs2
-rw-r--r--testsuite/tests/driver/F016.hs5
-rw-r--r--testsuite/tests/driver/F017.hs5
-rw-r--r--testsuite/tests/driver/F018.hs5
-rw-r--r--testsuite/tests/driver/F018a.hs5
-rw-r--r--testsuite/tests/driver/F019.hs5
-rw-r--r--testsuite/tests/driver/F034.hs5
-rw-r--r--testsuite/tests/driver/F035.hs5
-rw-r--r--testsuite/tests/driver/Makefile487
-rw-r--r--testsuite/tests/driver/Shared001.hs9
-rw-r--r--testsuite/tests/driver/T3007/A/A.cabal7
-rw-r--r--testsuite/tests/driver/T3007/A/A.hs7
-rw-r--r--testsuite/tests/driver/T3007/A/Internal.hs7
-rw-r--r--testsuite/tests/driver/T3007/A/Setup.hs2
-rw-r--r--testsuite/tests/driver/T3007/B/B.cabal8
-rw-r--r--testsuite/tests/driver/T3007/B/B.hs7
-rw-r--r--testsuite/tests/driver/T3007/B/Internal.hs3
-rw-r--r--testsuite/tests/driver/T3007/B/Internal.hs-boot1
-rw-r--r--testsuite/tests/driver/T3007/B/Setup.hs2
-rw-r--r--testsuite/tests/driver/T3007/Makefile21
-rw-r--r--testsuite/tests/driver/T3007/all.T5
-rw-r--r--testsuite/tests/driver/T3364.stderr2
-rw-r--r--testsuite/tests/driver/T3389.hs12
-rw-r--r--testsuite/tests/driver/T3389.stdout1
-rw-r--r--testsuite/tests/driver/T4437.hs26
-rw-r--r--testsuite/tests/driver/T706.stdout1
-rw-r--r--testsuite/tests/driver/T706a.hs7
-rw-r--r--testsuite/tests/driver/T706b.hs3
-rw-r--r--testsuite/tests/driver/all.T333
-rw-r--r--testsuite/tests/driver/bug1677/Bar.hs2
-rw-r--r--testsuite/tests/driver/bug1677/Foo.hs1
-rw-r--r--testsuite/tests/driver/bug1677/Makefile7
-rw-r--r--testsuite/tests/driver/bug1677/all.T1
-rw-r--r--testsuite/tests/driver/bug1677/bug1677.stderr5
-rw-r--r--testsuite/tests/driver/conflicting_flags/Makefile7
-rw-r--r--testsuite/tests/driver/conflicting_flags/conflicting_flags.stdout1
-rw-r--r--testsuite/tests/driver/conflicting_flags/test.T3
-rw-r--r--testsuite/tests/driver/d026/P/Q.hs1
-rw-r--r--testsuite/tests/driver/d051_1/P/Q.hs1
-rw-r--r--testsuite/tests/driver/d051_2/R/S.hs2
-rw-r--r--testsuite/tests/driver/d052_1/P/Q.hs1
-rw-r--r--testsuite/tests/driver/d052_2/R/S.hs2
-rw-r--r--testsuite/tests/driver/d053_1/P/Q.hs1
-rw-r--r--testsuite/tests/driver/d053_2/R/S.hs2
-rw-r--r--testsuite/tests/driver/driver062a.stdout1
-rw-r--r--testsuite/tests/driver/driver062b.stdout1
-rw-r--r--testsuite/tests/driver/driver062c.stdout1
-rw-r--r--testsuite/tests/driver/driver062d.stdout1
-rw-r--r--testsuite/tests/driver/driver062e.stdout1
-rw-r--r--testsuite/tests/driver/driver063.stderr4
-rw-r--r--testsuite/tests/driver/dynHelloWorld.hs5
-rw-r--r--testsuite/tests/driver/dynHelloWorld.stdout1
-rw-r--r--testsuite/tests/driver/dynamic_flags_001/A.hs13
-rw-r--r--testsuite/tests/driver/dynamic_flags_001/B.hs13
-rw-r--r--testsuite/tests/driver/dynamic_flags_001/C.hs17
-rw-r--r--testsuite/tests/driver/dynamic_flags_001/Makefile14
-rw-r--r--testsuite/tests/driver/dynamic_flags_001/all.T6
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/A_First.hs5
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/A_Main.hs6
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/A_Second.hs6
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/B_First.hs6
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/B_Main.hs6
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/B_Second.hs5
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/C_Child.hs5
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/C_Main.hs8
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/D_Child.hs6
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/D_Main.hs7
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/Makefile4
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/ManyFirst.hs6
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/ManySecond.hs5
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/ManyThird.hs6
-rw-r--r--testsuite/tests/driver/dynamic_flags_002/all.T6
-rw-r--r--testsuite/tests/driver/mode001.stdout8
-rw-r--r--testsuite/tests/driver/objc/Makefile4
-rw-r--r--testsuite/tests/driver/objc/all.T10
-rw-r--r--testsuite/tests/driver/objc/objc-hi.m35
-rw-r--r--testsuite/tests/driver/objc/objc-hi.stdout1
-rw-r--r--testsuite/tests/driver/overlap/List.hs1
-rw-r--r--testsuite/tests/driver/overlap/Overlap.hs2
-rw-r--r--testsuite/tests/driver/pragma001.hs29
-rw-r--r--testsuite/tests/driver/pragma002.hs10
-rw-r--r--testsuite/tests/driver/recomp001/A.hs4
-rw-r--r--testsuite/tests/driver/recomp001/B1.hs3
-rw-r--r--testsuite/tests/driver/recomp001/B2.hs3
-rw-r--r--testsuite/tests/driver/recomp001/C.hs6
-rw-r--r--testsuite/tests/driver/recomp001/Makefile19
-rw-r--r--testsuite/tests/driver/recomp001/all.T6
-rw-r--r--testsuite/tests/driver/recomp001/recomp001.stderr2
-rw-r--r--testsuite/tests/driver/recomp002/Makefile16
-rw-r--r--testsuite/tests/driver/recomp002/Q.hs5
-rw-r--r--testsuite/tests/driver/recomp002/W.hs5
-rw-r--r--testsuite/tests/driver/recomp002/W.hs-boot3
-rw-r--r--testsuite/tests/driver/recomp002/all.T6
-rw-r--r--testsuite/tests/driver/recomp002/recomp002.stderr1
-rw-r--r--testsuite/tests/driver/recomp002/recomp002.stdout3
-rw-r--r--testsuite/tests/driver/recomp003/A.hs3
-rw-r--r--testsuite/tests/driver/recomp003/Makefile18
-rw-r--r--testsuite/tests/driver/recomp003/all.T6
-rw-r--r--testsuite/tests/driver/recomp004/Main.hs10
-rw-r--r--testsuite/tests/driver/recomp004/Makefile24
-rw-r--r--testsuite/tests/driver/recomp004/all.T4
-rw-r--r--testsuite/tests/driver/recomp004/c.h5
-rw-r--r--testsuite/tests/driver/recomp004/c1.c6
-rw-r--r--testsuite/tests/driver/recomp004/c2.c6
-rw-r--r--testsuite/tests/driver/recomp004/recomp004.stdout2
-rw-r--r--testsuite/tests/driver/recomp005/A.hs4
-rw-r--r--testsuite/tests/driver/recomp005/B.hs5
-rw-r--r--testsuite/tests/driver/recomp005/C1.hs5
-rw-r--r--testsuite/tests/driver/recomp005/C2.hs7
-rw-r--r--testsuite/tests/driver/recomp005/D.hs3
-rw-r--r--testsuite/tests/driver/recomp005/E.hs7
-rw-r--r--testsuite/tests/driver/recomp005/Makefile16
-rw-r--r--testsuite/tests/driver/recomp005/all.T5
-rw-r--r--testsuite/tests/driver/recomp005/recomp005.stderr0
-rw-r--r--testsuite/tests/driver/recomp005/recomp005.stdout8
-rw-r--r--testsuite/tests/driver/recomp006/A.hs9
-rw-r--r--testsuite/tests/driver/recomp006/B1.hs8
-rw-r--r--testsuite/tests/driver/recomp006/B2.hs8
-rw-r--r--testsuite/tests/driver/recomp006/Makefile16
-rw-r--r--testsuite/tests/driver/recomp006/all.T3
-rw-r--r--testsuite/tests/driver/recomp006/recomp006.stderr14
-rw-r--r--testsuite/tests/driver/recomp006/recomp006.stdout2
-rw-r--r--testsuite/tests/driver/recomp007/Makefile28
-rw-r--r--testsuite/tests/driver/recomp007/Setup.hs2
-rw-r--r--testsuite/tests/driver/recomp007/a1/A.hs3
-rw-r--r--testsuite/tests/driver/recomp007/a1/a.cabal7
-rw-r--r--testsuite/tests/driver/recomp007/a2/A.hs3
-rw-r--r--testsuite/tests/driver/recomp007/a2/a.cabal7
-rw-r--r--testsuite/tests/driver/recomp007/all.T9
-rw-r--r--testsuite/tests/driver/recomp007/b/B.hs5
-rw-r--r--testsuite/tests/driver/recomp007/b/Main.hs5
-rw-r--r--testsuite/tests/driver/recomp007/b/b.cabal10
-rw-r--r--testsuite/tests/driver/recomp007/recomp007.stderr1
-rw-r--r--testsuite/tests/driver/recomp007/recomp007.stdout4
-rw-r--r--testsuite/tests/driver/recomp008/A1.hs8
-rw-r--r--testsuite/tests/driver/recomp008/A2.hs8
-rw-r--r--testsuite/tests/driver/recomp008/B.hs4
-rw-r--r--testsuite/tests/driver/recomp008/Main.hs5
-rw-r--r--testsuite/tests/driver/recomp008/Makefile28
-rw-r--r--testsuite/tests/driver/recomp008/all.T7
-rw-r--r--testsuite/tests/driver/recomp008/recomp008.stdout2
-rw-r--r--testsuite/tests/driver/recomp009/Main.hs4
-rw-r--r--testsuite/tests/driver/recomp009/Makefile20
-rw-r--r--testsuite/tests/driver/recomp009/Sub1.hs3
-rw-r--r--testsuite/tests/driver/recomp009/Sub2.hs3
-rw-r--r--testsuite/tests/driver/recomp009/all.T7
-rw-r--r--testsuite/tests/driver/recomp009/recomp009.stdout2
-rw-r--r--testsuite/tests/driver/rtsOpts.hs3
-rw-r--r--testsuite/tests/driver/rtsopts001.stdout3
-rw-r--r--testsuite/tests/driver/rtsopts002.hs1
-rw-r--r--testsuite/tests/driver/rtsopts002.stderr2
-rw-r--r--testsuite/tests/driver/rtsopts002.stdout2
-rw-r--r--testsuite/tests/driver/shared001.stderr1
-rw-r--r--testsuite/tests/driver/werror.hs13
-rw-r--r--testsuite/tests/driver/werror.stderr28
-rw-r--r--testsuite/tests/driver/withRtsOpts.hs3
-rw-r--r--testsuite/tests/driver/withRtsOpts.stdout1
215 files changed, 2053 insertions, 0 deletions
diff --git a/testsuite/tests/driver/1372/1372.stderr b/testsuite/tests/driver/1372/1372.stderr
new file mode 100644
index 0000000000..f06f294dae
--- /dev/null
+++ b/testsuite/tests/driver/1372/1372.stderr
@@ -0,0 +1,2 @@
+
+Main.hs:5:5: Not in scope: data constructor `T'
diff --git a/testsuite/tests/driver/1372/Makefile b/testsuite/tests/driver/1372/Makefile
new file mode 100644
index 0000000000..f55a4a407d
--- /dev/null
+++ b/testsuite/tests/driver/1372/Makefile
@@ -0,0 +1,37 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+LOCAL_PKGCONF=local.package.conf
+
+clean:
+ rm -f p1/setup p1/Setup.o p1/Setup.hi
+ rm -f p2/setup p2/Setup.o p2/Setup.hi
+ rm -rf p1/dist p2/dist
+ rm -f *.o *.hi
+ rm -f clean.out prep.out
+ rm -f p1/A.hs
+ rm -f $(LOCAL_PKGCONF)
+
+1372:
+ $(MAKE) clean
+ $(MAKE) prep
+# This should recompile Main.hs, because A in package p1 has changed
+# and recompiling Main.hs will now fail.
+ -cd p2 && ./setup build -v0
+ $(MAKE) clean
+
+prep:
+ echo "[]" >$(LOCAL_PKGCONF)
+ cp p1/A1.hs p1/A.hs
+ $(MAKE) prep.p1
+ $(MAKE) prep.p2
+ cp p1/A2.hs p1/A.hs
+ cd p1 && ./setup build -v0
+
+prep.%:
+ cd $* && "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -o setup Setup.hs
+ cd $* && ./setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF)
+ cd $* && ./setup build -v0
+ cd $* && ./setup register -v0 --inplace
+
diff --git a/testsuite/tests/driver/1372/all.T b/testsuite/tests/driver/1372/all.T
new file mode 100644
index 0000000000..cabf3c01f8
--- /dev/null
+++ b/testsuite/tests/driver/1372/all.T
@@ -0,0 +1,5 @@
+test('1372',
+ clean_cmd('$MAKE -s clean'),
+ run_command,
+ ['$MAKE -s --no-print-directory 1372'])
+
diff --git a/testsuite/tests/driver/1372/p1/A1.hs b/testsuite/tests/driver/1372/p1/A1.hs
new file mode 100644
index 0000000000..6656b4bdfc
--- /dev/null
+++ b/testsuite/tests/driver/1372/p1/A1.hs
@@ -0,0 +1,2 @@
+module A where
+data T = T
diff --git a/testsuite/tests/driver/1372/p1/A2.hs b/testsuite/tests/driver/1372/p1/A2.hs
new file mode 100644
index 0000000000..aa0767c452
--- /dev/null
+++ b/testsuite/tests/driver/1372/p1/A2.hs
@@ -0,0 +1,2 @@
+module A where
+data T' = T'
diff --git a/testsuite/tests/driver/1372/p1/Setup.hs b/testsuite/tests/driver/1372/p1/Setup.hs
new file mode 100644
index 0000000000..6fa548caf7
--- /dev/null
+++ b/testsuite/tests/driver/1372/p1/Setup.hs
@@ -0,0 +1,6 @@
+module Main (main) where
+
+import Distribution.Simple
+
+main :: IO ()
+main = defaultMain
diff --git a/testsuite/tests/driver/1372/p1/p1.cabal b/testsuite/tests/driver/1372/p1/p1.cabal
new file mode 100644
index 0000000000..66d4f0ec4c
--- /dev/null
+++ b/testsuite/tests/driver/1372/p1/p1.cabal
@@ -0,0 +1,4 @@
+name: p1
+version: 1.0
+exposed-modules: A
+build-depends: base
diff --git a/testsuite/tests/driver/1372/p2/Main.hs b/testsuite/tests/driver/1372/p2/Main.hs
new file mode 100644
index 0000000000..b423120e43
--- /dev/null
+++ b/testsuite/tests/driver/1372/p2/Main.hs
@@ -0,0 +1,7 @@
+module Main where
+
+import A
+
+x = T
+
+main = print "ok"
diff --git a/testsuite/tests/driver/1372/p2/Setup.hs b/testsuite/tests/driver/1372/p2/Setup.hs
new file mode 100644
index 0000000000..6fa548caf7
--- /dev/null
+++ b/testsuite/tests/driver/1372/p2/Setup.hs
@@ -0,0 +1,6 @@
+module Main (main) where
+
+import Distribution.Simple
+
+main :: IO ()
+main = defaultMain
diff --git a/testsuite/tests/driver/1372/p2/p2.cabal b/testsuite/tests/driver/1372/p2/p2.cabal
new file mode 100644
index 0000000000..903515e80c
--- /dev/null
+++ b/testsuite/tests/driver/1372/p2/p2.cabal
@@ -0,0 +1,5 @@
+name: p2
+version: 1.0
+executable: 1372
+build-depends: base, p1
+main-is: Main.hs
diff --git a/testsuite/tests/driver/1959/1959.stdout b/testsuite/tests/driver/1959/1959.stdout
new file mode 100644
index 0000000000..3db47397ee
--- /dev/null
+++ b/testsuite/tests/driver/1959/1959.stdout
@@ -0,0 +1,2 @@
+16
+14
diff --git a/testsuite/tests/driver/1959/B.hs b/testsuite/tests/driver/1959/B.hs
new file mode 100644
index 0000000000..8523c17bb4
--- /dev/null
+++ b/testsuite/tests/driver/1959/B.hs
@@ -0,0 +1,6 @@
+module Main where
+
+import C (x)
+import GHC.Exts (inline)
+
+main = print (inline x)
diff --git a/testsuite/tests/driver/1959/C.hs b/testsuite/tests/driver/1959/C.hs
new file mode 100644
index 0000000000..9106a32495
--- /dev/null
+++ b/testsuite/tests/driver/1959/C.hs
@@ -0,0 +1,5 @@
+module C (x) where
+
+import D
+
+x = f 2
diff --git a/testsuite/tests/driver/1959/D.hs b/testsuite/tests/driver/1959/D.hs
new file mode 100644
index 0000000000..8ff5b1397d
--- /dev/null
+++ b/testsuite/tests/driver/1959/D.hs
@@ -0,0 +1,7 @@
+module D (f) where
+
+import E
+
+{-# INLINE f #-}
+f :: Int -> Int
+f x = h x
diff --git a/testsuite/tests/driver/1959/E1.hs b/testsuite/tests/driver/1959/E1.hs
new file mode 100644
index 0000000000..1efb41b3e4
--- /dev/null
+++ b/testsuite/tests/driver/1959/E1.hs
@@ -0,0 +1,4 @@
+module E (h) where
+
+h :: Int -> Int
+h x = x + x + x + x + x + x + x + x
diff --git a/testsuite/tests/driver/1959/E2.hs b/testsuite/tests/driver/1959/E2.hs
new file mode 100644
index 0000000000..cb0ca32ad0
--- /dev/null
+++ b/testsuite/tests/driver/1959/E2.hs
@@ -0,0 +1,4 @@
+module E (h) where
+
+h :: Int -> Int
+h x = x + x + x + x + x + x + x
diff --git a/testsuite/tests/driver/1959/Makefile b/testsuite/tests/driver/1959/Makefile
new file mode 100644
index 0000000000..844a442afa
--- /dev/null
+++ b/testsuite/tests/driver/1959/Makefile
@@ -0,0 +1,25 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Test recompilation bug #1959, which failed in 6.8.1 (and earlier)
+
+compile ::
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O E.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O D.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O -funfolding-use-threshold=0 C.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O B.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) E.o D.o C.o B.o -o prog
+
+clean ::
+ rm -f *.o *.hi E.hs
+
+dotest ::
+ $(MAKE) clean
+ cp E1.hs E.hs
+ $(MAKE) compile
+ ./prog
+ sleep 1
+ cp E2.hs E.hs
+ $(MAKE) compile
+ ./prog
diff --git a/testsuite/tests/driver/1959/test.T b/testsuite/tests/driver/1959/test.T
new file mode 100644
index 0000000000..ff9e8f63a4
--- /dev/null
+++ b/testsuite/tests/driver/1959/test.T
@@ -0,0 +1,5 @@
+test('1959',
+ extra_clean(['E.hi', 'E.o', 'E.hs', 'prog', 'compile.out',
+ 'B.hi', 'B.o', 'C.hi', 'C.o', 'D.hi', 'D.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory dotest'])
diff --git a/testsuite/tests/driver/2464.hs b/testsuite/tests/driver/2464.hs
new file mode 100644
index 0000000000..3547c100fb
--- /dev/null
+++ b/testsuite/tests/driver/2464.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -DTEST #-}
+{-# OPTIONS_GHC -fffi #-} -- deprecation warning
+#ifdef TEST
+{-# LANGUAGE EmptyDataDecls #-}
+#endif
+#if __GLASGOW_HASKELL__ < 610
+{-# INCLUDE "foo.h" #-} -- would generate a deprecation warning if enabled
+#endif
+
+module Test2464 where
+data T
diff --git a/testsuite/tests/driver/2464.stderr b/testsuite/tests/driver/2464.stderr
new file mode 100644
index 0000000000..31e794e33c
--- /dev/null
+++ b/testsuite/tests/driver/2464.stderr
@@ -0,0 +1,3 @@
+
+2464.hs:3:16:
+ Warning: -fffi is deprecated: use -XForeignFunctionInterface or pragma {-# LANGUAGE ForeignFunctionInterface #-} instead
diff --git a/testsuite/tests/driver/2499.hs b/testsuite/tests/driver/2499.hs
new file mode 100644
index 0000000000..b4f48879ee
--- /dev/null
+++ b/testsuite/tests/driver/2499.hs
@@ -0,0 +1,2 @@
+{-# OPTIONS -package blargh #-}
+module Test where
diff --git a/testsuite/tests/driver/2499.stderr b/testsuite/tests/driver/2499.stderr
new file mode 100644
index 0000000000..73404befe3
--- /dev/null
+++ b/testsuite/tests/driver/2499.stderr
@@ -0,0 +1,4 @@
+
+2499.hs:1:12: unknown flag in {-# OPTIONS_GHC #-} pragma: -package
+
+2499.hs:1:12: unknown flag in {-# OPTIONS_GHC #-} pragma: blargh
diff --git a/testsuite/tests/driver/2566.stderr b/testsuite/tests/driver/2566.stderr
new file mode 100644
index 0000000000..526c76a86a
--- /dev/null
+++ b/testsuite/tests/driver/2566.stderr
@@ -0,0 +1,3 @@
+Warning: the following files would be used as linker inputs, but linking is not being done: foo2566.bar
+ghc: no input files
+Usage: For basic information, try the `--help' option.
diff --git a/testsuite/tests/driver/3674.hs b/testsuite/tests/driver/3674.hs
new file mode 100644
index 0000000000..2253ca12ce
--- /dev/null
+++ b/testsuite/tests/driver/3674.hs
@@ -0,0 +1,5 @@
+{-# OPTIONS -F -pgmF ./3674_pre #-}
+
+module Test3674 where
+
+data Foo a where MkFoo :: Foo a
diff --git a/testsuite/tests/driver/3674_pre.hs b/testsuite/tests/driver/3674_pre.hs
new file mode 100644
index 0000000000..aef9cef9c7
--- /dev/null
+++ b/testsuite/tests/driver/3674_pre.hs
@@ -0,0 +1,5 @@
+import System.Environment
+main = do
+ [_,inf,outf] <- getArgs
+ s <- readFile inf
+ writeFile outf ("{-# LANGUAGE GADTs #-}\n" ++ s)
diff --git a/testsuite/tests/driver/5313.hs b/testsuite/tests/driver/5313.hs
new file mode 100644
index 0000000000..14b809bf7d
--- /dev/null
+++ b/testsuite/tests/driver/5313.hs
@@ -0,0 +1,18 @@
+import qualified GHC
+import System.Environment
+
+main = do
+ (libdir:_) <- getArgs
+ GHC.runGhcT (Just libdir) $ do
+ -- begin initialize
+ df0 <- GHC.getSessionDynFlags
+ let df1 = df0{GHC.ghcMode = GHC.CompManager,
+ GHC.hscTarget = GHC.HscInterpreted,
+ GHC.ghcLink = GHC.LinkInMemory,
+ GHC.verbosity = 0}
+ _ <- GHC.setSessionDynFlags df1
+ -- begin reset
+ GHC.setContext [] []
+ GHC.setTargets []
+ _ <- GHC.load GHC.LoadAllTargets
+ return ()
diff --git a/testsuite/tests/driver/A011.hs b/testsuite/tests/driver/A011.hs
new file mode 100644
index 0000000000..96b88f80cc
--- /dev/null
+++ b/testsuite/tests/driver/A011.hs
@@ -0,0 +1 @@
+module A011 where
diff --git a/testsuite/tests/driver/A012.hs b/testsuite/tests/driver/A012.hs
new file mode 100644
index 0000000000..0dd79b8e05
--- /dev/null
+++ b/testsuite/tests/driver/A012.hs
@@ -0,0 +1 @@
+module A012 where
diff --git a/testsuite/tests/driver/A013.hs b/testsuite/tests/driver/A013.hs
new file mode 100644
index 0000000000..77275572d8
--- /dev/null
+++ b/testsuite/tests/driver/A013.hs
@@ -0,0 +1 @@
+module A013 where
diff --git a/testsuite/tests/driver/A014.hs b/testsuite/tests/driver/A014.hs
new file mode 100644
index 0000000000..3f850104b2
--- /dev/null
+++ b/testsuite/tests/driver/A014.hs
@@ -0,0 +1 @@
+module A014 where
diff --git a/testsuite/tests/driver/A015.hs b/testsuite/tests/driver/A015.hs
new file mode 100644
index 0000000000..1f354be31d
--- /dev/null
+++ b/testsuite/tests/driver/A015.hs
@@ -0,0 +1 @@
+module A015 where
diff --git a/testsuite/tests/driver/A031.hs b/testsuite/tests/driver/A031.hs
new file mode 100644
index 0000000000..12936c4306
--- /dev/null
+++ b/testsuite/tests/driver/A031.hs
@@ -0,0 +1 @@
+module A031 where
diff --git a/testsuite/tests/driver/A032.hs b/testsuite/tests/driver/A032.hs
new file mode 100644
index 0000000000..0701b781d8
--- /dev/null
+++ b/testsuite/tests/driver/A032.hs
@@ -0,0 +1 @@
+module A032 where
diff --git a/testsuite/tests/driver/A033.hs b/testsuite/tests/driver/A033.hs
new file mode 100644
index 0000000000..d7be73eb49
--- /dev/null
+++ b/testsuite/tests/driver/A033.hs
@@ -0,0 +1 @@
+module A033 where
diff --git a/testsuite/tests/driver/A061a.hs b/testsuite/tests/driver/A061a.hs
new file mode 100644
index 0000000000..85230a1e3d
--- /dev/null
+++ b/testsuite/tests/driver/A061a.hs
@@ -0,0 +1 @@
+module A061a where
diff --git a/testsuite/tests/driver/A061b.hs b/testsuite/tests/driver/A061b.hs
new file mode 100644
index 0000000000..8244ddbb27
--- /dev/null
+++ b/testsuite/tests/driver/A061b.hs
@@ -0,0 +1 @@
+module A061b where
diff --git a/testsuite/tests/driver/A063.hs b/testsuite/tests/driver/A063.hs
new file mode 100644
index 0000000000..fac8c10a34
--- /dev/null
+++ b/testsuite/tests/driver/A063.hs
@@ -0,0 +1 @@
+module A063 where
diff --git a/testsuite/tests/driver/A064.hs b/testsuite/tests/driver/A064.hs
new file mode 100644
index 0000000000..8ee13be248
--- /dev/null
+++ b/testsuite/tests/driver/A064.hs
@@ -0,0 +1 @@
+module A064 where
diff --git a/testsuite/tests/driver/A065.hs b/testsuite/tests/driver/A065.hs
new file mode 100644
index 0000000000..7de1a30132
--- /dev/null
+++ b/testsuite/tests/driver/A065.hs
@@ -0,0 +1 @@
+module A065 where
diff --git a/testsuite/tests/driver/A066.hs b/testsuite/tests/driver/A066.hs
new file mode 100644
index 0000000000..be9b016c38
--- /dev/null
+++ b/testsuite/tests/driver/A066.hs
@@ -0,0 +1 @@
+module A066 where
diff --git a/testsuite/tests/driver/A067.hs b/testsuite/tests/driver/A067.hs
new file mode 100644
index 0000000000..8b57b4dc5d
--- /dev/null
+++ b/testsuite/tests/driver/A067.hs
@@ -0,0 +1 @@
+module A067 where
diff --git a/testsuite/tests/driver/A070.hs b/testsuite/tests/driver/A070.hs
new file mode 100644
index 0000000000..12fa79d0e0
--- /dev/null
+++ b/testsuite/tests/driver/A070.hs
@@ -0,0 +1 @@
+module A070 where
diff --git a/testsuite/tests/driver/A071.hs b/testsuite/tests/driver/A071.hs
new file mode 100644
index 0000000000..3d2a64cfc6
--- /dev/null
+++ b/testsuite/tests/driver/A071.hs
@@ -0,0 +1 @@
+module A071 where
diff --git a/testsuite/tests/driver/A200.hs b/testsuite/tests/driver/A200.hs
new file mode 100644
index 0000000000..0bc3b2f236
--- /dev/null
+++ b/testsuite/tests/driver/A200.hs
@@ -0,0 +1 @@
+module A200 where
diff --git a/testsuite/tests/driver/B021/C.hs b/testsuite/tests/driver/B021/C.hs
new file mode 100644
index 0000000000..01ecd10813
--- /dev/null
+++ b/testsuite/tests/driver/B021/C.hs
@@ -0,0 +1 @@
+module B021.C where
diff --git a/testsuite/tests/driver/B022/C.hs b/testsuite/tests/driver/B022/C.hs
new file mode 100644
index 0000000000..230a6105f1
--- /dev/null
+++ b/testsuite/tests/driver/B022/C.hs
@@ -0,0 +1 @@
+module B022.C where
diff --git a/testsuite/tests/driver/B023/C.hs b/testsuite/tests/driver/B023/C.hs
new file mode 100644
index 0000000000..e70870831b
--- /dev/null
+++ b/testsuite/tests/driver/B023/C.hs
@@ -0,0 +1 @@
+module B023.C where
diff --git a/testsuite/tests/driver/B024/C.hs b/testsuite/tests/driver/B024/C.hs
new file mode 100644
index 0000000000..397b5a5a80
--- /dev/null
+++ b/testsuite/tests/driver/B024/C.hs
@@ -0,0 +1 @@
+module B024.C where
diff --git a/testsuite/tests/driver/B025/C.hs b/testsuite/tests/driver/B025/C.hs
new file mode 100644
index 0000000000..159cadd483
--- /dev/null
+++ b/testsuite/tests/driver/B025/C.hs
@@ -0,0 +1 @@
+module B025.C where
diff --git a/testsuite/tests/driver/B027/F.hs b/testsuite/tests/driver/B027/F.hs
new file mode 100644
index 0000000000..9e67706069
--- /dev/null
+++ b/testsuite/tests/driver/B027/F.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module B027.F where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/B028/F.hs b/testsuite/tests/driver/B028/F.hs
new file mode 100644
index 0000000000..8630af1124
--- /dev/null
+++ b/testsuite/tests/driver/B028/F.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module B028.F where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/B041/C.hs b/testsuite/tests/driver/B041/C.hs
new file mode 100644
index 0000000000..9d076f6aeb
--- /dev/null
+++ b/testsuite/tests/driver/B041/C.hs
@@ -0,0 +1 @@
+module B041.C where
diff --git a/testsuite/tests/driver/B042/C.hs b/testsuite/tests/driver/B042/C.hs
new file mode 100644
index 0000000000..a91ce19f3e
--- /dev/null
+++ b/testsuite/tests/driver/B042/C.hs
@@ -0,0 +1 @@
+module B042.C where
diff --git a/testsuite/tests/driver/B043/C.hs b/testsuite/tests/driver/B043/C.hs
new file mode 100644
index 0000000000..320acedcd8
--- /dev/null
+++ b/testsuite/tests/driver/B043/C.hs
@@ -0,0 +1 @@
+module B043.C where
diff --git a/testsuite/tests/driver/B044/F.hs b/testsuite/tests/driver/B044/F.hs
new file mode 100644
index 0000000000..d6ad4802c3
--- /dev/null
+++ b/testsuite/tests/driver/B044/F.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module B044.F where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/B045/F.hs b/testsuite/tests/driver/B045/F.hs
new file mode 100644
index 0000000000..c89635b3a4
--- /dev/null
+++ b/testsuite/tests/driver/B045/F.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module B045.F where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/B200/C.hs b/testsuite/tests/driver/B200/C.hs
new file mode 100644
index 0000000000..1927565999
--- /dev/null
+++ b/testsuite/tests/driver/B200/C.hs
@@ -0,0 +1 @@
+module B200.C where
diff --git a/testsuite/tests/driver/D063.hs b/testsuite/tests/driver/D063.hs
new file mode 100644
index 0000000000..f62cd95ccd
--- /dev/null
+++ b/testsuite/tests/driver/D063.hs
@@ -0,0 +1,2 @@
+module D063 where
+import A063
diff --git a/testsuite/tests/driver/D200.hs b/testsuite/tests/driver/D200.hs
new file mode 100644
index 0000000000..4f23bedafe
--- /dev/null
+++ b/testsuite/tests/driver/D200.hs
@@ -0,0 +1,2 @@
+module D200 where
+import A200
diff --git a/testsuite/tests/driver/F016.hs b/testsuite/tests/driver/F016.hs
new file mode 100644
index 0000000000..8cdad020ff
--- /dev/null
+++ b/testsuite/tests/driver/F016.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module TestStub016 where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/F017.hs b/testsuite/tests/driver/F017.hs
new file mode 100644
index 0000000000..de6f93da9d
--- /dev/null
+++ b/testsuite/tests/driver/F017.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module TestStub017 where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/F018.hs b/testsuite/tests/driver/F018.hs
new file mode 100644
index 0000000000..613459aaa3
--- /dev/null
+++ b/testsuite/tests/driver/F018.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module TestStub018 where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/F018a.hs b/testsuite/tests/driver/F018a.hs
new file mode 100644
index 0000000000..613459aaa3
--- /dev/null
+++ b/testsuite/tests/driver/F018a.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module TestStub018 where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/F019.hs b/testsuite/tests/driver/F019.hs
new file mode 100644
index 0000000000..724ee74a7c
--- /dev/null
+++ b/testsuite/tests/driver/F019.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module TestStub019 where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/F034.hs b/testsuite/tests/driver/F034.hs
new file mode 100644
index 0000000000..e48d9a8faf
--- /dev/null
+++ b/testsuite/tests/driver/F034.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module TestStub034 where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/F035.hs b/testsuite/tests/driver/F035.hs
new file mode 100644
index 0000000000..445c742070
--- /dev/null
+++ b/testsuite/tests/driver/F035.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module TestStub035 where
+foreign export ccall f :: Int -> Int
+f :: Int -> Int
+f n = n + 1
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
new file mode 100644
index 0000000000..e407fd80de
--- /dev/null
+++ b/testsuite/tests/driver/Makefile
@@ -0,0 +1,487 @@
+TOP=../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# A set of driver tests
+
+# Things to test:
+#
+# - one-shot vs. --make
+# - hierarchical vs. flat
+# - -odir vs. no -odir
+# - -hidir vs. no -hidir
+# - root module vs. found modules
+
+OBJSUFFIX = .o
+
+# -----------------------------------------------------------------------------
+# One-shot compilations, non-hierarchical modules
+
+test011:
+ $(RM) A011.hi
+ $(RM) A011$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) $(TEST_HC_OPTS) -c A011.hs
+ test -f A011.hi
+ test -f A011$(OBJSUFFIX)
+
+# test -o
+test012:
+ $(RM) A012.hi
+ $(RM) A012$(OBJSUFFIX)oo
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c A012.hs -o A012$(OBJSUFFIX)oo
+ test -f A012$(OBJSUFFIX)oo
+
+# test -ohi
+test013:
+ $(RM) A013.xhi
+ $(RM) A013$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c A013.hs -ohi A013.xhi
+ test -f A013.xhi
+
+# test -odir
+test014:
+ $(RM) -f A014.hi
+ $(RM) -rf obj014
+ mkdir obj014
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c A014.hs -odir obj014
+ test -f obj014/A014$(OBJSUFFIX)
+ test -f A014.hi
+
+# test -hidir
+test015:
+ $(RM) -f A015$(OBJSUFFIX)
+ $(RM) -rf hi015
+ mkdir hi015
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c A015.hs -hidir hi015
+ test -f A015$(OBJSUFFIX)
+ test -f hi015/A015.hi
+
+# test stub generation
+test016:
+ $(RM) F016.hi F016$(OBJSUFFIX) F016_stub.h
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c F016.hs
+ test -f F016_stub.h
+
+# test -stubdir (filename differs from module name)
+test017:
+ $(RM) F017.hi F017$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c F017.hs -stubdir stub017
+ test -f stub017/TestStub017_stub.h
+
+# test -odir with stubs (filename differs from module name)
+test018:
+ $(RM) -f F018.hi F018$(OBJSUFFIX) F018_stub.h
+ $(RM) -rf obj018
+ mkdir obj018
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c F018.hs -odir obj018
+
+# test for bug #3093
+test018a:
+ $(RM) -f F018a.hi F018a_stub.h *.obj.018
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c F018a.hs -osuf obj.018
+ test -f F018a.obj.018
+
+# test -outputdir
+test019:
+ $(RM) -rf out019
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c F019.hs -outputdir out019
+ test -f out019/TestStub019.hi
+ test -f out019/TestStub019_stub.h
+
+# -----------------------------------------------------------------------------
+# One-shot compilation, hierarchical modules
+
+test021:
+ $(RM) B021/C.hi
+ $(RM) B021/C$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B021/C.hs
+ test -f B021/C.hi
+ test -f B021/C$(OBJSUFFIX)
+
+# test -o
+test022:
+ $(RM) B022/C.hi
+ $(RM) B022/C$(OBJSUFFIX)oo
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B022/C.hs -o B022/C$(OBJSUFFIX)oo
+ test -f B022/C$(OBJSUFFIX)oo
+
+# test -ohi
+test023:
+ $(RM) B023/C.xhi
+ $(RM) B023/C$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B023/C.hs -ohi B023/C.xhi
+ test -f B023/C.xhi
+
+# test -odir
+test024:
+ $(RM) -f B024/C.hi
+ $(RM) -rf obj024
+ mkdir obj024
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B024/C.hs -odir obj024
+ test -f obj024/B024/C$(OBJSUFFIX)
+
+# test -odir with non-Haskell compilation
+test024a:
+ $(RM) -rf B024a
+ $(RM) -rf obj024a
+ mkdir B024a
+ mkdir obj024a
+ echo >B024a/stub.c
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B024a/stub.c -odir obj024a
+ test -f obj024a/B024a/stub$(OBJSUFFIX)
+
+# test -hidir
+test025:
+ $(RM) -rf hi025
+ mkdir hi025
+ $(RM) B025/C$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B025/C.hs -hidir hi025
+ test -f hi025/B025/C.hi
+
+# This is a hierarchical module that lives in a subdirectory.
+test026:
+ $(RM) d026/P/Q.hi
+ $(RM) d026/P/Q$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c d026/P/Q.hs
+ test -f d026/P/Q.hi
+ test -f d026/P/Q$(OBJSUFFIX)
+
+# test stub generation
+# -fvia-C, because we want to check that the .hc file can #include the stub.h
+test027:
+ $(RM) B027/F.hi B027/F$(OBJSUFFIX) B027/F_stub.h
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B027/F.hs -fno-warn-deprecated-flags -fvia-C
+ test -f B027/F_stub.h
+
+# test -stubdir
+# -fvia-C, because we want to check that the .hc file can #include the stub.h
+test028:
+ $(RM) B028/F.hi B028/F$(OBJSUFFIX)
+ $(RM) stub028/B028/F_stub.h
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B028/F.hs -stubdir stub028 -fno-warn-deprecated-flags -fvia-C
+ test -f stub028/B028/F_stub.h
+
+# -----------------------------------------------------------------------------
+# Compilation-manager compilations, flat modules
+
+test031:
+ $(RM) A031.hi
+ $(RM) A031$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make A031.hs
+ test -f A031.hi
+ test -f A031$(OBJSUFFIX)
+
+# test -odir
+test032:
+ $(RM) A032.hi
+ $(RM) -rf obj032
+ mkdir obj032
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make A032.hs -odir obj032
+ test -f obj032/A032$(OBJSUFFIX)
+
+# test -hidir
+test033:
+ $(RM) -rf hi033
+ $(RM) A033$(OBJSUFFIX)
+ mkdir hi033
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make A033.hs -hidir hi033
+ test -f hi033/A033.hi
+
+# test stub generation
+test034:
+ $(RM) F034.hi F034$(OBJSUFFIX) F034_stub.h
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make F034.hs
+ test -f F034_stub.h
+
+# test -stubdir (filename differs from module name)
+test035:
+ $(RM) F035.hi F$(OBJSUFFIX) stub035/Stubs_stub.h
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make F035.hs -stubdir stub035
+ test -f stub035/TestStub035_stub.h
+
+# -----------------------------------------------------------------------------
+# Compilation-manager compilations, hierarchical modules
+
+test041:
+ $(RM) B041/C.hi
+ $(RM) B041/C$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make B041/C.hs
+ test -f B041/C.hi
+ test -f B041/C$(OBJSUFFIX)
+
+# test -odir
+test042:
+ $(RM) -rf obj042
+ mkdir obj042
+ $(RM) B042/C.hi
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make B042/C.hs -odir obj042
+ test -f obj042/B042/C$(OBJSUFFIX)
+
+# test -hidir
+test043:
+ $(RM) -f B043/C$(OBJSUFFIX)
+ $(RM) -rf hi043
+ mkdir hi043
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make B043/C.hs -hidir hi043
+ test -f hi043/B043/C.hi
+
+# test stub generation
+test044:
+ $(RM) B044/F.hi B044/F$(OBJSUFFIX) B044/F_stub.h
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make B044/F.hs
+ test -f B044/F_stub.h
+
+# test -stubdir
+test045:
+ $(RM) B045/F.hi B045/F$(OBJSUFFIX)
+ $(RM) stub045/B045/F_stub.h
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make B045/F.hs -stubdir stub045
+ test -f stub045/B045/F_stub.h
+
+# -----------------------------------------------------------------------------
+# Compilation-manager compilations, hierarchical modules, non-root modules
+
+test051:
+ $(RM) d051_2/R/S.hi
+ $(RM) d051_2/R/S$(OBJSUFFIX)
+ $(RM) d051_1/P/Q.hi
+ $(RM) d051_1/P/Q$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -id051_1 -id051_2 R.S
+ test -f d051_2/R/S.hi
+ test -f d051_2/R/S$(OBJSUFFIX)
+ test -f d051_1/P/Q.hi
+ test -f d051_1/P/Q$(OBJSUFFIX)
+
+# test -odir
+test052:
+ $(RM) d052_2/R/S.hi
+ $(RM) d052_1/P/Q.hi
+ $(RM) -rf obj052
+ mkdir obj052
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -id052_1 -id052_2 -odir obj052 R.S
+ test -f d052_2/R/S.hi
+ test -f obj052/R/S$(OBJSUFFIX)
+ test -f d052_1/P/Q.hi
+ test -f obj052/P/Q$(OBJSUFFIX)
+
+# test -hidir
+test053:
+ $(RM) hi053/R/S.hi
+ $(RM) d053_2/R/S$(OBJSUFFIX)
+ $(RM) hi053/P/Q.hi
+ $(RM) d053_1/P/Q$(OBJSUFFIX)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -id053_1 -id053_2 -hidir hi053 R.S
+ test -f hi053/R/S.hi
+ test -f d053_2/R/S$(OBJSUFFIX)
+ test -f hi053/P/Q.hi
+ test -f d053_1/P/Q$(OBJSUFFIX)
+
+# -----------------------------------------------------------------------------
+# Other tests
+
+# Test that -keep-s-files works with --make and -fvia-C
+test061a:
+ $(RM) A061a.hi A061a$(OBJSUFFIX) A061a.s
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -keep-s-files -fno-warn-deprecated-flags -fvia-C A061a.hs
+ test -f A061a.s
+
+# Test that -keep-s-files works without --make
+test061b:
+ $(RM) A061b.hi A061b$(OBJSUFFIX) A061b.s
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c -keep-s-files -fno-warn-deprecated-flags -fvia-C A061b.hs
+ test -f A061b.s
+
+# Test that -main-is works with --make
+test062a:
+ $(RM) Hello062a.hs Hello062a.hi Hello062a$(OBJSUFFIX) Hello062a.hc hello062a
+ echo "module Hello062a where { hello062a = putStrLn \"ok\" }" >Hello062a.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -main-is Hello062a.hello062a Hello062a -o hello062a
+ ./hello062a
+test062b:
+ $(RM) Hello062b.hs Hello062b.hi Hello062b$(OBJSUFFIX) Hello062b.hc hello062b
+ echo "module Hello062b where { main = putStrLn \"ok\" }" >Hello062b.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -main-is Hello062b Hello062b -o hello062b
+ ./hello062b
+test062c:
+ $(RM) Hello062c.hs Hello062c.hi Hello062c$(OBJSUFFIX) Hello062c.hc hello062c
+ echo "module Main (hello062c) where { hello062c = putStrLn \"ok\" }" >Hello062c.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -main-is hello062c Hello062c.hs -o hello062c
+ ./hello062c
+test062d:
+ $(RM) -rf B062d
+ $(RM) hello062d
+ mkdir B062d
+ echo "module B062d.Hello062d (hello062d) where { hello062d = putStrLn \"ok\" }" >B062d/Hello062d.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -main-is B062d.Hello062d.hello062d B062d/Hello062d.hs -o hello062d
+ ./hello062d
+test062e:
+ $(RM) -rf B062e
+ $(RM) Hello062e.hc hello062e
+ mkdir B062e
+ echo "module B062e.Hello062e (main) where { main = putStrLn \"ok\" }" >B062e/Hello062e.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -main-is B062e.Hello062e B062e/Hello062e.hs -o hello062e
+ ./hello062e
+
+# Test that -i deletes the list of search paths.
+# The compilation will fail, but we ignore the failure and just
+# compare the output, because make might give us a different exit code.
+test063:
+ $(RM) A063.hi A063$(OBJSUFFIX) A063.hc D063.hi D063$(OBJSUFFIX) D063.hc
+ -"$(TEST_HC)" $(TEST_HC_OPTS) --make -i -v0 D063.hs
+
+# Test -E
+test064:
+ $(RM) A064.hi A064.hspp
+ "$(TEST_HC)" $(TEST_HC_OPTS) -E A064.hs
+ test -f A064.hspp
+
+# Test -E/-cpp
+test065:
+ $(RM) A065.hi A065.hspp
+ "$(TEST_HC)" $(TEST_HC_OPTS) -E -cpp A065.hs
+ test -f A065.hspp
+
+# Test -E/-o
+test066:
+ $(RM) A066.hi A066.tmp
+ "$(TEST_HC)" $(TEST_HC_OPTS) -E A066.hs -o A066.tmp
+ test -f A066.tmp
+
+# Test -E/-cpp/-o
+test067:
+ $(RM) A067.hi A067.tmp
+ "$(TEST_HC)" $(TEST_HC_OPTS) -cpp -E A067.hs -o A067.tmp
+ test -f A067.tmp
+
+# Test -S
+test070:
+ $(RM) A070.hi A070.s
+ "$(TEST_HC)" $(TEST_HC_OPTS) -S A070.hs
+ test -f A070.s
+
+# Test -S/-o
+test071:
+ $(RM) A071.hi A071.tmp
+ "$(TEST_HC)" $(TEST_HC_OPTS) -S A071.hs -o A071.tmp
+ test -f A071.tmp
+
+
+# Tests for #2248, -o and .exe
+
+define test081
+$(RM) $(1).hs $(1).hi $(1)$(OBJSUFFIX) $(1).hc $(1)$(exeext)
+echo "module Main where { main = putStrLn \"ok\" }" >$(1).hs
+"$(TEST_HC)" $(TEST_HC_OPTS) --make -v0 $(1).hs
+test -f $(1)$(exeext)
+endef
+
+test081a:
+ $(call test081, Test_081a)
+test081b:
+ $(call test081, Test.081b)
+
+# -----------------------------------------------------------------------------
+# --make tests
+
+# Test for overlap between home module and package module
+test100:
+ $(RM) overlap/List.hi overlap/List.o
+ $(RM) overlap/Overlap.hi overlap/Overlap.o
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -ioverlap Overlap
+
+# -----------------------------------------------------------------------------
+# dependency-generation tests
+
+DEPFILE200 = depend200
+
+# Test that we can create a dependency file, and that we can
+# modify an existing dependency file.
+test200:
+ $(RM) $(DEPFILE200)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-makefile $(DEPFILE200) D200
+ test -f $(DEPFILE200)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-makefile $(DEPFILE200) D200 B200.C A200
+ test -f $(DEPFILE200)
+ "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-makefile $(DEPFILE200) D200.hs B200/C.hs A200.hs
+ test -f $(DEPFILE200)
+
+# -----------------------------------------------------------------------------
+
+2566::
+ if "$(TEST_HC)" $(TEST_HC_OPTS) -c foo2566.bar; then false else true; fi
+
+.PHONY: mode001
+# We use
+# sed '2,$$d'
+# rather than
+# head -1
+# as the latter gives
+# ghc: <stdout>: hFlush: resource vanished (Broken pipe)
+# on OS X
+mode001:
+ "$(TEST_HC)" $(TEST_HC_OPTS) --make --help | sed '2,$$d'
+ "$(TEST_HC)" $(TEST_HC_OPTS) --help --make | sed '2,$$d'
+ "$(TEST_HC)" $(TEST_HC_OPTS) --interactive --help | sed '2,$$d'
+ "$(TEST_HC)" $(TEST_HC_OPTS) --help --interactive | sed '2,$$d'
+ "$(TEST_HC)" $(TEST_HC_OPTS) --version --help | sed "s/, version.*//"
+ "$(TEST_HC)" $(TEST_HC_OPTS) --help --version | sed '2,$$d'
+ "$(TEST_HC)" $(TEST_HC_OPTS) --interactive --version | sed "s/, version.*//"
+ "$(TEST_HC)" $(TEST_HC_OPTS) --version --interactive | sed "s/, version.*//"
+
+# Test for building DLLs with ghc -shared, see #2745
+shared001:
+ $(RM) Shared001.hi Shared001.o HSdll.dll.a HSdll.dll Shared001_stub.*
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -shared Shared001.hs
+
+# -----------------------------------------------------------------------------
+
+3674:
+ $(RM) 3674*.o 3674*.hi 3674_pre
+ "$(TEST_HC)" $(TEST_HC_OPTS) --make 3674_pre.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) --make 3674.hs
+
+.PHONY: rtsopts001
+rtsopts001:
+ $(RM) rtsOpts$(exeext) rtsOpts.hi rtsOpts.o
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make rtsOpts -rtsopts
+ echo "Normal"
+ -./rtsOpts +RTS -C0 2>&1
+ $(RM) rtsOpts$(exeext) rtsOpts.hi rtsOpts.o
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make rtsOpts
+ echo "No RTS opts"
+ -./rtsOpts +RTS -C0 2>&1
+
+.PHONY: rtsopts002
+rtsopts002:
+ $(RM) rtsopts002$(exeext) rtsopts002.hi rtsopts002.o
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make rtsopts002 -rtsopts=some
+ ./rtsopts002
+ ./rtsopts002 +RTS --info >/dev/null
+ if ./rtsopts002 +RTS -C0; then exit 1; else exit 0; fi
+ GHCRTS= ./rtsopts002
+ GHCRTS=--info ./rtsopts002 >/dev/null
+ if GHCRTS=-C0 ./rtsopts002; then exit 1; else exit 0; fi
+
+.PHONY: withRtsOpts
+withRtsOpts:
+ $(RM) withRtsOpts$(exeext) withRtsOpts.hi withRtsOpts.o withRtsOpts.out
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make withRtsOpts -with-rtsopts=--info
+ ./withRtsOpts | head -1
+ # Also test for non-safe RTS opts, these should be allowed too,
+ # since the author has explicitly requested them. (#5114)
+ $(RM) withRtsOpts$(exeext) withRtsOpts.hi withRtsOpts.o withRtsOpts.out
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make withRtsOpts -with-rtsopts=-twithRtsOpts.out
+ ./withRtsOpts | head -1
+ test -f withRtsOpts.out
+
+.PHONY: T3364
+T3364:
+ -"$(TEST_HC)" $(TEST_HC_OPTS) -H
+
+.PHONY: T706
+T706:
+ cp T706a.hs T706.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c T706.hs
+ cp T706b.hs T706.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c T706.hs
+ echo "test" | "$(TEST_HC)" $(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0 T706
diff --git a/testsuite/tests/driver/Shared001.hs b/testsuite/tests/driver/Shared001.hs
new file mode 100644
index 0000000000..4f6a3d9c3d
--- /dev/null
+++ b/testsuite/tests/driver/Shared001.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module Shared001 where
+
+-- Test for building DLLs with ghc -shared, see #2745
+
+f :: Int -> Int
+f x = x+1
+
+foreign export ccall f :: Int -> Int
diff --git a/testsuite/tests/driver/T3007/A/A.cabal b/testsuite/tests/driver/T3007/A/A.cabal
new file mode 100644
index 0000000000..86b3bb013e
--- /dev/null
+++ b/testsuite/tests/driver/T3007/A/A.cabal
@@ -0,0 +1,7 @@
+Name: A
+Version: 0
+
+Library
+ Exposed-Modules: A
+ Other-Modules: Internal
+ Extensions: NoImplicitPrelude
diff --git a/testsuite/tests/driver/T3007/A/A.hs b/testsuite/tests/driver/T3007/A/A.hs
new file mode 100644
index 0000000000..83e99f555f
--- /dev/null
+++ b/testsuite/tests/driver/T3007/A/A.hs
@@ -0,0 +1,7 @@
+module A (
+
+ A (A)
+
+) where
+
+ import Internal
diff --git a/testsuite/tests/driver/T3007/A/Internal.hs b/testsuite/tests/driver/T3007/A/Internal.hs
new file mode 100644
index 0000000000..761480dece
--- /dev/null
+++ b/testsuite/tests/driver/T3007/A/Internal.hs
@@ -0,0 +1,7 @@
+module Internal (
+
+ A (A)
+
+) where
+
+ data A = A
diff --git a/testsuite/tests/driver/T3007/A/Setup.hs b/testsuite/tests/driver/T3007/A/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/T3007/A/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/T3007/B/B.cabal b/testsuite/tests/driver/T3007/B/B.cabal
new file mode 100644
index 0000000000..dbccfffbe9
--- /dev/null
+++ b/testsuite/tests/driver/T3007/B/B.cabal
@@ -0,0 +1,8 @@
+Name: B
+Version: 0
+
+Library
+ Build-Depends: A == 0
+ Exposed-Modules: B
+ Other-Modules: Internal
+ Extensions: NoImplicitPrelude
diff --git a/testsuite/tests/driver/T3007/B/B.hs b/testsuite/tests/driver/T3007/B/B.hs
new file mode 100644
index 0000000000..9bd13bbaec
--- /dev/null
+++ b/testsuite/tests/driver/T3007/B/B.hs
@@ -0,0 +1,7 @@
+module B where
+
+ import A
+ import {-# SOURCE #-} Internal
+
+ a :: A
+ a = A
diff --git a/testsuite/tests/driver/T3007/B/Internal.hs b/testsuite/tests/driver/T3007/B/Internal.hs
new file mode 100644
index 0000000000..ccb9cd4b23
--- /dev/null
+++ b/testsuite/tests/driver/T3007/B/Internal.hs
@@ -0,0 +1,3 @@
+module Internal where
+
+ import B
diff --git a/testsuite/tests/driver/T3007/B/Internal.hs-boot b/testsuite/tests/driver/T3007/B/Internal.hs-boot
new file mode 100644
index 0000000000..d066bb085e
--- /dev/null
+++ b/testsuite/tests/driver/T3007/B/Internal.hs-boot
@@ -0,0 +1 @@
+module Internal where
diff --git a/testsuite/tests/driver/T3007/B/Setup.hs b/testsuite/tests/driver/T3007/B/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/T3007/B/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/T3007/Makefile b/testsuite/tests/driver/T3007/Makefile
new file mode 100644
index 0000000000..8c81bff205
--- /dev/null
+++ b/testsuite/tests/driver/T3007/Makefile
@@ -0,0 +1,21 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+clean:
+ rm -f A/Setup A/Setup.o A/Setup.hi
+ rm -f B/Setup B/Setup.o B/Setup.hi
+ rm -rf A/dist B/dist
+ rm -f package.conf
+
+T3007:
+ $(MAKE) clean
+ echo '[]' > package.conf
+ cd A && '$(TEST_HC)' -v0 --make Setup
+ cd A && ./Setup configure -v0 --with-compiler='$(TEST_HC)' --ghc-pkg-option=--global-conf=../package.conf --ghc-option=-package-conf../package.conf
+ cd A && ./Setup build -v0
+ cd A && ./Setup register --inplace -v0
+ cd B && '$(TEST_HC)' -v0 --make Setup
+ cd B && ./Setup configure -v0 --with-compiler='$(TEST_HC)' --ghc-pkg-option=--global-conf=../package.conf --ghc-option=-package-conf../package.conf
+ cd B && ./Setup build -v0
+
diff --git a/testsuite/tests/driver/T3007/all.T b/testsuite/tests/driver/T3007/all.T
new file mode 100644
index 0000000000..194097335d
--- /dev/null
+++ b/testsuite/tests/driver/T3007/all.T
@@ -0,0 +1,5 @@
+test('T3007',
+ clean_cmd('$MAKE -s clean'),
+ run_command,
+ ['$MAKE -s --no-print-directory T3007'])
+
diff --git a/testsuite/tests/driver/T3364.stderr b/testsuite/tests/driver/T3364.stderr
new file mode 100644
index 0000000000..852893facc
--- /dev/null
+++ b/testsuite/tests/driver/T3364.stderr
@@ -0,0 +1,2 @@
+ghc: on the commandline: missing argument for flag: -H
+Usage: For basic information, try the `--help' option.
diff --git a/testsuite/tests/driver/T3389.hs b/testsuite/tests/driver/T3389.hs
new file mode 100644
index 0000000000..e068611460
--- /dev/null
+++ b/testsuite/tests/driver/T3389.hs
@@ -0,0 +1,12 @@
+
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -optP -C #-}
+
+#define A 'a'
+
+main :: IO ()
+main = putStrLn [A,
+-- /*
+ 'b',
+-- */
+ 'c']
diff --git a/testsuite/tests/driver/T3389.stdout b/testsuite/tests/driver/T3389.stdout
new file mode 100644
index 0000000000..8baef1b4ab
--- /dev/null
+++ b/testsuite/tests/driver/T3389.stdout
@@ -0,0 +1 @@
+abc
diff --git a/testsuite/tests/driver/T4437.hs b/testsuite/tests/driver/T4437.hs
new file mode 100644
index 0000000000..64634a9c74
--- /dev/null
+++ b/testsuite/tests/driver/T4437.hs
@@ -0,0 +1,26 @@
+
+module Main (main) where
+
+import Data.List
+import DynFlags
+import Language.Haskell.Extension
+
+main :: IO ()
+main = do let ghcExtensions = [ ext | (ext, _, _, _) <- xFlags ]
+ cabalExtensions = map show [ toEnum 0 :: KnownExtension .. ]
+ ghcOnlyExtensions = ghcExtensions \\ cabalExtensions
+ -- These are extensions which are deliberately not yet
+ -- registered with Cabal
+ expectedGhcOnlyExtensions
+ = ["ParallelArrays",
+ "RelaxedLayout",
+ "DeriveGeneric",
+ "DefaultSignatures",
+ "InterruptibleFFI",
+ "AlternativeLayoutRule",
+ "AlternativeLayoutRuleTransitional",
+ "MonadComprehensions"]
+ unexpectedGhcOnlyExtension = ghcOnlyExtensions
+ \\ expectedGhcOnlyExtensions
+ mapM_ putStrLn unexpectedGhcOnlyExtension
+
diff --git a/testsuite/tests/driver/T706.stdout b/testsuite/tests/driver/T706.stdout
new file mode 100644
index 0000000000..fadc068c40
--- /dev/null
+++ b/testsuite/tests/driver/T706.stdout
@@ -0,0 +1 @@
+"testing"
diff --git a/testsuite/tests/driver/T706a.hs b/testsuite/tests/driver/T706a.hs
new file mode 100644
index 0000000000..04f5bf53e9
--- /dev/null
+++ b/testsuite/tests/driver/T706a.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE Haskell2010 #-}
+module T706 where
+
+foreign export ccall f :: Int -> Int
+
+f :: Int -> Int
+f x = x + 1
diff --git a/testsuite/tests/driver/T706b.hs b/testsuite/tests/driver/T706b.hs
new file mode 100644
index 0000000000..1d14e97a19
--- /dev/null
+++ b/testsuite/tests/driver/T706b.hs
@@ -0,0 +1,3 @@
+module T706 where
+
+test = "testing"
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
new file mode 100644
index 0000000000..1907087a5a
--- /dev/null
+++ b/testsuite/tests/driver/all.T
@@ -0,0 +1,333 @@
+setTestOpts(only_compiler_types(['ghc']))
+
+test('driver011',
+ extra_clean(['A011.hi', 'A011.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test011'])
+
+test('driver012',
+ extra_clean(['A012.hi', 'A012.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test012'])
+
+test('driver013',
+ extra_clean(['A013.hi', 'A013.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test013'])
+
+test('driver014',
+ extra_clean(['A014.hi', 'obj014/A014.o', 'obj014']),
+ run_command,
+ ['$MAKE -s --no-print-directory test014'])
+
+test('driver015',
+ extra_clean(['A015.o', 'hi015/A015.hi', 'hi015']),
+ run_command,
+ ['$MAKE -s --no-print-directory test015'])
+
+test('driver016',
+ extra_clean(['F016.hi', 'F016.o', 'F016_stub.h']),
+ run_command,
+ ['$MAKE -s --no-print-directory test016'])
+
+test('driver017',
+ extra_clean(['F017.hi', 'F017.o', 'F017_stub.h']),
+ run_command,
+ ['$MAKE -s --no-print-directory test017'])
+
+test('driver018',
+ extra_clean(['F018.hi', 'F018_stub.h',
+ 'obj018/TestStub018.o', 'obj018/TestStub018_stub.o',
+ 'obj018']),
+ run_command,
+ ['$MAKE -s --no-print-directory test018'])
+
+test('driver018a',
+ extra_clean(['F018a.hi', 'F018a_stub.h',
+ 'TestStub018a.obj.018',
+ 'obj018a/TestStub018a_stub.obj.018']),
+ run_command,
+ ['$MAKE -s --no-print-directory test018a'])
+
+test('driver019',
+ extra_clean(['out019/TestStub.hi',
+ 'out019/TestStub.o',
+ 'out019/TestStub_stub.h',
+ 'out019/TestStub_stub.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test019'])
+
+test('driver021',
+ extra_clean(['B021/C.hi', 'B021/C.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test021'])
+
+test('driver022',
+ extra_clean(['B022/C.hi', 'B022/C.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test022'])
+
+test('driver023',
+ extra_clean(['B023/C.hi', 'B023/C.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test023'])
+
+test('driver024',
+ extra_clean(['B024/C.hi', 'obj024/B024/C.o', 'obj024/B024', 'obj024']),
+ run_command,
+ ['$MAKE -s --no-print-directory test024'])
+
+test('driver024a',
+ extra_clean(['obj024a/B024a/stub.o', 'obj024a/B024a', 'obj024a']),
+ run_command,
+ ['$MAKE -s --no-print-directory test024a'])
+
+test('driver025',
+ extra_clean(['B025/C.hi', 'B025/C.o',
+ 'hi025/B025/C.hi', 'hi025/B025', 'hi025']),
+ run_command,
+ ['$MAKE -s --no-print-directory test025'])
+
+test('driver026',
+ extra_clean(['d026/P/Q.hi', 'd026/P/Q.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test026'])
+
+test('driver027',
+ extra_clean(['B027/F.hi', 'B027/F.o',
+ 'B027/F_stub.h', 'B027/F_stub.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test027'])
+
+test('driver028',
+ extra_clean(['B028/F.hi', 'B028/F.o',
+ 'B028/F_stub.h', 'B028/F_stub.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test028'])
+
+test('driver031',
+ extra_clean(['A031.hi', 'A031.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test031'])
+
+test('driver032',
+ extra_clean(['A032.hi', 'A032.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test032'])
+
+test('driver033',
+ extra_clean(['A033.hi', 'A033.o', 'hi033/A033.hi', 'hi033']),
+ run_command,
+ ['$MAKE -s --no-print-directory test033'])
+
+test('driver034',
+ extra_clean(['F034.hi', 'F034.o', 'F034_stub.h']),
+ run_command,
+ ['$MAKE -s --no-print-directory test034'])
+
+test('driver035',
+ extra_clean(['F035.hi', 'F035.o',
+ 'stub035/F035_stub.h']),
+ run_command,
+ ['$MAKE -s --no-print-directory test035'])
+
+test('driver041',
+ extra_clean(['B041/C.hi', 'B041/C.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test041'])
+
+test('driver042',
+ extra_clean(['B042/C.hi', 'B042/C.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test042'])
+
+test('driver043',
+ extra_clean(['B043/C.hi', 'B043/C.o',
+ 'hi043/B043/C.hi', 'hi043/B043', 'hi043']),
+ run_command,
+ ['$MAKE -s --no-print-directory test043'])
+
+test('driver044',
+ extra_clean(['B044/F.hi', 'B044/F.o',
+ 'B044/F_stub.h', 'B044/F_stub.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test044'])
+
+test('driver045',
+ extra_clean(['B045/F.hi', 'B045/F.o',
+ 'B045/F_stub.h', 'B045/F_stub.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test045'])
+
+test('driver051',
+ extra_clean(['d051_1/P/Q.hi', 'd051_1/P/Q.o',
+ 'd051_2/R/S.hi', 'd051_2/R/S.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test051'])
+
+test('driver052',
+ extra_clean(['d052_1/P/Q.hi', 'd052_1/P/Q.o',
+ 'd052_2/R/S.hi', 'd052_2/R/S.o',
+ 'obj052/P/Q.o', 'obj052/P',
+ 'obj052/R/S.o', 'obj052/R',
+ 'obj052']),
+ run_command,
+ ['$MAKE -s --no-print-directory test052'])
+
+test('driver053',
+ extra_clean(['d053_1/P/Q.hi', 'd053_1/P/Q.o',
+ 'd053_2/R/S.hi', 'd053_2/R/S.o',
+ 'hi053/P/Q.hi', 'hi053/P',
+ 'hi053/R/S.hi', 'hi053/R',
+ 'hi053']),
+ run_command,
+ ['$MAKE -s --no-print-directory test053'])
+
+test('driver061a',
+ extra_clean(['A061a.hi', 'A061a.o', 'A061a.s']),
+ run_command,
+ ['$MAKE -s --no-print-directory test061a'])
+
+test('driver061b',
+ extra_clean(['A061b.hi', 'A061b.o', 'A061b.s']),
+ run_command,
+ ['$MAKE -s --no-print-directory test061b'])
+
+
+test('driver062a',
+ extra_clean(['Hello062a.hs']),
+ run_command,
+ ['$MAKE -s --no-print-directory test062a'])
+test('driver062b',
+ extra_clean(['Hello062b.hs']),
+ run_command,
+ ['$MAKE -s --no-print-directory test062b'])
+test('driver062c',
+ extra_clean(['Hello062c.hs']),
+ run_command,
+ ['$MAKE -s --no-print-directory test062c'])
+test('driver062d',
+ extra_clean(['B062d/Hello062d.hs']),
+ run_command,
+ ['$MAKE -s --no-print-directory test062d'])
+test('driver062e',
+ extra_clean(['B062e/Hello062e.hs']),
+ run_command,
+ ['$MAKE -s --no-print-directory test062e'])
+
+test('driver063',
+ extra_clean(['A063.hi', 'A063.o', 'A063.hc',
+ 'D063.hi', 'D063.o', 'D063.hc']),
+ run_command,
+ ['$MAKE -s --no-print-directory test063'])
+
+test('driver064',
+ extra_clean(['A064.hi', 'A064.o', 'A064.hspp']),
+ run_command,
+ ['$MAKE -s --no-print-directory test064'])
+
+test('driver065',
+ extra_clean(['A065.hi', 'A065.o', 'A065.hspp']),
+ run_command,
+ ['$MAKE -s --no-print-directory test065'])
+
+test('driver066',
+ extra_clean(['A066.hi', 'A066.o', 'A066.tmp']),
+ run_command,
+ ['$MAKE -s --no-print-directory test066'])
+
+test('driver067',
+ extra_clean(['A067.hi', 'A067.o', 'A067.tmp']),
+ run_command,
+ ['$MAKE -s --no-print-directory test067'])
+
+test('driver070',
+ extra_clean(['A070.hi', 'A070.o', 'A070.s']),
+ run_command,
+ ['$MAKE -s --no-print-directory test070'])
+
+test('driver071',
+ extra_clean(['A071.hi', 'A071.o', 'A071.tmp']),
+ run_command,
+ ['$MAKE -s --no-print-directory test071'])
+
+test('driver081a',
+ normal,
+ run_command,
+ ['$MAKE -s --no-print-directory test081a'])
+
+test('driver081b',
+ normal,
+ run_command,
+ ['$MAKE -s --no-print-directory test081b'])
+
+test('driver100',
+ extra_clean(['overlap/List.hi', 'overlap/List.o',
+ 'overlap/Overlap.hi', 'overlap/Overlap.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory test100'])
+
+test('driver200',
+ extra_clean(['depend200']),
+ run_command,
+ ['$MAKE -s --no-print-directory test200'])
+
+test('2566',
+ normalise_fun(normalise_errmsg),
+ run_command,
+ ['$MAKE -s --no-print-directory 2566'])
+
+test('pragma001', normal, compile, [''])
+test('pragma002', normal, compile, [''])
+
+test('2499', normal, compile_fail, [''])
+
+test('mode001', normal, run_command,
+ ['$MAKE -s --no-print-directory mode001'])
+
+if config.platform == 'i386-unknown-mingw32':
+ only_windows = normal
+else:
+ only_windows = skip
+
+test('shared001',
+ [only_windows,
+ extra_clean(['Shared001.hi', 'Shared001.o', 'HSdll.dll.a', 'HSdll.dll', 'Shared001_stub.h', 'Shared001_stub.o'])],
+ run_command,
+ ['$MAKE -s --no-print-directory shared001'])
+
+test('dynHelloWorld',
+ only_ways(['dyn']),
+ compile_and_run,
+ [''])
+
+# simple test that we can load and use the GHC package in all ways
+# (in #5313 it was failing the dyn way)
+p = subprocess.Popen([config.compiler, "--print-libdir"], stdout=subprocess.PIPE)
+libdir = chop(p.stdout.read())
+p.stdout.close
+
+test('5313', extra_run_opts('"' + libdir + '"'), compile_and_run, ['-package ghc'])
+
+test('2464', normal, compile, [''])
+test('3674', ignore_output, run_command,
+ ['$MAKE -s --no-print-directory 3674'])
+
+test('rtsopts001', normal, run_command,
+ ['$MAKE -s --no-print-directory rtsopts001'])
+test('rtsopts002', normal, run_command,
+ ['$MAKE -s --no-print-directory rtsopts002'])
+
+test('withRtsOpts', [ extra_clean(['withRtsOpts', 'withRtsOpts.exe',
+ 'withRtsOpts.hi', 'withRtsOpts.o',
+ 'withRtsOpts.out']) ],
+ run_command,
+ ['$MAKE -s --no-print-directory withRtsOpts'])
+test('T3389', normal, compile_and_run, [''])
+test('T3364', normalise_fun(normalise_errmsg), run_command,
+ ['$MAKE -s --no-print-directory T3364'])
+test('T4437', only_ways(['normal']), compile_and_run, ['-package ghc'])
+
+test('werror', normal, compile_fail, [''])
+
+test('T706', req_interp, run_command, ['$MAKE -s --no-print-directory T706'])
diff --git a/testsuite/tests/driver/bug1677/Bar.hs b/testsuite/tests/driver/bug1677/Bar.hs
new file mode 100644
index 0000000000..e29f867394
--- /dev/null
+++ b/testsuite/tests/driver/bug1677/Bar.hs
@@ -0,0 +1,2 @@
+module Bar where
+import Foo
diff --git a/testsuite/tests/driver/bug1677/Foo.hs b/testsuite/tests/driver/bug1677/Foo.hs
new file mode 100644
index 0000000000..df56d8c261
--- /dev/null
+++ b/testsuite/tests/driver/bug1677/Foo.hs
@@ -0,0 +1 @@
+Module Foo where
diff --git a/testsuite/tests/driver/bug1677/Makefile b/testsuite/tests/driver/bug1677/Makefile
new file mode 100644
index 0000000000..3c6f0c8293
--- /dev/null
+++ b/testsuite/tests/driver/bug1677/Makefile
@@ -0,0 +1,7 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+bug1677 :
+ '$(TEST_HC)' $(TEST_HC_OPTS) -M Foo.hs Bar.hs || true
+
diff --git a/testsuite/tests/driver/bug1677/all.T b/testsuite/tests/driver/bug1677/all.T
new file mode 100644
index 0000000000..d2bd077a4e
--- /dev/null
+++ b/testsuite/tests/driver/bug1677/all.T
@@ -0,0 +1 @@
+test('bug1677', normal, run_command, ['$MAKE bug1677 -s --no-print-directory'])
diff --git a/testsuite/tests/driver/bug1677/bug1677.stderr b/testsuite/tests/driver/bug1677/bug1677.stderr
new file mode 100644
index 0000000000..bc55b86c2f
--- /dev/null
+++ b/testsuite/tests/driver/bug1677/bug1677.stderr
@@ -0,0 +1,5 @@
+
+Foo.hs:1:1:
+ File name does not match module name:
+ Saw: `Main'
+ Expected: `Foo'
diff --git a/testsuite/tests/driver/conflicting_flags/Makefile b/testsuite/tests/driver/conflicting_flags/Makefile
new file mode 100644
index 0000000000..5cb4fbf945
--- /dev/null
+++ b/testsuite/tests/driver/conflicting_flags/Makefile
@@ -0,0 +1,7 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+conflicting_flags:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -V --print-libdir 2>&1 | sed "s/, version.*//"
+
diff --git a/testsuite/tests/driver/conflicting_flags/conflicting_flags.stdout b/testsuite/tests/driver/conflicting_flags/conflicting_flags.stdout
new file mode 100644
index 0000000000..31ce6b16c6
--- /dev/null
+++ b/testsuite/tests/driver/conflicting_flags/conflicting_flags.stdout
@@ -0,0 +1 @@
+The Glorious Glasgow Haskell Compilation System
diff --git a/testsuite/tests/driver/conflicting_flags/test.T b/testsuite/tests/driver/conflicting_flags/test.T
new file mode 100644
index 0000000000..0a6769a77a
--- /dev/null
+++ b/testsuite/tests/driver/conflicting_flags/test.T
@@ -0,0 +1,3 @@
+test('conflicting_flags', normal, run_command,
+ ['$MAKE -s --no-print-directory conflicting_flags'])
+
diff --git a/testsuite/tests/driver/d026/P/Q.hs b/testsuite/tests/driver/d026/P/Q.hs
new file mode 100644
index 0000000000..2466766bb0
--- /dev/null
+++ b/testsuite/tests/driver/d026/P/Q.hs
@@ -0,0 +1 @@
+module P.Q where
diff --git a/testsuite/tests/driver/d051_1/P/Q.hs b/testsuite/tests/driver/d051_1/P/Q.hs
new file mode 100644
index 0000000000..2466766bb0
--- /dev/null
+++ b/testsuite/tests/driver/d051_1/P/Q.hs
@@ -0,0 +1 @@
+module P.Q where
diff --git a/testsuite/tests/driver/d051_2/R/S.hs b/testsuite/tests/driver/d051_2/R/S.hs
new file mode 100644
index 0000000000..b5c46f3179
--- /dev/null
+++ b/testsuite/tests/driver/d051_2/R/S.hs
@@ -0,0 +1,2 @@
+module R.S where
+import P.Q
diff --git a/testsuite/tests/driver/d052_1/P/Q.hs b/testsuite/tests/driver/d052_1/P/Q.hs
new file mode 100644
index 0000000000..2466766bb0
--- /dev/null
+++ b/testsuite/tests/driver/d052_1/P/Q.hs
@@ -0,0 +1 @@
+module P.Q where
diff --git a/testsuite/tests/driver/d052_2/R/S.hs b/testsuite/tests/driver/d052_2/R/S.hs
new file mode 100644
index 0000000000..b5c46f3179
--- /dev/null
+++ b/testsuite/tests/driver/d052_2/R/S.hs
@@ -0,0 +1,2 @@
+module R.S where
+import P.Q
diff --git a/testsuite/tests/driver/d053_1/P/Q.hs b/testsuite/tests/driver/d053_1/P/Q.hs
new file mode 100644
index 0000000000..2466766bb0
--- /dev/null
+++ b/testsuite/tests/driver/d053_1/P/Q.hs
@@ -0,0 +1 @@
+module P.Q where
diff --git a/testsuite/tests/driver/d053_2/R/S.hs b/testsuite/tests/driver/d053_2/R/S.hs
new file mode 100644
index 0000000000..b5c46f3179
--- /dev/null
+++ b/testsuite/tests/driver/d053_2/R/S.hs
@@ -0,0 +1,2 @@
+module R.S where
+import P.Q
diff --git a/testsuite/tests/driver/driver062a.stdout b/testsuite/tests/driver/driver062a.stdout
new file mode 100644
index 0000000000..9766475a41
--- /dev/null
+++ b/testsuite/tests/driver/driver062a.stdout
@@ -0,0 +1 @@
+ok
diff --git a/testsuite/tests/driver/driver062b.stdout b/testsuite/tests/driver/driver062b.stdout
new file mode 100644
index 0000000000..9766475a41
--- /dev/null
+++ b/testsuite/tests/driver/driver062b.stdout
@@ -0,0 +1 @@
+ok
diff --git a/testsuite/tests/driver/driver062c.stdout b/testsuite/tests/driver/driver062c.stdout
new file mode 100644
index 0000000000..9766475a41
--- /dev/null
+++ b/testsuite/tests/driver/driver062c.stdout
@@ -0,0 +1 @@
+ok
diff --git a/testsuite/tests/driver/driver062d.stdout b/testsuite/tests/driver/driver062d.stdout
new file mode 100644
index 0000000000..9766475a41
--- /dev/null
+++ b/testsuite/tests/driver/driver062d.stdout
@@ -0,0 +1 @@
+ok
diff --git a/testsuite/tests/driver/driver062e.stdout b/testsuite/tests/driver/driver062e.stdout
new file mode 100644
index 0000000000..9766475a41
--- /dev/null
+++ b/testsuite/tests/driver/driver062e.stdout
@@ -0,0 +1 @@
+ok
diff --git a/testsuite/tests/driver/driver063.stderr b/testsuite/tests/driver/driver063.stderr
new file mode 100644
index 0000000000..0a6801537e
--- /dev/null
+++ b/testsuite/tests/driver/driver063.stderr
@@ -0,0 +1,4 @@
+
+D063.hs:2:8:
+ Could not find module `A063'
+ It is not a module in the current program, or in any known package.
diff --git a/testsuite/tests/driver/dynHelloWorld.hs b/testsuite/tests/driver/dynHelloWorld.hs
new file mode 100644
index 0000000000..5c96396ae1
--- /dev/null
+++ b/testsuite/tests/driver/dynHelloWorld.hs
@@ -0,0 +1,5 @@
+
+module Main (main) where
+
+main :: IO ()
+main = putStrLn "Hello World"
diff --git a/testsuite/tests/driver/dynHelloWorld.stdout b/testsuite/tests/driver/dynHelloWorld.stdout
new file mode 100644
index 0000000000..557db03de9
--- /dev/null
+++ b/testsuite/tests/driver/dynHelloWorld.stdout
@@ -0,0 +1 @@
+Hello World
diff --git a/testsuite/tests/driver/dynamic_flags_001/A.hs b/testsuite/tests/driver/dynamic_flags_001/A.hs
new file mode 100644
index 0000000000..50c518be7e
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_001/A.hs
@@ -0,0 +1,13 @@
+
+{-# OPTIONS_GHC -fwarn-unused-binds #-}
+
+module A (a, a_type_default, a_missing_sig) where
+
+a :: Int
+a = 4
+
+a_type_default :: Int
+a_type_default = 2 ^ 2
+
+a_missing_sig = ()
+
diff --git a/testsuite/tests/driver/dynamic_flags_001/B.hs b/testsuite/tests/driver/dynamic_flags_001/B.hs
new file mode 100644
index 0000000000..f3f82dff98
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_001/B.hs
@@ -0,0 +1,13 @@
+
+{-# OPTIONS_GHC -fwarn-type-defaults #-}
+
+module B (b, b_unused_bind, b_missing_sig) where
+
+b :: Int
+b = 5
+
+b_unused_bind :: Int -> Int
+b_unused_bind x = 2
+
+b_missing_sig = ()
+
diff --git a/testsuite/tests/driver/dynamic_flags_001/C.hs b/testsuite/tests/driver/dynamic_flags_001/C.hs
new file mode 100644
index 0000000000..ac7ff06b95
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_001/C.hs
@@ -0,0 +1,17 @@
+
+{-# OPTIONS_GHC -fwarn-missing-signatures #-}
+
+module Main (main, c_type_default, c_unused_bind) where
+
+import A (a)
+import B (b)
+
+main :: IO ()
+main = print (a + b)
+
+c_type_default :: Int
+c_type_default = 2 ^ 2
+
+c_unused_bind :: Int -> Int
+c_unused_bind x = 2
+
diff --git a/testsuite/tests/driver/dynamic_flags_001/Makefile b/testsuite/tests/driver/dynamic_flags_001/Makefile
new file mode 100644
index 0000000000..ed03b16315
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_001/Makefile
@@ -0,0 +1,14 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Dynamic flags tests
+
+clean:
+ rm -f *.o *.hi
+
+# 001: Flags turned on in one module's OPTIONS_GHC pragma shouldn't
+# be on in when compiling other modules
+
+dynamic_flags_001: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make -Werror -v0 C.hs
diff --git a/testsuite/tests/driver/dynamic_flags_001/all.T b/testsuite/tests/driver/dynamic_flags_001/all.T
new file mode 100644
index 0000000000..c487a0cb75
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_001/all.T
@@ -0,0 +1,6 @@
+test('dynamic_flags_001',
+ [skip_if_fast,
+ clean_cmd('$MAKE -s clean')],
+ run_command,
+ ['$MAKE -s --no-print-directory dynamic_flags_001'])
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/A_First.hs b/testsuite/tests/driver/dynamic_flags_002/A_First.hs
new file mode 100644
index 0000000000..94b0986dbd
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/A_First.hs
@@ -0,0 +1,5 @@
+
+{-# OPTIONS_GHC -Wall -Werror #-}
+
+module A_First where
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/A_Main.hs b/testsuite/tests/driver/dynamic_flags_002/A_Main.hs
new file mode 100644
index 0000000000..19486af9cc
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/A_Main.hs
@@ -0,0 +1,6 @@
+
+module A_Main where
+
+import A_First () -- Turns on -Wall -Werror
+import A_Second () -- Is not -Wall clean
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/A_Second.hs b/testsuite/tests/driver/dynamic_flags_002/A_Second.hs
new file mode 100644
index 0000000000..6543b6b4cf
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/A_Second.hs
@@ -0,0 +1,6 @@
+
+module A_Second where
+
+-- Not -Wall clean: Missing signature:
+a = 'c'
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/B_First.hs b/testsuite/tests/driver/dynamic_flags_002/B_First.hs
new file mode 100644
index 0000000000..ef944f57f8
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/B_First.hs
@@ -0,0 +1,6 @@
+
+module B_First where
+
+-- Not -Wall clean: Missing signature:
+a = 'c'
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/B_Main.hs b/testsuite/tests/driver/dynamic_flags_002/B_Main.hs
new file mode 100644
index 0000000000..ed1367f0b4
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/B_Main.hs
@@ -0,0 +1,6 @@
+
+module B_Main where
+
+import B_First () -- Is not -Wall clean
+import B_Second () -- Turns on -Wall -Werror
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/B_Second.hs b/testsuite/tests/driver/dynamic_flags_002/B_Second.hs
new file mode 100644
index 0000000000..a3efdb491c
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/B_Second.hs
@@ -0,0 +1,5 @@
+
+{-# OPTIONS_GHC -Wall -Werror #-}
+
+module B_Second where
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/C_Child.hs b/testsuite/tests/driver/dynamic_flags_002/C_Child.hs
new file mode 100644
index 0000000000..86241fb3e4
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/C_Child.hs
@@ -0,0 +1,5 @@
+
+{-# OPTIONS_GHC -Wall -Werror #-}
+
+module C_Child where
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/C_Main.hs b/testsuite/tests/driver/dynamic_flags_002/C_Main.hs
new file mode 100644
index 0000000000..c7decbc546
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/C_Main.hs
@@ -0,0 +1,8 @@
+
+module C_Main where
+
+import C_Child () -- Turns on -Wall -Werror
+
+-- Not -Wall clean: Missing signature:
+a = 'c'
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/D_Child.hs b/testsuite/tests/driver/dynamic_flags_002/D_Child.hs
new file mode 100644
index 0000000000..bfe4d4a42d
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/D_Child.hs
@@ -0,0 +1,6 @@
+
+module D_Child where
+
+-- Not -Wall clean: Missing signature:
+a = 'c'
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/D_Main.hs b/testsuite/tests/driver/dynamic_flags_002/D_Main.hs
new file mode 100644
index 0000000000..2b69a8ce4c
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/D_Main.hs
@@ -0,0 +1,7 @@
+
+{-# OPTIONS_GHC -Wall -Werror #-}
+
+module D_Main where
+
+import D_Child () -- Is not -Wall clean
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/Makefile b/testsuite/tests/driver/dynamic_flags_002/Makefile
new file mode 100644
index 0000000000..4a268530f1
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/Makefile
@@ -0,0 +1,4 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/ManyFirst.hs b/testsuite/tests/driver/dynamic_flags_002/ManyFirst.hs
new file mode 100644
index 0000000000..0ecb0c2d42
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/ManyFirst.hs
@@ -0,0 +1,6 @@
+
+module ManyFirst where
+
+-- Not -Wall clean: Missing signature:
+a = 'c'
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/ManySecond.hs b/testsuite/tests/driver/dynamic_flags_002/ManySecond.hs
new file mode 100644
index 0000000000..ac67a3be2b
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/ManySecond.hs
@@ -0,0 +1,5 @@
+
+{-# OPTIONS_GHC -Wall -Werror #-}
+
+module ManySecond where
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/ManyThird.hs b/testsuite/tests/driver/dynamic_flags_002/ManyThird.hs
new file mode 100644
index 0000000000..2f3df77398
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/ManyThird.hs
@@ -0,0 +1,6 @@
+
+module ManyThird where
+
+-- Not -Wall clean: Missing signature:
+a = 'c'
+
diff --git a/testsuite/tests/driver/dynamic_flags_002/all.T b/testsuite/tests/driver/dynamic_flags_002/all.T
new file mode 100644
index 0000000000..3b0072ba6b
--- /dev/null
+++ b/testsuite/tests/driver/dynamic_flags_002/all.T
@@ -0,0 +1,6 @@
+test('dynamic_flags_002A', skip_if_fast, multimod_compile, ['A_Main', '-v0'])
+test('dynamic_flags_002B', skip_if_fast, multimod_compile, ['B_Main', '-v0'])
+test('dynamic_flags_002C', skip_if_fast, multimod_compile, ['C_Main', '-v0'])
+test('dynamic_flags_002D', skip_if_fast, multimod_compile, ['D_Main', '-v0'])
+test('dynamic_flags_002Many', skip_if_fast, multimod_compile, ['ManyFirst ManySecond ManyThird', '-v0'])
+
diff --git a/testsuite/tests/driver/mode001.stdout b/testsuite/tests/driver/mode001.stdout
new file mode 100644
index 0000000000..462d836f55
--- /dev/null
+++ b/testsuite/tests/driver/mode001.stdout
@@ -0,0 +1,8 @@
+Usage:
+Usage:
+Usage:
+Usage:
+The Glorious Glasgow Haskell Compilation System
+Usage:
+The Glorious Glasgow Haskell Compilation System
+The Glorious Glasgow Haskell Compilation System
diff --git a/testsuite/tests/driver/objc/Makefile b/testsuite/tests/driver/objc/Makefile
new file mode 100644
index 0000000000..4a268530f1
--- /dev/null
+++ b/testsuite/tests/driver/objc/Makefile
@@ -0,0 +1,4 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
diff --git a/testsuite/tests/driver/objc/all.T b/testsuite/tests/driver/objc/all.T
new file mode 100644
index 0000000000..ee22934399
--- /dev/null
+++ b/testsuite/tests/driver/objc/all.T
@@ -0,0 +1,10 @@
+def if_not_platform(platforms, f):
+ if not (config.platform in platforms):
+ return f
+ else:
+ return normal
+
+skip_if_not_osx = if_not_platform(['i386-apple-darwin','x86_64-apple-darwin'], skip)
+
+test('objc-hi', [ skip_if_not_osx, objc_src ],
+ compile_and_run, ['-framework Foundation'])
diff --git a/testsuite/tests/driver/objc/objc-hi.m b/testsuite/tests/driver/objc/objc-hi.m
new file mode 100644
index 0000000000..4580bd2dfb
--- /dev/null
+++ b/testsuite/tests/driver/objc/objc-hi.m
@@ -0,0 +1,35 @@
+#import <Foundation/Foundation.h>
+#import <stdio.h>
+
+@interface HelloWorld : NSObject {
+ // no instance variables
+}
+
+// methods
+- (void)sayHello;
+
+@end
+
+@implementation HelloWorld
+
+- (void)sayHello
+{
+ printf("Hello world\n");
+}
+
+@end
+
+#import <Foundation/Foundation.h>
+
+int main (int argc, const char * argv[]) {
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+
+ // my stuff
+ HelloWorld *hw = [[HelloWorld alloc] init];
+ [hw autorelease];
+
+ [hw sayHello];
+
+ [pool release];
+ return 0;
+}
diff --git a/testsuite/tests/driver/objc/objc-hi.stdout b/testsuite/tests/driver/objc/objc-hi.stdout
new file mode 100644
index 0000000000..802992c422
--- /dev/null
+++ b/testsuite/tests/driver/objc/objc-hi.stdout
@@ -0,0 +1 @@
+Hello world
diff --git a/testsuite/tests/driver/overlap/List.hs b/testsuite/tests/driver/overlap/List.hs
new file mode 100644
index 0000000000..8a6e4262dc
--- /dev/null
+++ b/testsuite/tests/driver/overlap/List.hs
@@ -0,0 +1 @@
+module List where
diff --git a/testsuite/tests/driver/overlap/Overlap.hs b/testsuite/tests/driver/overlap/Overlap.hs
new file mode 100644
index 0000000000..b82364f7cc
--- /dev/null
+++ b/testsuite/tests/driver/overlap/Overlap.hs
@@ -0,0 +1,2 @@
+module Overlap where
+import List
diff --git a/testsuite/tests/driver/pragma001.hs b/testsuite/tests/driver/pragma001.hs
new file mode 100644
index 0000000000..8c1b7aac94
--- /dev/null
+++ b/testsuite/tests/driver/pragma001.hs
@@ -0,0 +1,29 @@
+
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+
+-- There is enough comment to fill up one buffer (1024 bytes) of the code
+-- in GHC that looks for OPTIONS_GHC pragmas etc.
+
+{-# OPTIONS_GHC -w #-}
+
+module Pragma001 () where
+
+-- This will make a warning if the pragam isn't picked up
+foo _ = ()
+foo _ = ()
+
diff --git a/testsuite/tests/driver/pragma002.hs b/testsuite/tests/driver/pragma002.hs
new file mode 100644
index 0000000000..48c66101bc
--- /dev/null
+++ b/testsuite/tests/driver/pragma002.hs
@@ -0,0 +1,10 @@
+-- an options pragma that needs more than 1k of buffer to read
+{-# OPTIONS_GHC
+ -w #-}
+
+module Pragma002 () where
+
+-- This will make a warning if the pragam isn't picked up
+foo _ = ()
+foo _ = ()
+
diff --git a/testsuite/tests/driver/recomp001/A.hs b/testsuite/tests/driver/recomp001/A.hs
new file mode 100644
index 0000000000..d7fc96e70e
--- /dev/null
+++ b/testsuite/tests/driver/recomp001/A.hs
@@ -0,0 +1,4 @@
+module A where
+
+foo :: Int
+foo = 4
diff --git a/testsuite/tests/driver/recomp001/B1.hs b/testsuite/tests/driver/recomp001/B1.hs
new file mode 100644
index 0000000000..d0efd79bf0
--- /dev/null
+++ b/testsuite/tests/driver/recomp001/B1.hs
@@ -0,0 +1,3 @@
+module B (foo) where
+
+import A (foo)
diff --git a/testsuite/tests/driver/recomp001/B2.hs b/testsuite/tests/driver/recomp001/B2.hs
new file mode 100644
index 0000000000..213d77d5eb
--- /dev/null
+++ b/testsuite/tests/driver/recomp001/B2.hs
@@ -0,0 +1,3 @@
+module B () where
+
+import A ()
diff --git a/testsuite/tests/driver/recomp001/C.hs b/testsuite/tests/driver/recomp001/C.hs
new file mode 100644
index 0000000000..d38b2ff51c
--- /dev/null
+++ b/testsuite/tests/driver/recomp001/C.hs
@@ -0,0 +1,6 @@
+module Main (main) where
+
+import B (foo)
+
+main :: IO ()
+main = print foo
diff --git a/testsuite/tests/driver/recomp001/Makefile b/testsuite/tests/driver/recomp001/Makefile
new file mode 100644
index 0000000000..a5bff9936d
--- /dev/null
+++ b/testsuite/tests/driver/recomp001/Makefile
@@ -0,0 +1,19 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+ rm -f *.o *.hi
+ rm -f B.hs C
+
+# 001: removing an export should force a recompile of dependent modules.
+# failed in GHC 6.4.
+
+recomp001: clean
+ cp B1.hs B.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 C.hs
+ sleep 1
+ cp B2.hs B.hs
+ -'$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 C.hs
diff --git a/testsuite/tests/driver/recomp001/all.T b/testsuite/tests/driver/recomp001/all.T
new file mode 100644
index 0000000000..f3672fa2f8
--- /dev/null
+++ b/testsuite/tests/driver/recomp001/all.T
@@ -0,0 +1,6 @@
+test('recomp001',
+ [skip_if_fast,
+ clean_cmd('$MAKE -s clean')],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp001'])
+
diff --git a/testsuite/tests/driver/recomp001/recomp001.stderr b/testsuite/tests/driver/recomp001/recomp001.stderr
new file mode 100644
index 0000000000..4b95415c89
--- /dev/null
+++ b/testsuite/tests/driver/recomp001/recomp001.stderr
@@ -0,0 +1,2 @@
+
+C.hs:3:11: Module `B' does not export `foo'
diff --git a/testsuite/tests/driver/recomp002/Makefile b/testsuite/tests/driver/recomp002/Makefile
new file mode 100644
index 0000000000..0dd8f47ca4
--- /dev/null
+++ b/testsuite/tests/driver/recomp002/Makefile
@@ -0,0 +1,16 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+ rm -f *.o*
+ rm -f *.hi*
+
+# Only the first invocation should print any "Compiling" messages
+
+recomp002: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make Q.hs
+ echo Middle >&2
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make Q.hs
diff --git a/testsuite/tests/driver/recomp002/Q.hs b/testsuite/tests/driver/recomp002/Q.hs
new file mode 100644
index 0000000000..bdca9402bd
--- /dev/null
+++ b/testsuite/tests/driver/recomp002/Q.hs
@@ -0,0 +1,5 @@
+
+module Q where
+
+import {-# SOURCE #-} W
+
diff --git a/testsuite/tests/driver/recomp002/W.hs b/testsuite/tests/driver/recomp002/W.hs
new file mode 100644
index 0000000000..0e2392d6c9
--- /dev/null
+++ b/testsuite/tests/driver/recomp002/W.hs
@@ -0,0 +1,5 @@
+
+module W where
+
+import Q
+
diff --git a/testsuite/tests/driver/recomp002/W.hs-boot b/testsuite/tests/driver/recomp002/W.hs-boot
new file mode 100644
index 0000000000..62be698970
--- /dev/null
+++ b/testsuite/tests/driver/recomp002/W.hs-boot
@@ -0,0 +1,3 @@
+
+module W where
+
diff --git a/testsuite/tests/driver/recomp002/all.T b/testsuite/tests/driver/recomp002/all.T
new file mode 100644
index 0000000000..5f8ddf5f1b
--- /dev/null
+++ b/testsuite/tests/driver/recomp002/all.T
@@ -0,0 +1,6 @@
+test('recomp002',
+ [skip_if_fast,
+ clean_cmd('$MAKE -s clean')],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp002'])
+
diff --git a/testsuite/tests/driver/recomp002/recomp002.stderr b/testsuite/tests/driver/recomp002/recomp002.stderr
new file mode 100644
index 0000000000..56cdd85e1d
--- /dev/null
+++ b/testsuite/tests/driver/recomp002/recomp002.stderr
@@ -0,0 +1 @@
+Middle
diff --git a/testsuite/tests/driver/recomp002/recomp002.stdout b/testsuite/tests/driver/recomp002/recomp002.stdout
new file mode 100644
index 0000000000..d9ddb2523a
--- /dev/null
+++ b/testsuite/tests/driver/recomp002/recomp002.stdout
@@ -0,0 +1,3 @@
+[1 of 3] Compiling W[boot] ( W.hs-boot, W.o-boot )
+[2 of 3] Compiling Q ( Q.hs, Q.o )
+[3 of 3] Compiling W ( W.hs, W.o )
diff --git a/testsuite/tests/driver/recomp003/A.hs b/testsuite/tests/driver/recomp003/A.hs
new file mode 100644
index 0000000000..7fa4516161
--- /dev/null
+++ b/testsuite/tests/driver/recomp003/A.hs
@@ -0,0 +1,3 @@
+module A where
+import Data.Char
+
diff --git a/testsuite/tests/driver/recomp003/Makefile b/testsuite/tests/driver/recomp003/Makefile
new file mode 100644
index 0000000000..7f6bfc2e48
--- /dev/null
+++ b/testsuite/tests/driver/recomp003/Makefile
@@ -0,0 +1,18 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+OBJSUFFIX = .o
+
+# Test that adding a new module that shadows a package module causes
+# recompilation. Part of bug #1372.
+recomp003:
+ $(RM) A.hi A$(OBJSUFFIX) out
+ $(RM) -rf Data
+ mkdir Data
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c A.hs
+ echo "module Data.Char where" > Data/Char.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c Data/Char.hs
+ # Should now recompile A.hs, because Char is now a home module:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c A.hs 2>err
+ @if grep NOT err; then false; fi
diff --git a/testsuite/tests/driver/recomp003/all.T b/testsuite/tests/driver/recomp003/all.T
new file mode 100644
index 0000000000..c6653c2723
--- /dev/null
+++ b/testsuite/tests/driver/recomp003/all.T
@@ -0,0 +1,6 @@
+test('recomp003',
+ extra_clean(['Data/Char.hs', 'Data/Char.hi', 'Data/Char.o',
+ 'A.o', 'A.hi',
+ 'err']),
+ run_command,
+ ['$MAKE -s --no-print-directory recomp003'])
diff --git a/testsuite/tests/driver/recomp004/Main.hs b/testsuite/tests/driver/recomp004/Main.hs
new file mode 100644
index 0000000000..cbb16d21d3
--- /dev/null
+++ b/testsuite/tests/driver/recomp004/Main.hs
@@ -0,0 +1,10 @@
+
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+module Main where
+
+main :: IO ()
+main = foo
+
+foreign import ccall unsafe "c.h foo" foo :: IO ()
+
diff --git a/testsuite/tests/driver/recomp004/Makefile b/testsuite/tests/driver/recomp004/Makefile
new file mode 100644
index 0000000000..41b93b169d
--- /dev/null
+++ b/testsuite/tests/driver/recomp004/Makefile
@@ -0,0 +1,24 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+EXECUTABLE = Main$(exeext)
+CLEAN_FILES = c.c c.o Main.o Main.hi $(EXECUTABLE)
+
+clean:
+ $(RM) $(CLEAN_FILES)
+
+# Test that updates to C modules are noticed
+recomp004:
+ $(RM) $(CLEAN_FILES)
+ $(CP) c1.c c.c
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 -c c.c -o c.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Main.hs c.o -o $(EXECUTABLE)
+ ./$(EXECUTABLE)
+ $(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 Main.hs Main.hi Main.o c.c $(EXECUTABLE)
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Main.hs c.o -o $(EXECUTABLE)
+ ./$(EXECUTABLE)
+
diff --git a/testsuite/tests/driver/recomp004/all.T b/testsuite/tests/driver/recomp004/all.T
new file mode 100644
index 0000000000..54d190d83a
--- /dev/null
+++ b/testsuite/tests/driver/recomp004/all.T
@@ -0,0 +1,4 @@
+test('recomp004',
+ extra_clean(['Main', 'Main.exe', 'c.c']),
+ run_command,
+ ['$MAKE -s --no-print-directory recomp004'])
diff --git a/testsuite/tests/driver/recomp004/c.h b/testsuite/tests/driver/recomp004/c.h
new file mode 100644
index 0000000000..12c941119c
--- /dev/null
+++ b/testsuite/tests/driver/recomp004/c.h
@@ -0,0 +1,5 @@
+
+#include <stdio.h>
+
+void foo(void);
+
diff --git a/testsuite/tests/driver/recomp004/c1.c b/testsuite/tests/driver/recomp004/c1.c
new file mode 100644
index 0000000000..0b2101a826
--- /dev/null
+++ b/testsuite/tests/driver/recomp004/c1.c
@@ -0,0 +1,6 @@
+
+#include "c.h"
+
+void foo(void) {
+ printf("Foo\n");
+}
diff --git a/testsuite/tests/driver/recomp004/c2.c b/testsuite/tests/driver/recomp004/c2.c
new file mode 100644
index 0000000000..decb52617a
--- /dev/null
+++ b/testsuite/tests/driver/recomp004/c2.c
@@ -0,0 +1,6 @@
+
+#include "c.h"
+
+void foo(void) {
+ printf("Bar\n");
+}
diff --git a/testsuite/tests/driver/recomp004/recomp004.stdout b/testsuite/tests/driver/recomp004/recomp004.stdout
new file mode 100644
index 0000000000..3b71d5be87
--- /dev/null
+++ b/testsuite/tests/driver/recomp004/recomp004.stdout
@@ -0,0 +1,2 @@
+Foo
+Bar
diff --git a/testsuite/tests/driver/recomp005/A.hs b/testsuite/tests/driver/recomp005/A.hs
new file mode 100644
index 0000000000..4cf81d9c9f
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/A.hs
@@ -0,0 +1,4 @@
+module A where
+
+f :: Int -> Int
+f x = x + 1
diff --git a/testsuite/tests/driver/recomp005/B.hs b/testsuite/tests/driver/recomp005/B.hs
new file mode 100644
index 0000000000..84ef616bba
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/B.hs
@@ -0,0 +1,5 @@
+module B where
+
+g :: Int -> Int
+g x = x * 2
+
diff --git a/testsuite/tests/driver/recomp005/C1.hs b/testsuite/tests/driver/recomp005/C1.hs
new file mode 100644
index 0000000000..8141245535
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/C1.hs
@@ -0,0 +1,5 @@
+
+module C (f, g) where
+
+import A
+import B
diff --git a/testsuite/tests/driver/recomp005/C2.hs b/testsuite/tests/driver/recomp005/C2.hs
new file mode 100644
index 0000000000..7764ed861b
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/C2.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE RankNTypes #-}
+module C (f, g) where
+
+import A
+import B
+
+{-# RULES "f/g" forall x . f (g x) = x #-}
diff --git a/testsuite/tests/driver/recomp005/D.hs b/testsuite/tests/driver/recomp005/D.hs
new file mode 100644
index 0000000000..c8cd790be1
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/D.hs
@@ -0,0 +1,3 @@
+module D () where
+
+import C () -- so we don't get a dependency on C's export list
diff --git a/testsuite/tests/driver/recomp005/E.hs b/testsuite/tests/driver/recomp005/E.hs
new file mode 100644
index 0000000000..e6e2e6b784
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/E.hs
@@ -0,0 +1,7 @@
+module E where
+
+import D -- get the RULE from C via D
+import A
+import B
+
+z = f (g 3)
diff --git a/testsuite/tests/driver/recomp005/Makefile b/testsuite/tests/driver/recomp005/Makefile
new file mode 100644
index 0000000000..e1bda204b7
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/Makefile
@@ -0,0 +1,16 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+clean:
+ rm -f *.o*
+ rm -f *.hi*
+ rm -f C.hs
+
+recomp005: clean
+ cp C1.hs C.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make E.hs -O
+ sleep 1
+ cp C2.hs C.hs
+ # Should recompile E, because C is now an orphan
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make E.hs -O
diff --git a/testsuite/tests/driver/recomp005/all.T b/testsuite/tests/driver/recomp005/all.T
new file mode 100644
index 0000000000..d5d89b1712
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/all.T
@@ -0,0 +1,5 @@
+test('recomp005',
+ [skip_if_fast,
+ clean_cmd('$MAKE -s clean')],
+ run_command, ['$MAKE -s --no-print-directory recomp005'])
+
diff --git a/testsuite/tests/driver/recomp005/recomp005.stderr b/testsuite/tests/driver/recomp005/recomp005.stderr
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/recomp005.stderr
diff --git a/testsuite/tests/driver/recomp005/recomp005.stdout b/testsuite/tests/driver/recomp005/recomp005.stdout
new file mode 100644
index 0000000000..720a1ea74f
--- /dev/null
+++ b/testsuite/tests/driver/recomp005/recomp005.stdout
@@ -0,0 +1,8 @@
+[1 of 5] Compiling B ( B.hs, B.o )
+[2 of 5] Compiling A ( A.hs, A.o )
+[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 )
+[4 of 5] Compiling D ( D.hs, D.o )
+[5 of 5] Compiling E ( E.hs, E.o )
diff --git a/testsuite/tests/driver/recomp006/A.hs b/testsuite/tests/driver/recomp006/A.hs
new file mode 100644
index 0000000000..a658ba6e3c
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/A.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE TypeOperators #-}
+module A where
+
+import B ((:-))
+
+-- assumes :- is right-associative
+f :: Int :- Int :- Int
+f = (1,(2,3))
+
diff --git a/testsuite/tests/driver/recomp006/B1.hs b/testsuite/tests/driver/recomp006/B1.hs
new file mode 100644
index 0000000000..aed449262f
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/B1.hs
@@ -0,0 +1,8 @@
+
+{-# LANGUAGE TypeOperators #-}
+
+module B where
+
+infixr 9 :-
+
+type a :- b = (a,b)
diff --git a/testsuite/tests/driver/recomp006/B2.hs b/testsuite/tests/driver/recomp006/B2.hs
new file mode 100644
index 0000000000..905b6dbd9a
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/B2.hs
@@ -0,0 +1,8 @@
+
+{-# LANGUAGE TypeOperators #-}
+
+module B where
+
+infixl 9 :-
+
+type a :- b = (a,b)
diff --git a/testsuite/tests/driver/recomp006/Makefile b/testsuite/tests/driver/recomp006/Makefile
new file mode 100644
index 0000000000..a0f55d636d
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/Makefile
@@ -0,0 +1,16 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+OBJSUFFIX = .o
+
+# Test that changing the fixity of a type synonym operator forces recompilation
+# (see #3166).
+recomp006:
+ $(RM) A.hi A$(OBJSUFFIX)
+ cp B1.hs B.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs 1>out 2>err
+ sleep 1
+ cp B2.hs B.hs
+ # This should fail
+ if '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs; then false; fi
diff --git a/testsuite/tests/driver/recomp006/all.T b/testsuite/tests/driver/recomp006/all.T
new file mode 100644
index 0000000000..bc4f915bad
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/all.T
@@ -0,0 +1,3 @@
+test('recomp006',
+ [ skip_if_fast, extra_clean(['A.o','A.hi','B.o','B.hi','err','out']) ],
+ run_command, ['$MAKE -s --no-print-directory recomp006'])
diff --git a/testsuite/tests/driver/recomp006/recomp006.stderr b/testsuite/tests/driver/recomp006/recomp006.stderr
new file mode 100644
index 0000000000..c449b5cd2d
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/recomp006.stderr
@@ -0,0 +1,14 @@
+
+A.hs:8:6:
+ No instance for (Num (Int :- Int))
+ arising from the literal `1'
+ Possible fix: add an instance declaration for (Num (Int :- Int))
+ In the expression: 1
+ In the expression: (1, (2, 3))
+ In an equation for `f': f = (1, (2, 3))
+
+A.hs:8:8:
+ Couldn't match expected type `Int' with actual type `(t0, t1)'
+ In the expression: (2, 3)
+ In the expression: (1, (2, 3))
+ In an equation for `f': f = (1, (2, 3))
diff --git a/testsuite/tests/driver/recomp006/recomp006.stdout b/testsuite/tests/driver/recomp006/recomp006.stdout
new file mode 100644
index 0000000000..f403e40d1a
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/recomp006.stdout
@@ -0,0 +1,2 @@
+[1 of 2] Compiling B ( B.hs, B.o )
+[2 of 2] Compiling A ( A.hs, A.o )
diff --git a/testsuite/tests/driver/recomp007/Makefile b/testsuite/tests/driver/recomp007/Makefile
new file mode 100644
index 0000000000..94d46e8242
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/Makefile
@@ -0,0 +1,28 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+LOCAL_PKGCONF=local.package.conf
+
+clean:
+ rm -f Setup$(exeext)
+ rm -rf a1/dist a2/dist b/dist
+ rm -f *.o *.hi
+ rm -f clean.out prep.out
+ rm -rf $(LOCAL_PKGCONF)
+
+recomp007:
+ $(MAKE) clean
+ "$(GHC_PKG)" init $(LOCAL_PKGCONF)
+ "$(TEST_HC)" -v0 --make Setup.hs
+ $(MAKE) prep.a1
+ $(MAKE) prep.b
+ "$(GHC_PKG)" unregister --package-conf=$(LOCAL_PKGCONF) a-1.0
+ $(MAKE) prep.a2
+ cd b && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF)
+ cd b && ../Setup build
+
+prep.%:
+ cd $* && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF)
+ cd $* && ../Setup build -v0
+ cd $* && ../Setup register -v0 --inplace
diff --git a/testsuite/tests/driver/recomp007/Setup.hs b/testsuite/tests/driver/recomp007/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recomp007/a1/A.hs b/testsuite/tests/driver/recomp007/a1/A.hs
new file mode 100644
index 0000000000..8e028dcab8
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/a1/A.hs
@@ -0,0 +1,3 @@
+module A (a) where
+
+a = "1.0"
diff --git a/testsuite/tests/driver/recomp007/a1/a.cabal b/testsuite/tests/driver/recomp007/a1/a.cabal
new file mode 100644
index 0000000000..cb6d3c01b9
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/a1/a.cabal
@@ -0,0 +1,7 @@
+name: a
+version: 1.0
+exposed-modules: A
+build-depends: base
+build-type: Simple
+ghc-options: -O0
+
diff --git a/testsuite/tests/driver/recomp007/a2/A.hs b/testsuite/tests/driver/recomp007/a2/A.hs
new file mode 100644
index 0000000000..273896245c
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/a2/A.hs
@@ -0,0 +1,3 @@
+module A (a) where
+
+a = "2.0"
diff --git a/testsuite/tests/driver/recomp007/a2/a.cabal b/testsuite/tests/driver/recomp007/a2/a.cabal
new file mode 100644
index 0000000000..5c3ae6a74d
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/a2/a.cabal
@@ -0,0 +1,7 @@
+name: a
+version: 2.0
+exposed-modules: A
+build-depends: base
+build-type: Simple
+ghc-options: -O0
+
diff --git a/testsuite/tests/driver/recomp007/all.T b/testsuite/tests/driver/recomp007/all.T
new file mode 100644
index 0000000000..5a93a12d68
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/all.T
@@ -0,0 +1,9 @@
+# This tests for correct recompilation when a package version changes.
+# See the patch
+# "Fix a recompilation checking bug when a package dependency changes"
+
+test('recomp007',
+ [ skip_if_fast, clean_cmd('$MAKE -s clean'), normalise_slashes ],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp007'])
+
diff --git a/testsuite/tests/driver/recomp007/b/B.hs b/testsuite/tests/driver/recomp007/b/B.hs
new file mode 100644
index 0000000000..742c5d3a3f
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/b/B.hs
@@ -0,0 +1,5 @@
+module B (b) where
+
+import A
+
+b = a
diff --git a/testsuite/tests/driver/recomp007/b/Main.hs b/testsuite/tests/driver/recomp007/b/Main.hs
new file mode 100644
index 0000000000..ca60a5902b
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/b/Main.hs
@@ -0,0 +1,5 @@
+module Main (main) where
+
+import B
+
+main = print b
diff --git a/testsuite/tests/driver/recomp007/b/b.cabal b/testsuite/tests/driver/recomp007/b/b.cabal
new file mode 100644
index 0000000000..988ef871a2
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/b/b.cabal
@@ -0,0 +1,10 @@
+name: b
+version: 1.0
+build-type: Simple
+cabal-version: >= 1.2
+executable test {
+ build-depends: base, a
+ main-is: Main.hs
+ other-modules: B
+ ghc-options: -O0
+}
diff --git a/testsuite/tests/driver/recomp007/recomp007.stderr b/testsuite/tests/driver/recomp007/recomp007.stderr
new file mode 100644
index 0000000000..290be5f14d
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/recomp007.stderr
@@ -0,0 +1 @@
+Linking dist/build/test/test ...
diff --git a/testsuite/tests/driver/recomp007/recomp007.stdout b/testsuite/tests/driver/recomp007/recomp007.stdout
new file mode 100644
index 0000000000..b956b8f9a3
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/recomp007.stdout
@@ -0,0 +1,4 @@
+Building b-1.0...
+Preprocessing executable 'test' for b-1.0...
+[1 of 2] Compiling B ( B.hs, dist/build/test/test-tmp/B.o )
+[2 of 2] Compiling Main ( Main.hs, dist/build/test/test-tmp/Main.o )
diff --git a/testsuite/tests/driver/recomp008/A1.hs b/testsuite/tests/driver/recomp008/A1.hs
new file mode 100644
index 0000000000..224258034a
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/A1.hs
@@ -0,0 +1,8 @@
+module A (T,t) where
+
+data T = T
+t = T
+
+instance Eq T where
+ t1 == t2 = True
+
diff --git a/testsuite/tests/driver/recomp008/A2.hs b/testsuite/tests/driver/recomp008/A2.hs
new file mode 100644
index 0000000000..efc9207399
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/A2.hs
@@ -0,0 +1,8 @@
+module A (T,t) where
+
+data T = T
+t = T
+
+instance Eq T where
+ t1 == t2 = False
+
diff --git a/testsuite/tests/driver/recomp008/B.hs b/testsuite/tests/driver/recomp008/B.hs
new file mode 100644
index 0000000000..b1b7491b07
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/B.hs
@@ -0,0 +1,4 @@
+module B (T,t) where
+
+import A
+
diff --git a/testsuite/tests/driver/recomp008/Main.hs b/testsuite/tests/driver/recomp008/Main.hs
new file mode 100644
index 0000000000..df246a3303
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/Main.hs
@@ -0,0 +1,5 @@
+module Main where
+
+import B
+
+main = print (t == t)
diff --git a/testsuite/tests/driver/recomp008/Makefile b/testsuite/tests/driver/recomp008/Makefile
new file mode 100644
index 0000000000..3e598ae9f1
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/Makefile
@@ -0,0 +1,28 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+Main.o : B.hi
+B.o : A.hi
+
+%.o : %.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -O -c $< -o $@
+
+# magic .hi rule: see rules/hi-rule.mk in the GHC source tree
+%.hi : %.o ;
+
+prog : A.o B.o Main.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) -o prog A.o B.o Main.o
+
+clean :
+ $(RM) *.hi *.o prog
+
+recomp008 :
+ $(MAKE) clean
+ cp A1.hs A.hs
+ $(MAKE) prog
+ ./prog
+ sleep 1
+ cp A2.hs A.hs
+ $(MAKE) prog
+ ./prog
diff --git a/testsuite/tests/driver/recomp008/all.T b/testsuite/tests/driver/recomp008/all.T
new file mode 100644
index 0000000000..a59b1512e0
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/all.T
@@ -0,0 +1,7 @@
+# Test for #4469, a recompilation bug related to instances
+
+test('recomp008',
+ [ skip_if_fast, clean_cmd('$MAKE -s clean'), normalise_slashes ],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp008'])
+
diff --git a/testsuite/tests/driver/recomp008/recomp008.stdout b/testsuite/tests/driver/recomp008/recomp008.stdout
new file mode 100644
index 0000000000..1cc8b5e10d
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/recomp008.stdout
@@ -0,0 +1,2 @@
+True
+False
diff --git a/testsuite/tests/driver/recomp009/Main.hs b/testsuite/tests/driver/recomp009/Main.hs
new file mode 100644
index 0000000000..b5e5424f9b
--- /dev/null
+++ b/testsuite/tests/driver/recomp009/Main.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Main where
+import Sub
+main = print $x
diff --git a/testsuite/tests/driver/recomp009/Makefile b/testsuite/tests/driver/recomp009/Makefile
new file mode 100644
index 0000000000..f343534bb3
--- /dev/null
+++ b/testsuite/tests/driver/recomp009/Makefile
@@ -0,0 +1,20 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+ rm -f *.o *.hi
+ rm -f B.hs C
+
+# bug #481
+
+recomp009: clean
+ cp Sub1.hs Sub.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Main.hs
+ ./Main
+ sleep 1
+ cp Sub2.hs Sub.hs
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Main.hs
+ ./Main
diff --git a/testsuite/tests/driver/recomp009/Sub1.hs b/testsuite/tests/driver/recomp009/Sub1.hs
new file mode 100644
index 0000000000..25ea7552e4
--- /dev/null
+++ b/testsuite/tests/driver/recomp009/Sub1.hs
@@ -0,0 +1,3 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Sub where
+x = [| 1 |]
diff --git a/testsuite/tests/driver/recomp009/Sub2.hs b/testsuite/tests/driver/recomp009/Sub2.hs
new file mode 100644
index 0000000000..7ca8b12c33
--- /dev/null
+++ b/testsuite/tests/driver/recomp009/Sub2.hs
@@ -0,0 +1,3 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Sub where
+x = [| 2 |]
diff --git a/testsuite/tests/driver/recomp009/all.T b/testsuite/tests/driver/recomp009/all.T
new file mode 100644
index 0000000000..368f6cf2f8
--- /dev/null
+++ b/testsuite/tests/driver/recomp009/all.T
@@ -0,0 +1,7 @@
+# Test for #481, a recompilation bug with Template Haskell
+
+test('recomp009',
+ [ clean_cmd('$MAKE -s clean') ],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp009'])
+
diff --git a/testsuite/tests/driver/recomp009/recomp009.stdout b/testsuite/tests/driver/recomp009/recomp009.stdout
new file mode 100644
index 0000000000..1191247b6d
--- /dev/null
+++ b/testsuite/tests/driver/recomp009/recomp009.stdout
@@ -0,0 +1,2 @@
+1
+2
diff --git a/testsuite/tests/driver/rtsOpts.hs b/testsuite/tests/driver/rtsOpts.hs
new file mode 100644
index 0000000000..0634af001e
--- /dev/null
+++ b/testsuite/tests/driver/rtsOpts.hs
@@ -0,0 +1,3 @@
+
+main :: IO ()
+main = return ()
diff --git a/testsuite/tests/driver/rtsopts001.stdout b/testsuite/tests/driver/rtsopts001.stdout
new file mode 100644
index 0000000000..b9f151026d
--- /dev/null
+++ b/testsuite/tests/driver/rtsopts001.stdout
@@ -0,0 +1,3 @@
+Normal
+No RTS opts
+rtsOpts: Most RTS options are disabled. Link with -rtsopts to enable them.
diff --git a/testsuite/tests/driver/rtsopts002.hs b/testsuite/tests/driver/rtsopts002.hs
new file mode 100644
index 0000000000..473bb8a252
--- /dev/null
+++ b/testsuite/tests/driver/rtsopts002.hs
@@ -0,0 +1 @@
+main = print "hello"
diff --git a/testsuite/tests/driver/rtsopts002.stderr b/testsuite/tests/driver/rtsopts002.stderr
new file mode 100644
index 0000000000..a92deb2b05
--- /dev/null
+++ b/testsuite/tests/driver/rtsopts002.stderr
@@ -0,0 +1,2 @@
+rtsopts002: Most RTS options are disabled. Link with -rtsopts to enable them.
+rtsopts002: Most RTS options are disabled. Link with -rtsopts to enable them.
diff --git a/testsuite/tests/driver/rtsopts002.stdout b/testsuite/tests/driver/rtsopts002.stdout
new file mode 100644
index 0000000000..ac8108a43d
--- /dev/null
+++ b/testsuite/tests/driver/rtsopts002.stdout
@@ -0,0 +1,2 @@
+"hello"
+"hello"
diff --git a/testsuite/tests/driver/shared001.stderr b/testsuite/tests/driver/shared001.stderr
new file mode 100644
index 0000000000..26204ba300
--- /dev/null
+++ b/testsuite/tests/driver/shared001.stderr
@@ -0,0 +1 @@
+Creating library file: HSdll.dll.a
diff --git a/testsuite/tests/driver/werror.hs b/testsuite/tests/driver/werror.hs
new file mode 100644
index 0000000000..ddfa8449d6
--- /dev/null
+++ b/testsuite/tests/driver/werror.hs
@@ -0,0 +1,13 @@
+{-# OPTIONS_GHC -Wall -fwarn-tabs -Werror #-}
+
+-- check that all warnings are emitted before failing due to -Werror (#1666)
+
+-- missing type sig warning (type checker)
+main = do
+ let main = main -- shadowing warning (renamer)
+ putStrLn "hello" -- tab warning (lexer)
+
+f [] = []
+f [] = [] -- overlapping pattern
+-- incomplete pattern
+
diff --git a/testsuite/tests/driver/werror.stderr b/testsuite/tests/driver/werror.stderr
new file mode 100644
index 0000000000..c8e7894085
--- /dev/null
+++ b/testsuite/tests/driver/werror.stderr
@@ -0,0 +1,28 @@
+
+werror.hs:6:1:
+ Warning: Top-level binding with no type signature: main :: IO ()
+
+werror.hs:7:13:
+ Warning: This binding for `main' shadows the existing binding
+ defined at werror.hs:6:1
+
+werror.hs:7:13: Warning: Defined but not used: `main'
+
+werror.hs:8:1: Warning: Tab character
+
+werror.hs:10:1: Warning: Defined but not used: `f'
+
+werror.hs:10:1:
+ Warning: Top-level binding with no type signature:
+ f :: forall t a. [t] -> [a]
+
+werror.hs:10:1:
+ Warning: Pattern match(es) are overlapped
+ In an equation for `f': f [] = ...
+
+werror.hs:10:1:
+ Warning: Pattern match(es) are non-exhaustive
+ In an equation for `f': Patterns not matched: _ : _
+
+<no location info>:
+Failing due to -Werror.
diff --git a/testsuite/tests/driver/withRtsOpts.hs b/testsuite/tests/driver/withRtsOpts.hs
new file mode 100644
index 0000000000..0634af001e
--- /dev/null
+++ b/testsuite/tests/driver/withRtsOpts.hs
@@ -0,0 +1,3 @@
+
+main :: IO ()
+main = return ()
diff --git a/testsuite/tests/driver/withRtsOpts.stdout b/testsuite/tests/driver/withRtsOpts.stdout
new file mode 100644
index 0000000000..0a21aace86
--- /dev/null
+++ b/testsuite/tests/driver/withRtsOpts.stdout
@@ -0,0 +1 @@
+ [("GHC RTS", "YES")