tests: remove extra_files.py (#12223)
[ghc.git] / testsuite / tests / safeHaskell / check / pkg01 / all.T
1 # Just do the normal way, SafeHaskell is all in the frontend
2 def f( name, opts ):
3   opts.only_ways = ['normal']
4
5 def ignoreLdOutput(str):
6     return re.sub('Creating library file: pdb.safePkg01/dist.build.libHSsafePkg01-1.0-ghc[0-9.]*.dll.a\n', '', str)
7
8 setTestOpts(f)
9
10 if config.have_vanilla:
11     vanilla = '--enable-library-vanilla'
12 else:
13     vanilla = '--disable-library-vanilla'
14
15 if config.have_profiling:
16     prof = '--enable-library-profiling'
17 else:
18     prof = '--disable-library-profiling'
19
20 if config.have_shared_libs:
21     dyn = '--enable-shared'
22 else:
23     dyn = '--disable-shared'
24
25 make_args = 'VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn
26
27 # Test building a package, that trust values are set correctly
28 # and can be changed correctly
29 test('safePkg01',
30      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
31       normalise_errmsg_fun(ignoreLdOutput),
32       normalise_version("array", "integer-gmp", "integer-simple", "bytestring",
33                         "base", "deepseq", "ghc-prim")],
34      run_command, ['$MAKE -s --no-print-directory safePkg01 ' + make_args])
35
36 # Fail since we enable package trust
37 test('ImpSafe01', normal, compile_fail, ['-fpackage-trust -distrust base'])
38
39 # Succeed since we don't enable package trust
40 test('ImpSafe02', normal, compile, ['-distrust base'])
41
42 # Fail since we don't trust base of bytestring
43 test('ImpSafe03',
44   [normalise_version("bytestring")],
45   multi_compile_fail,
46   ['ImpSafe03 -trust base -distrust bytestring', [
47    ('ImpSafe03_A.hs', ' -trust base -trust bytestring')
48   ], '-fpackage-trust' ])
49
50 # Fail same as ImpSafe01 but testing with -XTrustworthy now
51 test('ImpSafe04', normal, compile_fail, ['-fpackage-trust -distrust base'])
52
53 test('ImpSafeOnly01',
54      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
55       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly01 ' + make_args)],
56      compile,
57      ['-fpackage-trust -package-db pdb.ImpSafeOnly01/local.db -trust base'])
58
59 test('ImpSafeOnly02',
60      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
61       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly02 ' + make_args)],
62      compile,
63      ['-fpackage-trust -package-db pdb.ImpSafeOnly02/local.db -trust base -trust safePkg01'])
64
65 # Fail since we enable package trust (and still need safePkg01 trusted)
66 test('ImpSafeOnly03',
67      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
68       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly03 ' + make_args)],
69      compile_fail,
70      ['-fpackage-trust -package-db pdb.ImpSafeOnly03/local.db -trust base'])
71
72 # Succeed since we don't enable package trust
73 test('ImpSafeOnly04',
74      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
75       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly04 ' + make_args)],
76      compile, ['-package-db pdb.ImpSafeOnly04/local.db -trust base'])
77
78 # fail due to missing trust of safePkg01, next test succeeds.
79 test('ImpSafeOnly05',
80      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
81       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly05 ' + make_args)],
82      compile_fail,
83      ['-fpackage-trust -package-db pdb.ImpSafeOnly05/local.db -trust base'])
84 test('ImpSafeOnly06',
85      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
86       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly06 ' + make_args)],
87      compile,
88      ['-fpackage-trust -package-db pdb.ImpSafeOnly06/local.db -trust base -trust safePkg01'])
89
90 # fail due to missing trust
91 test('ImpSafeOnly07',
92      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
93       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly07 ' + make_args),
94       normalise_version("bytestring", "base")],
95      compile_fail,
96      ['-fpackage-trust -package-db pdb.ImpSafeOnly07/local.db -trust safePkg01 -distrust bytestring'])
97 test('ImpSafeOnly08',
98      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
99       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly08 ' + make_args),
100       normalise_version("bytestring", "base")],
101      compile_fail,
102      ['-fpackage-trust -package-db pdb.ImpSafeOnly08/local.db -trust safePkg01'])
103 test('ImpSafeOnly09',
104      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
105       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly09 ' + make_args),
106       normalise_version("bytestring")],
107      compile_fail,
108      ['-fpackage-trust -package-db pdb.ImpSafeOnly09/local.db -trust safePkg01'])
109
110 # finally succeed
111 test('ImpSafeOnly10',
112      [extra_files(['M_SafePkg.hs', 'M_SafePkg2.hs', 'M_SafePkg3.hs', 'M_SafePkg4.hs', 'M_SafePkg5.hs', 'M_SafePkg6.hs', 'M_SafePkg7.hs', 'M_SafePkg8.hs', 'Setup.hs', 'p.cabal']),
113       pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly10 ' + make_args)],
114      compile,
115      ['-fpackage-trust -package-db pdb.ImpSafeOnly10/local.db -trust safePkg01 -trust base -trust bytestring'])