diff options
Diffstat (limited to 'testsuite/tests/safeHaskell/check/pkg01')
32 files changed, 461 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.hs new file mode 100644 index 0000000000..deb0d57f8d --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE Safe #-} +{-# LANGUAGE NoImplicitPrelude #-} +module ImpSafe ( MyWord ) where + +-- While Data.Word is safe it imports trustworthy +-- modules in base, hence base needs to be trusted. +-- Note: Worthwhile giving out better error messages for cases +-- like this if I can. +import Data.Word + +type MyWord = Word + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr new file mode 100644 index 0000000000..9bf0315382 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr @@ -0,0 +1,4 @@ + +ImpSafe01.hs:9:1: + Data.Word: Can't be safely imported! + The package (base) the module resides in isn't trusted. diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe02.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe02.hs new file mode 100644 index 0000000000..deb0d57f8d --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe02.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE Safe #-} +{-# LANGUAGE NoImplicitPrelude #-} +module ImpSafe ( MyWord ) where + +-- While Data.Word is safe it imports trustworthy +-- modules in base, hence base needs to be trusted. +-- Note: Worthwhile giving out better error messages for cases +-- like this if I can. +import Data.Word + +type MyWord = Word + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly01.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly01.hs new file mode 100644 index 0000000000..2143d3139b --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly01.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +module Main where + +import M_SafePkg + +main = do + putStrLn $ show bigInt + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly02.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly02.hs new file mode 100644 index 0000000000..27281b9cce --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly02.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +module Main where + +import M_SafePkg2 + +main = do + putStrLn $ show bigInt + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly03.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly03.hs new file mode 100644 index 0000000000..d09e39937d --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly03.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +module Main where + +import M_SafePkg3 + +main = do + putStrLn $ show bigInt + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly03.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly03.stderr new file mode 100644 index 0000000000..1afb523f9a --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly03.stderr @@ -0,0 +1,4 @@ + +ImpSafeOnly03.hs:4:1: + M_SafePkg3: Can't be safely imported! + The package (safePkg01-1.0) the module resides in isn't trusted. diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly04.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly04.hs new file mode 100644 index 0000000000..d09e39937d --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly04.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +module Main where + +import M_SafePkg3 + +main = do + putStrLn $ show bigInt + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.hs new file mode 100644 index 0000000000..be577d1ccc --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +module Main where + +import M_SafePkg5 + +main = do + putStrLn $ show bigInt + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.stderr new file mode 100644 index 0000000000..28826c8b16 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.stderr @@ -0,0 +1,4 @@ + +ImpSafeOnly05.hs:4:1: + M_SafePkg5: Can't be safely imported! + The package (safePkg01-1.0) the module resides in isn't trusted. diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.stdout b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.stdout new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly05.stdout diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly06.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly06.hs new file mode 100644 index 0000000000..be577d1ccc --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly06.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +module Main where + +import M_SafePkg5 + +main = do + putStrLn $ show bigInt + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.hs new file mode 100644 index 0000000000..975cff482a --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Trustworthy #-} +module Main where + +import Prelude +import safe M_SafePkg6 + +main = putStrLn "test" + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr new file mode 100644 index 0000000000..a22386b7a8 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr @@ -0,0 +1,6 @@ + +<no location info>: + The package (base) is required to be trusted but it isn't! + +<no location info>: + The package (bytestring-0.10.1.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.hs new file mode 100644 index 0000000000..b81abf9ccb --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Trustworthy #-} +module Main where + +import Prelude +import safe M_SafePkg7 + +main = putStrLn "test" + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr new file mode 100644 index 0000000000..a22386b7a8 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr @@ -0,0 +1,6 @@ + +<no location info>: + The package (base) is required to be trusted but it isn't! + +<no location info>: + The package (bytestring-0.10.1.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.hs new file mode 100644 index 0000000000..9311f26a89 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Trustworthy #-} +module Main where + +import Prelude +import safe M_SafePkg8 + +main = putStrLn "test" + diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.stderr new file mode 100644 index 0000000000..4bd2a9ddd3 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.stderr @@ -0,0 +1,3 @@ + +<no location info>: + The package (bytestring-0.10.1.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly10.hs b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly10.hs new file mode 100644 index 0000000000..b81abf9ccb --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly10.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Trustworthy #-} +module Main where + +import Prelude +import safe M_SafePkg7 + +main = putStrLn "test" + diff --git a/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg.hs b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg.hs new file mode 100644 index 0000000000..14c21132e7 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE Safe #-} +module M_SafePkg where + +bigInt :: Int +bigInt = 9 + diff --git a/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg2.hs b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg2.hs new file mode 100644 index 0000000000..74c263f61d --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg2.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE Trustworthy #-} +module M_SafePkg2 where + +bigInt :: Int +bigInt = 9 + diff --git a/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg3.hs b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg3.hs new file mode 100644 index 0000000000..67714c4731 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg3.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +module M_SafePkg3 where + +import qualified M_SafePkg2 as M2 + +bigInt :: Int +bigInt = M2.bigInt + diff --git a/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg4.hs b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg4.hs new file mode 100644 index 0000000000..52367b113b --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg4.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE Safe #-} +module M_SafePkg4 where + +import qualified M_SafePkg3 as M3 +import Data.Word + +bigInt :: Int +bigInt = M3.bigInt + +type MyWord = Word + diff --git a/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg5.hs b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg5.hs new file mode 100644 index 0000000000..a4b7390352 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg5.hs @@ -0,0 +1,14 @@ +-- safe inference +-- same module as M_SafePkg4 which compiles with -XSafe. +-- Want to make sure compiles fine and is infered safe and +-- also picks up corrected pkg trust requirements. +module M_SafePkg5 where + +import qualified M_SafePkg3 as M3 +import Data.Word + +bigInt :: Int +bigInt = M3.bigInt + +type MyWord = Word + diff --git a/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg6.hs b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg6.hs new file mode 100644 index 0000000000..ad10936a69 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg6.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Trustworthy #-} +module M_SafePkg6 where + +import safe Prelude +import safe qualified Data.ByteString.Char8 as BS + +s = BS.pack "Hello World" + diff --git a/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg7.hs b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg7.hs new file mode 100644 index 0000000000..01c5b35995 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg7.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} +module M_SafePkg7 where + +import Prelude +import qualified Data.ByteString.Char8 as BS + +s = BS.pack "Hello World" + diff --git a/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg8.hs b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg8.hs new file mode 100644 index 0000000000..c7a4423496 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/M_SafePkg8.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Trustworthy #-} +module M_SafePkg8 where + +import Prelude +import safe qualified Data.ByteString.Char8 as BS + +s = BS.pack "Hello World" + diff --git a/testsuite/tests/safeHaskell/check/pkg01/Makefile b/testsuite/tests/safeHaskell/check/pkg01/Makefile new file mode 100644 index 0000000000..19e110636e --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/Makefile @@ -0,0 +1,76 @@ +TOP=../../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +cleanPackageDatabase.%: + rm -rf pdb.$* + +HERE := $(abspath .) +$(eval $(call canonicalise,HERE)) + +ifeq "$(GhcDynamicByDefault)" "YES" +HI_SUF = dyn_hi +else +HI_SUF = hi +endif + +mkPackageDatabase.%: + '$(MAKE)' cleanPackageDatabase.$* + mkdir pdb.$* + + '$(TEST_HC)' -outputdir pdb.$* -o pdb.$*/setup Setup.hs -v0 + + '$(GHC_PKG)' init pdb.$*/local.db +# We don't make use of -rtsopts in this test, and if it's enabled then +# we get a warning if dynlibs are enabled by default that: +# Warning: -rtsopts and -with-rtsopts have no effect with -shared. +# so we filter the flag out + pdb.$*/setup configure -v0 --dist pdb.$*/dist --prefix='$(HERE)/pdb.$*/install' --with-compiler='$(TEST_HC)' --ghc-options='$(filter-out -rtsopts,$(TEST_HC_OPTS)) -fpackage-trust -trust base -trust bytestring' --with-hc-pkg='$(GHC_PKG)' --package-db='pdb.$*/local.db' $(VANILLA) $(PROF) $(DYN) + pdb.$*/setup build -v0 --dist pdb.$*/dist + pdb.$*/setup copy -v0 --dist pdb.$*/dist + pdb.$*/setup register -v0 --dist pdb.$*/dist --inplace + +# We use the global package database as there's no easy way to tell +# ghc-pkg (via Cabal) to use one in ., and the global one at least +# won't affect the installed GHC and is more likely to work + +safePkg01_GHC_PKG = '$(GHC_PKG)' --no-user-package-db -f pdb.safePkg01/local.db + +safePkg01: + '$(MAKE)' mkPackageDatabase.safePkg01 + + $(safePkg01_GHC_PKG) list + $(safePkg01_GHC_PKG) field safePkg01-1.0 trusted + echo + echo 'M_SafePkg' + '$(TEST_HC)' --show-iface pdb.safePkg01/dist/build/M_SafePkg.$(HI_SUF) | grep -E '^package dependencies:|^trusted:|^require own pkg trusted:' + echo + echo 'M_SafePkg2' + '$(TEST_HC)' --show-iface pdb.safePkg01/dist/build/M_SafePkg2.$(HI_SUF) | grep -E '^package dependencies:|^trusted:|^require own pkg trusted:' + echo + echo 'M_SafePkg3' + '$(TEST_HC)' --show-iface pdb.safePkg01/dist/build/M_SafePkg3.$(HI_SUF) | grep -E '^package dependencies:|^trusted:|^require own pkg trusted:' + echo + echo 'M_SafePkg4' + '$(TEST_HC)' --show-iface pdb.safePkg01/dist/build/M_SafePkg4.$(HI_SUF) | grep -E '^package dependencies:|^trusted:|^require own pkg trusted:' + echo + echo 'M_SafePkg5' + '$(TEST_HC)' --show-iface pdb.safePkg01/dist/build/M_SafePkg5.$(HI_SUF) | grep -E '^package dependencies:|^trusted:|^require own pkg trusted:' + echo + echo 'M_SafePkg6' + '$(TEST_HC)' --show-iface pdb.safePkg01/dist/build/M_SafePkg6.$(HI_SUF) | grep -E '^package dependencies:|^trusted:|^require own pkg trusted:' + echo + echo 'M_SafePkg7' + '$(TEST_HC)' --show-iface pdb.safePkg01/dist/build/M_SafePkg7.$(HI_SUF) | grep -E '^package dependencies:|^trusted:|^require own pkg trusted:' + echo + echo 'M_SafePkg8' + '$(TEST_HC)' --show-iface pdb.safePkg01/dist/build/M_SafePkg8.$(HI_SUF) | grep -E '^package dependencies:|^trusted:|^require own pkg trusted:' + echo + echo 'Testing setting trust' + $(safePkg01_GHC_PKG) trust safePkg01-1.0 + $(safePkg01_GHC_PKG) field safePkg01-1.0 trusted + $(safePkg01_GHC_PKG) distrust safePkg01-1.0 + $(safePkg01_GHC_PKG) field safePkg01-1.0 trusted + $(safePkg01_GHC_PKG) distrust safePkg01-1.0 + $(safePkg01_GHC_PKG) field safePkg01-1.0 trusted + diff --git a/testsuite/tests/safeHaskell/check/pkg01/Setup.hs b/testsuite/tests/safeHaskell/check/pkg01/Setup.hs new file mode 100644 index 0000000000..6479cb1c16 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/Setup.hs @@ -0,0 +1,4 @@ +import Distribution.Simple + +main = defaultMain + diff --git a/testsuite/tests/safeHaskell/check/pkg01/all.T b/testsuite/tests/safeHaskell/check/pkg01/all.T new file mode 100644 index 0000000000..08f0b61820 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/all.T @@ -0,0 +1,113 @@ +# Just do the normal way, SafeHaskell is all in the frontend +def f( name, opts ): + opts.only_ways = ['normal'] + +def normaliseArrayPackage(str): + return re.sub('array-[0-9]+(\.[0-9]+)*', 'array-<VERSION>', str) + +def normaliseBytestringPackage(str): + return re.sub('bytestring-[0-9]+(\.[0-9]+)*', 'bytestring-<VERSION>', str) + +def ignoreLdOutput(str): + return re.sub('Creating library file: pdb.safePkg01/dist.build.libHSsafePkg01-1.0-ghc[0-9.]*.dll.a\n', '', str) + +setTestOpts(f) + +if config.have_vanilla: + vanilla = '--enable-library-vanilla' +else: + vanilla = '--disable-library-vanilla' + +if config.have_profiling: + prof = '--enable-library-profiling' +else: + prof = '--disable-library-profiling' + +if config.have_shared_libs: + dyn = '--enable-shared' +else: + dyn = '--disable-shared' + +make_args = 'VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn + +# Test building a package, that trust values are set correctly +# and can be changed correctly +test('safePkg01', + [clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.safePkg01'), + normalise_errmsg_fun(ignoreLdOutput), + normalise_fun(two_normalisers(normaliseArrayPackage, + normaliseBytestringPackage))], + run_command, + ['$MAKE -s --no-print-directory safePkg01 ' + make_args]) + +# Fail since we enable package trust +test('ImpSafe01', normal, compile_fail, ['-fpackage-trust -distrust base']) + +# Succeed since we don't enable package trust +test('ImpSafe02', normal, compile, ['-distrust base']) + +test('ImpSafeOnly01', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly01 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly01')], + compile, + ['-fpackage-trust -package-db pdb.ImpSafeOnly01/local.db -trust base']) + +test('ImpSafeOnly02', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly02 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly02')], + compile, + ['-fpackage-trust -package-db pdb.ImpSafeOnly02/local.db -trust base -trust safePkg01']) + +# Fail since we enable package trust (and still need safePkg01 trusted) +test('ImpSafeOnly03', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly03 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly03')], + compile_fail, + ['-fpackage-trust -package-db pdb.ImpSafeOnly03/local.db -trust base']) + +# Succeed since we don't enable package trust +test('ImpSafeOnly04', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly04 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly04')], + compile, + ['-package-db pdb.ImpSafeOnly04/local.db -trust base']) + +# fail due to missing trust of safePkg01, next test succeeds. +test('ImpSafeOnly05', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly05 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly05')], + compile_fail, + ['-fpackage-trust -package-db pdb.ImpSafeOnly05/local.db -trust base']) +test('ImpSafeOnly06', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly06 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly06')], + compile, + ['-fpackage-trust -package-db pdb.ImpSafeOnly06/local.db -trust base -trust safePkg01']) + +# fail due to missing trust +test('ImpSafeOnly07', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly07 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly07'), + normalise_errmsg_fun(normaliseBytestringPackage)], + compile_fail, + ['-fpackage-trust -package-db pdb.ImpSafeOnly07/local.db -trust safePkg01']) +test('ImpSafeOnly08', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly08 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly08'), + normalise_errmsg_fun(normaliseBytestringPackage)], + compile_fail, + ['-fpackage-trust -package-db pdb.ImpSafeOnly08/local.db -trust safePkg01']) +test('ImpSafeOnly09', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly09 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly09'), + normalise_errmsg_fun(normaliseBytestringPackage)], + compile_fail, + ['-fpackage-trust -package-db pdb.ImpSafeOnly09/local.db -trust safePkg01']) + +# finally succeed +test('ImpSafeOnly10', + [pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly10 ' + make_args), + clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly10')], + compile, + ['-fpackage-trust -package-db pdb.ImpSafeOnly10/local.db -trust safePkg01 -trust base -trust bytestring']) + diff --git a/testsuite/tests/safeHaskell/check/pkg01/p.cabal b/testsuite/tests/safeHaskell/check/pkg01/p.cabal new file mode 100644 index 0000000000..358bcb2be4 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/p.cabal @@ -0,0 +1,19 @@ +Name: safePkg01 +Version: 1.0 +Description: SafeHaskell Test Package +License: BSD3 +Build-Type: Simple + +Library { + Build-Depends: base, bytestring + Exposed-Modules: + M_SafePkg + M_SafePkg2 + M_SafePkg3 + M_SafePkg4 + M_SafePkg5 + M_SafePkg6 + M_SafePkg7 + M_SafePkg8 +} + diff --git a/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout b/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout new file mode 100644 index 0000000000..1308a31284 --- /dev/null +++ b/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout @@ -0,0 +1,49 @@ +pdb.safePkg01/local.db: + safePkg01-1.0 + +trusted: False + +M_SafePkg +package dependencies: base* ghc-prim integer-gmp +trusted: safe +require own pkg trusted: False + +M_SafePkg2 +package dependencies: base ghc-prim integer-gmp +trusted: trustworthy +require own pkg trusted: False + +M_SafePkg3 +package dependencies: base* ghc-prim integer-gmp +trusted: safe +require own pkg trusted: True + +M_SafePkg4 +package dependencies: base* ghc-prim integer-gmp +trusted: safe +require own pkg trusted: True + +M_SafePkg5 +package dependencies: base* ghc-prim integer-gmp +trusted: safe-inferred +require own pkg trusted: True + +M_SafePkg6 +package dependencies: array-0.4.0.1 base* bytestring-0.10.1.0* +trusted: trustworthy +require own pkg trusted: False + +M_SafePkg7 +package dependencies: array-0.4.0.1 base* bytestring-0.10.1.0* +trusted: safe +require own pkg trusted: False + +M_SafePkg8 +package dependencies: array-0.4.0.1 base bytestring-0.10.1.0* +trusted: trustworthy +require own pkg trusted: False + +Testing setting trust +trusted: True +trusted: False +trusted: False |