diff options
37 files changed, 97 insertions, 18 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 319ed9d8d5..9e0252c109 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -945,9 +945,9 @@ def checkStats(stats_file, num_fields): def extras_build( way, extra_mods, extra_hc_opts ): for modopts in extra_mods: mod, opts = modopts - result = simple_build( mod, way, opts + extra_hc_opts, 0, '', 0, 0, 0) - if not (mod.endswith(".hs") or mod.endswith(".lhs")): - extra_hc_opts += " " + replace_suffix(mod, 'o') + result = simple_build( mod, way, opts + ' ' + extra_hc_opts, 0, '', 0, 0, 0) + if not (mod.endswith('.hs') or mod.endswith('.lhs')): + extra_hc_opts += ' ' + replace_suffix(mod, 'o') if badResult(result): return result diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags03.hs b/testsuite/tests/safeHaskell/flags/SafeFlags03.hs index ea83a06210..0ef156118f 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags03.hs +++ b/testsuite/tests/safeHaskell/flags/SafeFlags03.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE SafeImports #-} +{-# LANGUAGE SafeImport #-} -- | Basic test to see if Safe flags compiles module SafeFlags03 where diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags03.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags03.stderr index 7e38ffded2..0ca3951efa 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags03.stderr +++ b/testsuite/tests/safeHaskell/flags/SafeFlags03.stderr @@ -1,2 +1,2 @@ -SafeFlags04.hs:1:14: Unsupported extension: SafeImport +SafeFlags03.hs:1:14: Unsupported extension: SafeImport diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags05.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags05.stderr new file mode 100644 index 0000000000..3ca3d81752 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags05.stderr @@ -0,0 +1,2 @@ +ghc-stage2: SafeFlags05.hs:1:20-25: Incompatible Safe Haskell flags! (Safe, Unsafe) +Usage: For basic information, try the `--help' option. diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags06.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags06.stderr new file mode 100644 index 0000000000..f43309ce3b --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags06.stderr @@ -0,0 +1,2 @@ +ghc-stage2: SafeFlags06.hs:1:27-32: Incompatible Safe Haskell flags! (Trustworthy, Unsafe) +Usage: For basic information, try the `--help' option. diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags13.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags13.stderr new file mode 100644 index 0000000000..9c128f5d0c --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags13.stderr @@ -0,0 +1,2 @@ +ghc-stage2: SafeFlags13.hs:2:14-19: Incompatible Safe Haskell flags! (Trustworthy, Unsafe) +Usage: For basic information, try the `--help' option. diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags14.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags14.stderr new file mode 100644 index 0000000000..991511f55c --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags14.stderr @@ -0,0 +1,2 @@ +ghc-stage2: SafeFlags14.hs:2:14-19: Incompatible Safe Haskell flags! (Safe, Unsafe) +Usage: For basic information, try the `--help' option. diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags16.hs b/testsuite/tests/safeHaskell/flags/SafeFlags16.hs index 6259edc313..897a7bc253 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags16.hs +++ b/testsuite/tests/safeHaskell/flags/SafeFlags16.hs @@ -1,7 +1,7 @@ {-# LANGUAGE Trustworthy #-} {-# OPTIONS_GHC -fpackage-trust #-} -- | Basic test to see if Safe flags compiles -module SafeFlags15 where +module SafeFlags16 where f :: Int f = 1 diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags17.hs b/testsuite/tests/safeHaskell/flags/SafeFlags17.hs index 3f4651b2f4..9bbd7a0550 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags17.hs +++ b/testsuite/tests/safeHaskell/flags/SafeFlags17.hs @@ -1,7 +1,7 @@ {-# LANGUAGE Safe #-} {-# OPTIONS_GHC -fpackage-trust #-} -- | Basic test to see if Safe flags compiles -module SafeFlags15 where +module SafeFlags17 where f :: Int f = 1 diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags17.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags17.stderr new file mode 100644 index 0000000000..99147eea77 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags17.stderr @@ -0,0 +1,3 @@ + +SafeFlags17.hs:4:8: + base:Prelude can't be safely imported! The package (base) the module resides in isn't trusted. diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags18.hs b/testsuite/tests/safeHaskell/flags/SafeFlags18.hs index f8286918f9..601a8e0b3c 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags18.hs +++ b/testsuite/tests/safeHaskell/flags/SafeFlags18.hs @@ -1,6 +1,6 @@ {-# OPTIONS_GHC -fpackage-trust #-} -- | Basic test to see if Safe flags compiles -module SafeFlags15 where +module SafeFlags18 where f :: Int f = 1 diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags19.hs b/testsuite/tests/safeHaskell/flags/SafeFlags19.hs index 957a906846..053bc56c2f 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags19.hs +++ b/testsuite/tests/safeHaskell/flags/SafeFlags19.hs @@ -2,7 +2,7 @@ -- | Basic test to see if Safe flags compiles -- test should fail as there shouldn't be a no-package-trust flag, only a -- package-trust flag! -module SafeFlags15 where +module SafeFlags19 where f :: Int f = 1 diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags19.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags19.stderr new file mode 100644 index 0000000000..adbc757494 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags19.stderr @@ -0,0 +1,3 @@ + +SafeFlags19.hs:1:16: + unknown flag in {-# OPTIONS_GHC #-} pragma: -fno-package-trust diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags20.hs b/testsuite/tests/safeHaskell/flags/SafeFlags20.hs new file mode 100644 index 0000000000..8d415c1a09 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags20.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +{-# OPTIONS_GHC -fpackage-trust #-} +-- | Basic test to see if Safe flags compiles +module SafeFlags20 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/all.T b/testsuite/tests/safeHaskell/flags/all.T index 66d07b9c07..1100cedf50 100644 --- a/testsuite/tests/safeHaskell/flags/all.T +++ b/testsuite/tests/safeHaskell/flags/all.T @@ -36,9 +36,10 @@ test('SafeFlags14', normal, compile_fail, ['']) test('SafeFlags15', normal, compile, ['']) test('SafeFlags16', normal, compile, ['']) -test('SafeFlags17', normal, compile, ['']) +test('SafeFlags17', normal, compile_fail, ['-distrust base']) test('SafeFlags18', normal, compile, ['']) test('SafeFlags19', normal, compile_fail, ['']) +test('SafeFlags20', normal, compile, ['-trust base']) test('Flags01', normal, compile, ['']) test('Flags02', normal, compile, ['']) diff --git a/testsuite/tests/safeHaskell/safeInfered/Mixed01.hs b/testsuite/tests/safeHaskell/safeInfered/Mixed01.hs index cb895fe634..ab3497c6ab 100644 --- a/testsuite/tests/safeHaskell/safeInfered/Mixed01.hs +++ b/testsuite/tests/safeHaskell/safeInfered/Mixed01.hs @@ -1,7 +1,8 @@ -- | Should fail compilation because safe imports aren't enabled +-- not because of trying to import an unsafe module module Mixed01 where -import safe Data.Word +import safe System.IO.Unsafe f :: Int f = 1 diff --git a/testsuite/tests/safeHaskell/safeInfered/Mixed01.stderr b/testsuite/tests/safeHaskell/safeInfered/Mixed01.stderr new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/Mixed01.stderr diff --git a/testsuite/tests/safeHaskell/safeInfered/Mixed02.stderr b/testsuite/tests/safeHaskell/safeInfered/Mixed02.stderr new file mode 100644 index 0000000000..b170a4550d --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/Mixed02.stderr @@ -0,0 +1,3 @@ + +Mixed02.hs:5:1: + Module DW is imported both as a safe and unsafe import! diff --git a/testsuite/tests/safeHaskell/safeInfered/SafeInfered01.hs b/testsuite/tests/safeHaskell/safeInfered/SafeInfered01.hs index 1562a18592..0e48580c98 100644 --- a/testsuite/tests/safeHaskell/safeInfered/SafeInfered01.hs +++ b/testsuite/tests/safeHaskell/safeInfered/SafeInfered01.hs @@ -1,7 +1,7 @@ {-# LANGUAGE Safe #-} module SafeInfered01 where -import safe SafeInfered01_A.hs +import safe SafeInfered01_A g :: Int g = f diff --git a/testsuite/tests/safeHaskell/safeInfered/SafeInfered02_A.hs b/testsuite/tests/safeHaskell/safeInfered/SafeInfered02_A.hs index fff3286de5..57438d2761 100644 --- a/testsuite/tests/safeHaskell/safeInfered/SafeInfered02_A.hs +++ b/testsuite/tests/safeHaskell/safeInfered/SafeInfered02_A.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE DeriveDataTypeable #-} -- | Only uses deriving of Typeable so should be considered safe module SafeInfered02_A where diff --git a/testsuite/tests/safeHaskell/safeInfered/SafeInfered03_A.hs b/testsuite/tests/safeHaskell/safeInfered/SafeInfered03_A.hs index 01c2839cfc..9844ec6525 100644 --- a/testsuite/tests/safeHaskell/safeInfered/SafeInfered03_A.hs +++ b/testsuite/tests/safeHaskell/safeInfered/SafeInfered03_A.hs @@ -2,5 +2,7 @@ -- | FFI but in IO monad so safe module SafeInfered03_A where +import Foreign.C + foreign import ccall "math.h" sin :: CDouble -> IO CDouble diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered01.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered01.stderr new file mode 100644 index 0000000000..15212f3dc9 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered01.stderr @@ -0,0 +1,5 @@ +[1 of 2] Compiling UnsafeInfered01_A ( UnsafeInfered01_A.hs, UnsafeInfered01_A.o ) +[2 of 2] Compiling UnsafeInfered01 ( UnsafeInfered01.hs, UnsafeInfered01.o ) + +UnsafeInfered01.hs:4:1: + main:UnsafeInfered01_A can't be safely imported! The module itself isn't safe. diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered02.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered02.stderr new file mode 100644 index 0000000000..587b8a9a9e --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered02.stderr @@ -0,0 +1,5 @@ +[1 of 2] Compiling UnsafeInfered02_A ( UnsafeInfered02_A.hs, UnsafeInfered02_A.o ) +[2 of 2] Compiling UnsafeInfered02 ( UnsafeInfered02.hs, UnsafeInfered02.o ) + +UnsafeInfered02.hs:4:1: + main:UnsafeInfered02_A can't be safely imported! The module itself isn't safe. diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered03.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered03.stderr new file mode 100644 index 0000000000..f869206b03 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered03.stderr @@ -0,0 +1,5 @@ +[1 of 2] Compiling UnsafeInfered03_A ( UnsafeInfered03_A.hs, UnsafeInfered03_A.o ) +[2 of 2] Compiling UnsafeInfered03 ( UnsafeInfered03.hs, UnsafeInfered03.o ) + +UnsafeInfered03.hs:4:1: + main:UnsafeInfered03_A can't be safely imported! The module itself isn't safe. diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered04.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered04.stderr new file mode 100644 index 0000000000..0db998c6bc --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered04.stderr @@ -0,0 +1,2 @@ + +UnsafeInfered04_A.hs:1:14: Unsupported extension: RULES diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered05.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered05.stderr new file mode 100644 index 0000000000..e08d2ae2fc --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered05.stderr @@ -0,0 +1,5 @@ +[1 of 2] Compiling UnsafeInfered05_A ( UnsafeInfered05_A.hs, UnsafeInfered05_A.o ) +[2 of 2] Compiling UnsafeInfered05 ( UnsafeInfered05.hs, UnsafeInfered05.o ) + +UnsafeInfered05.hs:4:1: + main:UnsafeInfered05_A can't be safely imported! The module itself isn't safe. diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered06.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered06.stderr new file mode 100644 index 0000000000..55f91664e3 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered06.stderr @@ -0,0 +1,5 @@ +[1 of 2] Compiling UnsafeInfered06_A ( UnsafeInfered06_A.hs, UnsafeInfered06_A.o ) +[2 of 2] Compiling UnsafeInfered06 ( UnsafeInfered06.hs, UnsafeInfered06.o ) + +UnsafeInfered06.hs:4:1: + main:UnsafeInfered06_A can't be safely imported! The module itself isn't safe. diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered06_A.hs b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered06_A.hs index f865193a69..1a04b69624 100644 --- a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered06_A.hs +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered06_A.hs @@ -2,5 +2,7 @@ -- | Unsafe as uses FFI with a pure function module UnsafeInfered06_A where +import Foreign.C + foreign import ccall "math.h" sin :: CDouble -> CDouble diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered07.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered07.stderr new file mode 100644 index 0000000000..86c4717dd7 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered07.stderr @@ -0,0 +1,5 @@ +[1 of 2] Compiling UnsafeInfered07_A ( UnsafeInfered07_A.hs, UnsafeInfered07_A.o ) +[2 of 2] Compiling UnsafeInfered07 ( UnsafeInfered07.hs, UnsafeInfered07.o ) + +UnsafeInfered07.hs:4:1: + main:UnsafeInfered07_A can't be safely imported! The module itself isn't safe. diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered07_A.hs b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered07_A.hs index 98e9249876..ffc11597a0 100644 --- a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered07_A.hs +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered07_A.hs @@ -6,5 +6,5 @@ import Data.Typeable data G = G Int instance Typeable G where - typeof _ = typeof (undefined::Int) + typeOf _ = typeOf (undefined::Int) diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered08.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered08.stderr new file mode 100644 index 0000000000..b204c68c0e --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered08.stderr @@ -0,0 +1,5 @@ +[1 of 2] Compiling UnsafeInfered08_A ( UnsafeInfered08_A.hs, UnsafeInfered08_A.o ) +[2 of 2] Compiling UnsafeInfered08 ( UnsafeInfered08.hs, UnsafeInfered08.o ) + +UnsafeInfered08.hs:4:1: + main:UnsafeInfered08_A can't be safely imported! The module itself isn't safe. diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered09.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered09.stderr new file mode 100644 index 0000000000..bb5c92682b --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered09.stderr @@ -0,0 +1,6 @@ +[1 of 3] Compiling UnsafeInfered09_B ( UnsafeInfered09_B.hs, UnsafeInfered09_B.o ) +[2 of 3] Compiling UnsafeInfered09_A ( UnsafeInfered09_A.hs, UnsafeInfered09_A.o ) +[3 of 3] Compiling UnsafeInfered09 ( UnsafeInfered09.hs, UnsafeInfered09.o ) + +UnsafeInfered09.hs:4:1: + main:UnsafeInfered09_A can't be safely imported! The module itself isn't safe. diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.hs b/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.hs index f6fce3b73f..5f1e51c956 100644 --- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.hs +++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE Safe #-} +{-# LANGUAGE TemplateHaskell #-} module Main where import SafeLang12_A diff --git a/testsuite/tests/safeHaskell/unsafeLibs/BadImport05.hs b/testsuite/tests/safeHaskell/unsafeLibs/BadImport05.hs index 137f3b5f31..c6d63842c2 100644 --- a/testsuite/tests/safeHaskell/unsafeLibs/BadImport05.hs +++ b/testsuite/tests/safeHaskell/unsafeLibs/BadImport05.hs @@ -2,7 +2,7 @@ -- | Import unsafe module Foreign.Unsafe to make sure it fails module Main where -import Foreign.Unsafe (unsafePerformIO) +import System.IO.Unsafe (unsafePerformIO) f :: Int f = unsafePerformIO $ putStrLn "What kind of swallow?" >> return 2 diff --git a/testsuite/tests/safeHaskell/unsafeLibs/BadImport07.hs b/testsuite/tests/safeHaskell/unsafeLibs/BadImport07.hs index ea2b6402d3..da0f440a50 100644 --- a/testsuite/tests/safeHaskell/unsafeLibs/BadImport07.hs +++ b/testsuite/tests/safeHaskell/unsafeLibs/BadImport07.hs @@ -5,7 +5,7 @@ module Main where import Unsafe.Coerce f :: Int -f = trace "What kind of swallow?" 2 +f = 2 main :: IO () main = putStrLn $ "X is: " ++ show f diff --git a/testsuite/tests/safeHaskell/unsafeLibs/BadImport08.hs b/testsuite/tests/safeHaskell/unsafeLibs/BadImport08.hs index 0df948ecd6..18c50dfab8 100644 --- a/testsuite/tests/safeHaskell/unsafeLibs/BadImport08.hs +++ b/testsuite/tests/safeHaskell/unsafeLibs/BadImport08.hs @@ -2,10 +2,10 @@ -- | Import unsafe module Control.ST to make sure it fails module Main where -import Control.ST +import Control.Monad.ST f :: Int -f = trace "What kind of swallow?" 2 +f = 2 main :: IO () main = putStrLn $ "X is: " ++ show f diff --git a/testsuite/tests/safeHaskell/unsafeLibs/GoodImport03.stderr b/testsuite/tests/safeHaskell/unsafeLibs/GoodImport03.stderr new file mode 100644 index 0000000000..33d90f9881 --- /dev/null +++ b/testsuite/tests/safeHaskell/unsafeLibs/GoodImport03.stderr @@ -0,0 +1,4 @@ + +GoodImport03.hs:25:1: + Warning: Module `Control.OldException' is deprecated: + Future versions of base will not support the old exceptions style. Please switch to extensible exceptions. |