all.T 2.34 KB
Newer Older
dterei's avatar
dterei committed
1 2 3 4 5 6
# Just do the normal way, SafeHaskell is all in the frontend
def f( opts ):
  opts.only_ways = ['normal']

setTestOpts(f)

7 8 9 10 11
if config.have_vanilla:
    vanilla = '--enable-library-vanilla'
else:
    vanilla = '--disable-library-vanilla'

dterei's avatar
dterei committed
12 13 14
if config.have_profiling:
    prof = '--enable-library-profiling'
else:
15 16 17 18 19 20
    prof = '--disable-library-profiling'

if config.have_shared_libs:
    dyn = '--enable-shared'
else:
    dyn = '--disable-shared'
dterei's avatar
dterei committed
21

22 23
# Test building a package, that trust values are set correctly
# and can be changed correctly
dterei's avatar
dterei committed
24
test('safePkg01',
25 26 27
     [# TODO: The other tests in here depend on this one not being cleaned
      # clean_cmd('$MAKE -s --no-print-directory cleanSafePkg01'),
      alone],
dterei's avatar
dterei committed
28
     run_command, 
29
     ['$MAKE -s --no-print-directory safePkg01 VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn])
dterei's avatar
dterei committed
30

31 32 33 34 35
# 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'])
dterei's avatar
dterei committed
36

dterei's avatar
dterei committed
37
test('ImpSafeOnly01', [normal, alone], compile, ['-fpackage-trust -package-db local.db -trust base'])
dterei's avatar
dterei committed
38

dterei's avatar
dterei committed
39
test('ImpSafeOnly02', [normal, alone], compile, ['-fpackage-trust -package-db local.db -trust base -trust safePkg01'])
dterei's avatar
dterei committed
40

dterei's avatar
dterei committed
41
# Fail since we enable package trust (and still need safePkg01 trusted)
42
test('ImpSafeOnly03', [normal, alone], compile_fail, ['-fpackage-trust -package-db local.db -trust base'])
43 44

# Succeed since we don't enable package trust
45
test('ImpSafeOnly04', [normal, alone], compile, ['-package-db local.db -trust base'])
dterei's avatar
dterei committed
46

dterei's avatar
dterei committed
47 48 49 50 51 52 53 54 55 56 57 58
# fail due to missing trust of safePkg01, next test succeeds.
test('ImpSafeOnly05', [normal, alone], compile_fail, ['-fpackage-trust -package-db local.db -trust base'])
test('ImpSafeOnly06', [normal, alone], compile, ['-fpackage-trust -package-db local.db -trust base -trust safePkg01'])

# fail due to missing trust
test('ImpSafeOnly07', [normal, alone], compile_fail, ['-fpackage-trust -package-db local.db -trust safePkg01'])
test('ImpSafeOnly08', [normal, alone], compile_fail, ['-fpackage-trust -package-db local.db -trust safePkg01'])
test('ImpSafeOnly09', [normal, alone], compile_fail, ['-fpackage-trust -package-db local.db -trust safePkg01'])

# finally succeed
test('ImpSafeOnly10', [normal, alone], compile, ['-fpackage-trust -package-db local.db -trust safePkg01 -trust base -trust bytestring'])