Commit 7d734542 authored by ian@well-typed.com's avatar ian@well-typed.com

Replace 'if_platform' and 'unless_platform' with 'platform'

parent d34f3e85
......@@ -312,17 +312,8 @@ def when(b, f):
def unless(b, f):
return when(not b, f)
def if_platform( plat, f ):
if config.platform == plat:
return f
else:
return normal
def unless_platform( plat, f ):
if config.platform != plat:
return f
else:
return normal
def platform( plat ):
return config.platform == plat
def if_os( os, f ):
if config.os == os:
......
test('memcpy',
unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])
unless(platform('x86_64-unknown-linux'),skip), compile_cmp_asm, [''])
test('memcpy-unroll',
unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])
unless(platform('x86_64-unknown-linux'),skip), compile_cmp_asm, [''])
test('memcpy-unroll-conprop',
unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])
unless(platform('x86_64-unknown-linux'),skip), compile_cmp_asm, [''])
......@@ -33,7 +33,7 @@ test('ffi004', skip, compile_and_run, [''])
#
test('ffi005', [ omit_ways(prof_ways),
if_arch('i386', skip),
if_platform('i386-apple-darwin', expect_broken(4105)),
when(platform('i386-apple-darwin'), expect_broken(4105)),
exit_code(3) ],
compile_and_run, [''])
......
......@@ -38,7 +38,7 @@ test('ghci022', normal, ghci_script, ['ghci022.script'])
test('ghci023', normal, ghci_script, ['ghci023.script'])
test('ghci024',
[skip_if_fast,
if_platform("powerpc-apple-darwin", expect_broken(1845))],
when(platform("powerpc-apple-darwin"), expect_broken(1845))],
run_command,
['$MAKE -s --no-print-directory ghci024'])
test('ghci025', normal, ghci_script, ['ghci025.script'])
......
......@@ -7,7 +7,7 @@ test('arith001', normal, compile_and_run, [''])
test('arith002', normal, compile_and_run, [''])
test('arith003', normal, compile_and_run, [''])
test('arith004', normal, compile_and_run, [''])
test('arith005', if_platform('i386-apple-darwin', expect_broken_for(7043, 'ghci')), compile_and_run, [''])
test('arith005', when(platform('i386-apple-darwin'), expect_broken_for(7043, 'ghci')), compile_and_run, [''])
test('arith006', normal, compile_and_run, [''])
test('arith007', normal, compile_and_run, [''])
......
......@@ -117,7 +117,7 @@ test('T4801',
# 12/11/2012: 49 (amd64/Linux) (REASON UNKNOWN!)
# expected value: 58 (amd64/OS X):
if_platform('x86_64-apple-darwin',
when(platform('x86_64-apple-darwin'),
compiler_stats_range_field('peak_megabytes_allocated', 58, 1)),
# expected value: 228286660 (x86/OS X)
when(wordsize(32),
......@@ -130,7 +130,7 @@ test('T4801',
# 19/10/2012: 392409984 (amd64/Linux) (-fPIC turned off)
# expected value: 510938976 (amd64/OS X):
if_platform('x86_64-apple-darwin',
when(platform('x86_64-apple-darwin'),
compiler_stats_range_field('bytes allocated', 510938976, 5)),
when(wordsize(32),
......@@ -144,7 +144,7 @@ test('T4801',
# 19/10/2012: 26882576 (-fPIC turned on)
# 19/10/2012: 18619912 (-fPIC turned off)
# 24/12/2012: 21657520 (perhaps gc sampling time wibbles?)
if_platform('x86_64-apple-darwin',
when(platform('x86_64-apple-darwin'),
compiler_stats_range_field('max_bytes_used', 21657520, 5)),
only_ways(['normal']),
extra_hc_opts('-static')
......
......@@ -9,7 +9,7 @@ test('testblockalloc', compose(c_src,
test('bug1010', normal, compile_and_run, ['+RTS -c -RTS'])
test('derefnull',
composes([
if_platform('x86_64-unknown-mingw32', expect_broken(6079)),
when(platform('x86_64-unknown-mingw32'), expect_broken(6079)),
# LLVM Optimiser considers dereference of a null pointer
# undefined and marks the code as unreachable which means
# that later optimisations remove it altogether.
......@@ -21,13 +21,13 @@ test('derefnull',
# the right exit code we're OK.
if_os('linux', ignore_output),
# SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
if_platform('i386-apple-darwin', exit_code(138)),
if_platform('powerpc-apple-darwin', exit_code(138)),
when(platform('i386-apple-darwin'), exit_code(138)),
when(platform('powerpc-apple-darwin'), exit_code(138)),
if_os('mingw32', exit_code(1))]),
compile_and_run, [''])
test('divbyzero',
composes([
if_platform('x86_64-unknown-mingw32', expect_broken(6079)),
when(platform('x86_64-unknown-mingw32'), expect_broken(6079)),
# SIGFPE on Linux
exit_code(136),
# Apparently the output can be different on different
......@@ -121,8 +121,8 @@ def config_T5250(name, opts):
test('T5250', [ config_T5250,
# stack ptr is not 16-byte aligned on 32-bit Windows
if_platform('i386-unknown-mingw32', expect_fail),
if_platform('i386-unknown-linux',
when(platform('i386-unknown-mingw32'), expect_fail),
when(platform('i386-unknown-linux'),
expect_broken_for(4211,['llvm'])),
extra_clean(['spalign.o']),
omit_ways(['ghci']) ],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment