Commit 6a137efe authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Break expect_fail_if_compiler_type and expect_broken_if_compiler_type down

into their component parts
    if_compiler_type
    expect_fail
    expect_broken
parent 2cc10116
......@@ -183,22 +183,6 @@ def _only_compiler_types( opts, compiler_types ):
# -----
def expect_fail_if_compiler_type( compiler_type ):
return lambda opts, c=compiler_type: _expect_fail_if_compiler_type(opts, c)
def _expect_fail_if_compiler_type( opts, compiler_type ):
if config.compiler_type == compiler_type:
opts.expect = 'fail'
def expect_broken_if_compiler_type( bug, compiler_type ):
return lambda opts, b=bug, c=compiler_type: _expect_broken_if_compiler_type(opts, b, c)
def _expect_broken_if_compiler_type( opts, bug, compiler_type ):
if config.compiler_type == compiler_type:
opts.expect = 'fail'
# -----
def set_stdin( file ):
return lambda opts, f=file: _set_stdin(opts, f);
......@@ -260,6 +244,12 @@ def if_os( os, f ):
# ---
def if_compiler_type( compiler, f ):
if config.compiler_type == compiler:
return f
else:
return normal
def if_compiler_lt( compiler, version, f ):
if config.compiler_type == compiler and \
version_lt(config.compiler_version, version):
......
......@@ -33,7 +33,7 @@ clean(['hIsEOF002.out'])
# hReady is broken for files (always returns False) on Unix platforms
# (bug #1063) , but is broken in a different way on Windows (always
# returns True) (bug #1198).
test('hReady001', expect_broken_if_compiler_type(1063, 'ghc'), compile_and_run, ['-cpp'])
test('hReady001', if_compiler_type('ghc', expect_broken(1063)), compile_and_run, ['-cpp'])
test('hSeek001', normal, compile_and_run, [''])
test('hSeek002', normal, compile_and_run, ['-cpp'])
......@@ -61,18 +61,18 @@ test('openFile002', exit_code(1), compile_and_run, [''])
test('openFile003', normal, compile_and_run, [''])
test('openFile004', normal, compile_and_run, [''])
clean(['openFile004.out'])
test('openFile005', compose(expect_fail_if_compiler_type('hugs'),
test('openFile005', compose(if_compiler_type('hugs', expect_fail),
expect_fail_if_windows), compile_and_run, [''])
clean(['openFile005.out1', 'openFile005.out2'])
test('openFile006', normal, compile_and_run, [''])
clean(['openFile006.out'])
test('openFile007', compose(expect_fail_if_compiler_type('hugs'),
test('openFile007', compose(if_compiler_type('hugs', expect_fail),
expect_fail_if_windows), compile_and_run, [''])
clean(['openFile007.out'])
test('openFile008', cmd_prefix('ulimit -n 1024; '), compile_and_run, [''])
test('putStr001', normal, compile_and_run, [''])
test('readFile001', compose(expect_fail_if_compiler_type('hugs'),
test('readFile001', compose(if_compiler_type('hugs', expect_fail),
expect_fail_if_windows), compile_and_run, [''])
clean(['readFile001.out'])
test('readwrite001', normal, compile_and_run, ['-cpp'])
......
......@@ -251,7 +251,7 @@ test('mod150', normal, compile_fail, [''])
test('mod151', normal, compile_fail, [''])
test('mod152', normal, compile_fail, [''])
test('mod153', normal, compile_fail, [''])
test('mod154', expect_fail_if_compiler_type('hugs'), compile, [''])
test('mod154', if_compiler_type('hugs', expect_fail), compile, [''])
test('mod155', normal, compile_fail, [''])
test('mod156', normal, compile, [''])
test('mod157',
......
......@@ -45,8 +45,8 @@ test('read029', normal, compile, [''])
test('read030', normal, compile, [''])
test('read031', normal, compile, [''])
test('read032', normal, compile, [''])
test('read033', expect_fail_if_compiler_type('hugs'), compile, [''])
test('read034', expect_fail_if_compiler_type('hugs'), compile, [''])
test('read033', if_compiler_type('hugs', expect_fail), compile, [''])
test('read034', if_compiler_type('hugs', expect_fail), compile, [''])
test('read036', normal, compile, [''])
test('read037', normal, compile, [''])
test('read038', normal, compile, [''])
......
......@@ -23,7 +23,7 @@ test('read020', normal, compile_fail, [''])
# empty file (length zero) is not a legal Haskell module. It fails to compile
# because it doesn't contain a definition of Main.main. GHC 5.02 crashed
# on this example.
test('read021', expect_fail_if_compiler_type('hugs'), compile_fail, [''])
test('read021', if_compiler_type('hugs', expect_fail), compile_fail, [''])
test('read022', normal, compile_fail, [''])
test('read023', if_compiler_lt('ghc','6.9', namebase('read023-6.8')), compile_fail, [''])
......@@ -32,7 +32,7 @@ test('read025', normal, compile_fail, [''])
test('read026', normal, compile_fail, [''])
# Fails in GHC 6.2+
test('read027', expect_broken_if_compiler_type(1060, 'ghc'), compile_fail, [''])
test('read027', if_compiler_type('ghc', expect_broken(1060)), compile_fail, [''])
test('read028', normal, compile_fail, [''])
test('read029', normal, compile_fail, [''])
......
# exhausts Hugs's heap (CAF leak)
test('life_space_leak', compose(skip_if_fast,expect_fail_if_compiler_type('hugs')),
test('life_space_leak', compose(skip_if_fast, if_compiler_type('hugs', expect_fail)),
multimod_compile_and_run, ['Main', ''])
clean_o_hi()
......@@ -84,7 +84,7 @@ test('tc079', normal, compile, [''])
test('tc080', normal, compile, [''])
test('tc081', normal, compile, [''])
test('tc082', normal, compile, [''])
test('tc084', expect_fail_if_compiler_type('hugs'), compile, [''])
test('tc084', if_compiler_type('hugs', expect_fail), compile, [''])
test('tc085', only_compiler_types(['ghc']), compile, [''])
test('tc086', normal, compile, [''])
test('tc087', normal, compile, ['-fglasgow-exts'])
......@@ -96,7 +96,7 @@ test('tc092', normal, compile, [''])
test('tc093', normal, compile, [''])
test('tc094', normal, compile, [''])
test('tc095', normal, compile, [''])
test('tc096', expect_fail_if_compiler_type('hugs'), compile, [''])
test('tc096', if_compiler_type('hugs', expect_fail), compile, [''])
test('tc097', normal, compile, ['-fglasgow-exts'])
test('tc098', normal, compile, [''])
test('tc099', normal, compile, [''])
......
......@@ -24,7 +24,7 @@ test('tcfail023', normal, compile_fail, [''])
test('tcfail027', normal, compile_fail, [''])
test('tcfail028', normal, compile_fail, [''])
test('tcfail029', normal, compile_fail, [''])
test('tcfail030', expect_fail_if_compiler_type('hugs'), compile_fail, [''])
test('tcfail030', if_compiler_type('hugs', expect_fail), compile_fail, [''])
test('tcfail031', normal, compile_fail, [''])
test('tcfail032', normal, compile_fail, [''])
test('tcfail033', normal, compile_fail, [''])
......@@ -66,7 +66,7 @@ test('tcfail076', normal, compile_fail, [''])
test('tcfail077', normal, compile_fail, [''])
test('tcfail078', normal, compile_fail, [''])
test('tcfail079', only_compiler_types(['ghc']), compile_fail, [''])
test('tcfail080', expect_fail_if_compiler_type('ghc'), compile_fail, ['-fglasgow-exts'])
test('tcfail080', if_compiler_type('ghc', expect_fail), compile_fail, ['-fglasgow-exts'])
test('tcfail082', normal, compile_fail, [''])
test('tcfail083', normal, compile_fail, [''])
test('tcfail084', normal, compile_fail, [''])
......
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