summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-07 17:54:19 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-07 17:54:19 -0700
commit3e9cc5076060c7e6f65c6bc3539478f073a658b2 (patch)
treec40ed0edd25d061bdb859739e08866357b33e630 /testsuite/tests
parent895dc2fb7dae52f2a4e350b6b7cfd89c301cb9aa (diff)
downloadhaskell-3e9cc5076060c7e6f65c6bc3539478f073a658b2.tar.gz
Fix some issues with safe haskell tests
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check01.hs2
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check01.stderr (renamed from testsuite/tests/ghc-regress/safeHaskell/check/Check01_fail.stderr)0
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check01_A.hs15
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check01_B.hs10
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check01_succeed.stderr1
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check02.hs7
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check02_A.hs16
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check02_B.hs10
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check03.hs9
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check03.stderr3
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check03_A.hs15
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check03_B.hs10
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check04.hs7
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check04.stderr2
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check04_1.hs9
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check04_A.hs15
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/Check04_B.hs10
-rw-r--r--testsuite/tests/ghc-regress/safeHaskell/check/all.T30
18 files changed, 145 insertions, 26 deletions
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check01.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check01.hs
index 1e82846f3a..bd018acb50 100644
--- a/testsuite/tests/ghc-regress/safeHaskell/check/Check01.hs
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check01.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE SafeImports #-}
module Check01 ( main' ) where
-import safe CheckB
+import safe Check01_B
main' = do
let n = mainM 1
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check01_fail.stderr b/testsuite/tests/ghc-regress/safeHaskell/check/Check01.stderr
index 70722f32b8..70722f32b8 100644
--- a/testsuite/tests/ghc-regress/safeHaskell/check/Check01_fail.stderr
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check01.stderr
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check01_A.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check01_A.hs
new file mode 100644
index 0000000000..8b318a5124
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check01_A.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE Trustworthy #-}
+module Check01_A (
+ trace
+ ) where
+
+import qualified Debug.Trace as D
+import qualified Data.ByteString.Lazy.Char8 as BS
+
+-- | Allowed declasification
+trace :: String -> a -> a
+trace s = D.trace $ s ++ show a3
+
+a3 :: BS.ByteString
+a3 = BS.take 3 $ BS.repeat 'a'
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check01_B.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check01_B.hs
new file mode 100644
index 0000000000..b584e51b97
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check01_B.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE Safe #-}
+
+-- Since Safe we require base package be trusted to compile
+module Check01_B where
+
+import Check01_A
+
+mainM :: Int -> Int
+mainM n = trace "Allowed Leak" $ n * 2
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check01_succeed.stderr b/testsuite/tests/ghc-regress/safeHaskell/check/Check01_succeed.stderr
deleted file mode 100644
index 848fdf6a48..0000000000
--- a/testsuite/tests/ghc-regress/safeHaskell/check/Check01_succeed.stderr
+++ /dev/null
@@ -1 +0,0 @@
-[3 of 3] Compiling Check01 ( Check01.hs, Check01.o )
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check02.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check02.hs
index f2f0bc51fc..3f15cb4ba9 100644
--- a/testsuite/tests/ghc-regress/safeHaskell/check/Check02.hs
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check02.hs
@@ -1,8 +1,9 @@
-module Check02 where
+{-# LANGUAGE SafeImports #-}
+module Check02 ( main' ) where
-import CheckB
+import safe Check02_B
-mainN = do
+main' = do
let n = mainM 1
print $ n
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check02_A.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check02_A.hs
new file mode 100644
index 0000000000..d43dab727a
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check02_A.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE Trustworthy #-}
+module Check02_A (
+ trace
+ ) where
+
+import qualified Debug.Trace as D
+import qualified Data.ByteString.Lazy.Char8 as BS
+
+-- | Allowed declasification
+trace :: String -> a -> a
+trace s = D.trace $ s ++ show a3
+
+a3 :: BS.ByteString
+a3 = BS.take 3 $ BS.repeat 'a'
+
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check02_B.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check02_B.hs
new file mode 100644
index 0000000000..10d45ccfbb
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check02_B.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE Safe #-}
+
+-- Since Safe we require base package be trusted to compile
+module Check02_B where
+
+import Check02_A
+
+mainM :: Int -> Int
+mainM n = trace "Allowed Leak" $ n * 2
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check03.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check03.hs
index 20fd042bf9..e06b4f83fb 100644
--- a/testsuite/tests/ghc-regress/safeHaskell/check/Check03.hs
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check03.hs
@@ -1,7 +1,8 @@
-{-# LANGUAGE SafeImports #-}
-module Main ( main ) where
+module Check03 where
-import Check01
+import Check03_B
-main = main'
+mainN = do
+ let n = mainM 1
+ print $ n
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check03.stderr b/testsuite/tests/ghc-regress/safeHaskell/check/Check03.stderr
index 682fa0a7e4..343803f6ff 100644
--- a/testsuite/tests/ghc-regress/safeHaskell/check/Check03.stderr
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check03.stderr
@@ -1,2 +1 @@
-[4 of 4] Compiling Main ( Check03.hs, Check03.o )
-Linking Check03 ...
+[3 of 3] Compiling Check03 ( Check03.hs, Check03.o )
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check03_A.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check03_A.hs
new file mode 100644
index 0000000000..e7b8d75d03
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check03_A.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE Trustworthy #-}
+module Check03_A (
+ trace
+ ) where
+
+import qualified Debug.Trace as D
+import qualified Data.ByteString.Lazy.Char8 as BS
+
+-- | Allowed declasification
+trace :: String -> a -> a
+trace s = D.trace $ s ++ show a3
+
+a3 :: BS.ByteString
+a3 = BS.take 3 $ BS.repeat 'a'
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check03_B.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check03_B.hs
new file mode 100644
index 0000000000..bce45af4e5
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check03_B.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE Safe #-}
+
+-- Since Safe we require base package be trusted to compile
+module Check03_B where
+
+import Check03_A
+
+mainM :: Int -> Int
+mainM n = trace "Allowed Leak" $ n * 2
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check04.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check04.hs
new file mode 100644
index 0000000000..9891de36ee
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check04.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE SafeImports #-}
+module Main ( main ) where
+
+import Check04_1
+
+main = main'
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check04.stderr b/testsuite/tests/ghc-regress/safeHaskell/check/Check04.stderr
new file mode 100644
index 0000000000..ec3bdb1585
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check04.stderr
@@ -0,0 +1,2 @@
+[4 of 4] Compiling Main ( Check04.hs, Check04.o )
+Linking Check04 ...
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check04_1.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check04_1.hs
new file mode 100644
index 0000000000..e823c889d6
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check04_1.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE SafeImports #-}
+module Check04_1 ( main' ) where
+
+import safe Check04_B
+
+main' = do
+ let n = mainM 1
+ print $ n
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check04_A.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check04_A.hs
new file mode 100644
index 0000000000..3f6b5f00e9
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check04_A.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE Trustworthy #-}
+module Check04_A (
+ trace
+ ) where
+
+import qualified Debug.Trace as D
+import qualified Data.ByteString.Lazy.Char8 as BS
+
+-- | Allowed declasification
+trace :: String -> a -> a
+trace s = D.trace $ s ++ show a3
+
+a3 :: BS.ByteString
+a3 = BS.take 3 $ BS.repeat 'a'
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/Check04_B.hs b/testsuite/tests/ghc-regress/safeHaskell/check/Check04_B.hs
new file mode 100644
index 0000000000..5280c51fad
--- /dev/null
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/Check04_B.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE Safe #-}
+
+-- Since Safe we require base package be trusted to compile
+module Check04_B where
+
+import Check04_A
+
+mainM :: Int -> Int
+mainM n = trace "Allowed Leak" $ n * 2
+
diff --git a/testsuite/tests/ghc-regress/safeHaskell/check/all.T b/testsuite/tests/ghc-regress/safeHaskell/check/all.T
index e08ec3caae..2c705b1646 100644
--- a/testsuite/tests/ghc-regress/safeHaskell/check/all.T
+++ b/testsuite/tests/ghc-regress/safeHaskell/check/all.T
@@ -8,29 +8,29 @@ test('CheckA', normal, compile, [''])
test('CheckB', normal, multimod_compile, ['CheckB', '-trust base'])
# fail as we don't trust base when compiling Check01
-test('Check01_fail', normal, multi_compile_fail, ['Check01', [
- ('CheckA.hs', ''),
- ('CheckB.hs', '-trust base')
- ], ''])
+test('Check01', normal, multi_compile_fail, ['Check01', [
+ ('Check01_A.hs', ''),
+ ('Check01_B.hs', '-trust base')
+ ], ''])
# suceed this time since we trust base when we compile AND use CheckB
-test('Check01_succeed', normal, multi_compile, ['Check01', [
- ('CheckA.hs', ''),
- ('CheckB.hs', '')
- ], '-trust base'])
+test('Check02', normal, multi_compile, ['Check02', [
+ ('Check02_A.hs', ''),
+ ('Check02_B.hs', '')
+ ], '-trust base'])
# suceed as while like Check01_fail we don't import CheckB as a safe
# import this time, so don't require base trusted when used.
-test('Check02', normal, multi_compile, ['Check02', [
- ('CheckA.hs', ''),
- ('CheckB.hs', '-trust base')
+test('Check03', normal, multi_compile, ['Check03', [
+ ('Check03_A.hs', ''),
+ ('Check03_B.hs', '-trust base')
], ''])
# Check a slightly larger transitive program. Check01 isn't imported
# safely by Check03 so we don't require base trused at end.
-test('Check03', normal, multi_compile, ['Check03', [
- ('CheckA.hs', ''),
- ('CheckB.hs', '-trust base'),
- ('Check01.hs', '-trust base')
+test('Check04', normal, multi_compile, ['Check04', [
+ ('Check04_A.hs', ''),
+ ('Check04_B.hs', '-trust base'),
+ ('Check04_1.hs', '-trust base')
], ''])