Commit 33d63ccd authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Simplify the testsuite driver

Now instead of saying, e.g.
    namebase_if_compiler_lt('ghc','6.9', 'foo-6.8')
you say
    if_compiler_lt('ghc','6.9', namebase('foo-6.8'))
parent 8eeb9b4d
......@@ -127,7 +127,7 @@ class TestOptions:
# if not None then we look for namebase.stderr etc rather than
# using the test name
self.namebase = None;
self.with_namebase = None;
# skip this test?
self.skip = 0;
......
......@@ -266,79 +266,39 @@ def _skip_if_platform( opts, plat ):
# ---
def expect_broken_if_compiler_ge( bug, compiler, version ):
return lambda opts, c=compiler, v=version: \
_expect_fail_if_compiler_ge(opts, c, v)
def expect_fail_if_compiler_ge( compiler, version ):
return lambda opts, c=compiler, v=version: \
_expect_fail_if_compiler_ge(opts, c, v)
def _expect_fail_if_compiler_ge( opts, compiler, version ):
def if_compiler_lt( compiler, version, f ):
if config.compiler_type == compiler and \
version_ge(config.compiler_version, version):
opts.expect = 'fail'
def expect_broken_if_compiler_gt( bug, compiler, version ):
return lambda opts, c=compiler, v=version: \
_expect_fail_if_compiler_gt(opts, c, v)
def expect_fail_if_compiler_gt( compiler, version ):
return lambda opts, c=compiler, v=version: \
_expect_fail_if_compiler_gt(opts, c, v)
def _expect_fail_if_compiler_gt( opts, compiler, version ):
if config.compiler_type == compiler and \
version_gt(config.compiler_version, version):
opts.expect = 'fail'
def expect_broken_if_compiler_le( bug, compiler, version ):
return lambda opts, c=compiler, v=version: \
_expect_fail_if_compiler_le(opts, c, v)
def expect_fail_if_compiler_le( compiler, version ):
return lambda opts, c=compiler, v=version: \
_expect_fail_if_compiler_le(opts, c, v)
version_lt(config.compiler_version, version):
return f
else:
return normal
def _expect_fail_if_compiler_le( opts, compiler, version ):
def if_compiler_le( compiler, version, f ):
if config.compiler_type == compiler and \
version_le(config.compiler_version, version):
opts.expect = 'fail'
def expect_broken_if_compiler_lt( bug, compiler, version ):
return lambda opts, c=compiler, v=version: \
_expect_fail_if_compiler_lt(opts, c, v)
def expect_fail_if_compiler_lt( compiler, version ):
return lambda opts, c=compiler, v=version: \
_expect_fail_if_compiler_lt(opts, c, v)
return f
else:
return normal
def _expect_fail_if_compiler_lt( opts, compiler, version ):
def if_compiler_gt( compiler, version, f ):
if config.compiler_type == compiler and \
version_lt(config.compiler_version, version):
opts.expect = 'fail'
def expect_broken_ways_if_compiler_lt( bug, compiler, version, ways ):
return lambda opts, c=compiler, v=version, w=ways: \
_expect_fail_ways_if_compiler_lt(opts, c, v, w)
def expect_fail_ways_if_compiler_lt( compiler, version, ways ):
return lambda opts, c=compiler, v=version, w=ways: \
_expect_fail_ways_if_compiler_lt(opts, c, v, w)
version_gt(config.compiler_version, version):
return f
else:
return normal
def _expect_fail_ways_if_compiler_lt( opts, compiler, version, ways ):
def if_compiler_ge( compiler, version, f ):
if config.compiler_type == compiler and \
version_lt(config.compiler_version, version):
opts.expect_fail_for = ways
version_ge(config.compiler_version, version):
return f
else:
return normal
def namebase_if_compiler_lt( compiler, version, namebase ):
return lambda opts, c=compiler, v=version, nb=namebase: \
_namebase_if_compiler_lt(opts, c, v, nb)
def namebase( nb ):
return lambda opts, nb=nb: _namebase(opts, nb)
def _namebase_if_compiler_lt( opts, compiler, version, namebase ):
if config.compiler_type == compiler and \
version_lt(config.compiler_version, version):
opts.namebase = namebase
def _namebase( opts, nb ):
opts.with_namebase = nb
# ---
......@@ -356,15 +316,6 @@ def _skip_unless_tag( opts, tag ):
if not (tag in config.compiler_tags):
opts.skip = 1
def skip_if_compiler_lt( compiler, version ):
return lambda opts, c=compiler, v=version: \
_skip_if_compiler_lt(opts, c, v)
def _skip_if_compiler_lt( opts, compiler, version ):
if config.compiler_type == compiler and \
version_lt(config.compiler_version, version):
opts.skip = 1
# ---
def alone(opts):
opts.alone = 1
......@@ -658,10 +609,10 @@ def do_compile( name, way, should_fail, top_mod, extra_hc_opts ):
# of whether we expected the compilation to fail or not (successful
# compilations may generate warnings).
if getTestOpts().namebase == None:
if getTestOpts().with_namebase == None:
namebase = name
else:
namebase = getTestOpts().namebase
namebase = getTestOpts().with_namebase
(platform_specific, expected_stderr_file) = platform_wordsize_qualify(namebase, 'stderr')
actual_stderr_file = qualify(name, 'comp.stderr')
......@@ -1019,10 +970,10 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ):
# Utils
def check_stdout_ok( name ):
if getTestOpts().namebase == None:
if getTestOpts().with_namebase == None:
namebase = name
else:
namebase = getTestOpts().namebase
namebase = getTestOpts().with_namebase
actual_stdout_file = qualify(name, 'run.stdout')
(platform_specific, expected_stdout_file) = platform_wordsize_qualify(namebase, 'stdout')
......@@ -1041,10 +992,10 @@ def dump_stdout( name ):
print read_no_crs(qualify(name, 'run.stdout'))
def check_stderr_ok( name ):
if getTestOpts().namebase == None:
if getTestOpts().with_namebase == None:
namebase = name
else:
namebase = getTestOpts().namebase
namebase = getTestOpts().with_namebase
actual_stderr_file = qualify(name, 'run.stderr')
(platform_specific, expected_stderr_file) = platform_wordsize_qualify(namebase, 'stderr')
......
......@@ -3,12 +3,12 @@ setTestOpts(only_compiler_types(['ghc']))
test('arrowrun001', expect_broken_for(1333, ['ghci']), compile_and_run, [''])
test('arrowrun002', composes([expect_broken_for(1333, ['ghci']),
skip_if_fast,
skip_if_compiler_lt('ghc','6.9')])
if_compiler_lt('ghc', '6.9', skip)])
, compile_and_run, [''])
test('arrowrun003',
compose(expect_broken_for(1333, ['ghci']),
skip_if_compiler_lt('ghc','6.9')),
if_compiler_lt('ghc', '6.9', skip)),
compile_and_run, [''])
test('arrowrun004', compose(skip_if_fast,
skip_if_compiler_lt('ghc','6.9'))
if_compiler_lt('ghc', '6.9', skip))
, compile_and_run, [''])
......@@ -25,7 +25,7 @@ clean(['Gadt17_help.hi', 'Gadt17_help.o'])
test('gadt18', normal, compile, [''])
test('gadt19', normal, compile, [''])
test('gadt20', normal, compile, [''])
test('gadt21', namebase_if_compiler_lt('ghc','6.9', 'gadt21-6.8'),
test('gadt21', if_compiler_lt('ghc','6.9', namebase('gadt21-6.8')),
compile_fail, [''])
test('gadt22', normal, compile, [''])
......@@ -39,11 +39,11 @@ test('type-rep', skip_if_fast, compile_and_run, [''])
test('equal', normal, compile, [''])
test('nbe', normal, compile, [''])
test('while', normal, compile_and_run, [''])
test('rw', namebase_if_compiler_lt('ghc','6.9', 'rw-6.8'), compile_fail, [''])
test('rw', if_compiler_lt('ghc','6.9', namebase('rw-6.8')), compile_fail, [''])
test('lazypat', normal, compile_fail, [''])
test('lazypatok', expect_fail, compile, [''])
test('tc', normal, compile_and_run, [''])
test('arrow', skip_if_compiler_lt('ghc','6.9'), compile, [''])
test('arrow', if_compiler_lt('ghc', '6.9', skip), compile, [''])
test('tdpe', normal, compile, [''])
test('Nilsson', skip_if_fast, compile, [''])
......
......@@ -26,12 +26,12 @@ test('print024', normal, ghci_script, ['print024.script'])
test('print025', normal, ghci_script, ['print025.script'])
test('print026', normal, ghci_script, ['print026.script'])
test('print027', normal, ghci_script, ['print027.script'])
test('print028', namebase_if_compiler_lt('ghc','6.9', 'print028-6.8'), ghci_script, ['print028.script'])
test('print028', if_compiler_lt('ghc','6.9', namebase('print028-6.8')), ghci_script, ['print028.script'])
test('break001', normal, ghci_script, ['break001.script'])
test('break002', normal, ghci_script, ['break002.script'])
test('break003', namebase_if_compiler_lt('ghc','6.9', 'break003-6.8'), ghci_script, ['break003.script'])
test('break003', if_compiler_lt('ghc','6.9', namebase('break003-6.8')), ghci_script, ['break003.script'])
test('break005', normal, ghci_script, ['break005.script'])
test('break006', normal, ghci_script, ['break006.script'])
test('break007', normal, ghci_script, ['break007.script'])
......@@ -48,7 +48,7 @@ test('break017', skip_if_fast, ghci_script, ['break017.script'])
test('break018', normal, ghci_script, ['break018.script'])
test('break019', normal, ghci_script, ['break019.script'])
test('break020', normal, ghci_script, ['break020.script'])
test('break021', namebase_if_compiler_lt('ghc','6.9', 'break021-6.8'), ghci_script, ['break021.script'])
test('break021', if_compiler_lt('ghc','6.9', namebase('break021-6.8')), ghci_script, ['break021.script'])
test('break024', normal, ghci_script, ['break024.script'])
test('break025', normal, ghci_script, ['break025.script'])
test('break026', normal, ghci_script, ['break026.script'])
......
......@@ -12,7 +12,7 @@ test('Simple8', expect_fail, compile, [''])
test('Simple9', normal, compile, [''])
test('Simple10', normal, compile, [''])
test('Simple11', normal, compile, [''])
test('Simple12', expect_fail_if_compiler_lt('ghc','6.9'), compile, [''])
test('Simple12', if_compiler_lt('ghc','6.9',expect_fail), compile, [''])
test('Simple13', normal, compile, [''])
test('Simple14', expect_fail, compile, [''])
test('Simple15', normal, compile, [''])
......@@ -50,14 +50,14 @@ test('Kind', normal, compile, [''])
test('GADT1', expect_fail, compile, [''])
test('GADT2', normal, compile, [''])
test('GADT3', expect_fail, compile, [''])
test('GADT4', expect_fail_if_compiler_lt('ghc','6.9'), compile, [''])
test('GADT5', expect_fail_if_compiler_lt('ghc','6.9'), compile, [''])
test('GADT6', expect_fail_if_compiler_lt('ghc','6.9'), compile, [''])
test('GADT4', if_compiler_lt('ghc', '6.9', expect_fail), compile, [''])
test('GADT5', if_compiler_lt('ghc', '6.9', expect_fail), compile, [''])
test('GADT6', if_compiler_lt('ghc', '6.9', expect_fail), compile, [''])
test('GADT7', expect_fail, compile, [''])
test('GADT8', normal, compile, [''])
test('GADT9', normal, compile, [''])
test('GADT10', expect_fail, compile, [''])
test('GADT11', expect_fail_if_compiler_lt('ghc','6.9'), compile, [''])
test('GADT11', if_compiler_lt('ghc', '6.9', expect_fail), compile, [''])
test('GADT12', expect_fail, compile, [''])
test('Class1', normal, compile, [''])
......@@ -81,7 +81,7 @@ test('ColInference5', normal, compile, [''])
test('ColInference6', normal, compile, [''])
test('ClassEqContext', normal, compile, [''])
test('ClassEqContext2', expect_fail_if_compiler_lt('ghc','6.9'), compile, [''])
test('ClassEqContext2', if_compiler_lt('ghc','6.9',expect_fail), compile, [''])
test('ClassEqContext3', normal, compile, [''])
test('Col', normal, compile, [''])
......
......@@ -27,7 +27,7 @@ test('TyFamArity1', normal, compile_fail, [''])
test('TyFamArity2', normal, compile_fail, [''])
test('TyFamUndec', normal, compile_fail, [''])
test('GADTwrong1', expect_fail_if_compiler_lt('ghc','6.9'), compile_fail, [''])
test('GADTwrong1', if_compiler_lt('ghc', '6.9', expect_fail), compile_fail, [''])
test('Over', normal, multimod_compile_fail, ['OverD', '-no-hs-main -no-link'])
clean(['OverA.hi', 'OverA.o', 'OverB.hi', 'OverB.o', 'OverC.hi', 'OverC.o'])
......@@ -26,7 +26,7 @@ test('read020', normal, compile_fail, [''])
test('read021', expect_fail_if_compiler_type('hugs'), compile_fail, [''])
test('read022', normal, compile_fail, [''])
test('read023', namebase_if_compiler_lt('ghc','6.9', 'read023-6.8'), compile_fail, [''])
test('read023', if_compiler_lt('ghc','6.9', namebase('read023-6.8')), compile_fail, [''])
test('read024', normal, compile_fail, [''])
test('read025', normal, compile_fail, [''])
test('read026', normal, compile_fail, [''])
......
......@@ -14,5 +14,5 @@ test('rebindable4', normal, compile_and_run, [''])
test('rebindable5', normal, compile_and_run, [''])
test('rebindable6', normal, compile_and_run, [''])
test('rebindable7', normal, compile_and_run, [''])
test('rebindable8', expect_broken_if_compiler_lt(1537, 'ghc', '6.9'),
test('rebindable8', if_compiler_lt('ghc', '6.9', expect_broken(1537)),
compile, [''])
......@@ -15,7 +15,7 @@ test('rnfail015', normal, compile_fail, [''])
test('rnfail016', normal, compile_fail, [''])
test('rnfail017', normal, compile_fail, [''])
test('rnfail018', normal, compile_fail, [''])
test('rnfail019', namebase_if_compiler_lt('ghc','6.9', 'rnfail019-6.8'), compile_fail, [''])
test('rnfail019', if_compiler_lt('ghc','6.9', namebase('rnfail019-6.8')), compile_fail, [''])
test('rnfail020', normal, compile, ['']) # Succeeds now (Jan07)
test('rnfail021', normal, compile_fail, [''])
test('rnfail022', normal, compile_fail, [''])
......
......@@ -65,10 +65,10 @@ test('TH_where', normal, compile_and_run, [''])
test('TH_spliceInst', normal, compile, ['-v0'])
test('TH_exn1', namebase_if_compiler_lt('ghc','6.9', 'TH_exn1-6.8'), compile_fail, ['-v0'])
test('TH_exn1', if_compiler_lt('ghc','6.9', namebase('TH_exn1-6.8')), compile_fail, ['-v0'])
test('TH_dupdecl', normal, compile_fail, ['-v0'])
test('TH_exn2', namebase_if_compiler_lt('ghc','6.9', 'TH_exn2-6.8'), compile_fail, ['-v0'])
test('TH_exn2', if_compiler_lt('ghc','6.9', namebase('TH_exn2-6.8')), compile_fail, ['-v0'])
test('TH_recover', normal, compile_and_run, [''])
test('TH_dataD1', normal, compile_fail, ['-v0'])
......@@ -76,6 +76,6 @@ test('TH_dataD1', normal, compile_fail, ['-v0'])
test('TH_ppr1', normal, compile_and_run, ['-fglasgow-exts'])
test('TH_fail', normal, compile_fail, ['-v0'])
test('TH_runIO', namebase_if_compiler_lt('ghc','6.9', 'TH_runIO-6.8'), compile_fail, ['-v0'])
test('TH_runIO', if_compiler_lt('ghc','6.9', namebase('TH_runIO-6.8')), compile_fail, ['-v0'])
test('TH_ghci1', normal, ghci_script, ['TH_ghci1.script'])
......@@ -141,7 +141,7 @@ test('tc135', only_compiler_types(['ghc']), compile, [''])
test('tc136', normal, compile, [''])
test('tc137', normal, compile, [''])
test('tc140', normal, compile, [''])
test('tc141', namebase_if_compiler_lt('ghc','6.9', 'tc141-6.8'), compile_fail, [''])
test('tc141', if_compiler_lt('ghc','6.9', namebase('tc141-6.8')), compile_fail, [''])
test('tc142', normal, compile, [''])
test('tc143', normal, compile, [''])
test('tc144', omit_compiler_types(['hugs']), compile, ['']) # Hugs loops
......@@ -248,7 +248,7 @@ test('tc232', reqlib('mtl'), compile, [''])
test('tc233', normal, compile, [''])
test('tc234', normal, compile, [''])
test('tc235', normal, compile, [''])
test('tc236', expect_fail_if_compiler_lt('ghc', '6.9'), compile, [''])
test('tc236', if_compiler_lt('ghc', '6.9', expect_fail), compile, [''])
test('tc237', normal, compile, [''])
test('tc238', normal, compile, [''])
......
......@@ -54,7 +54,7 @@ test('tcfail061', normal, compile_fail, [''])
test('tcfail062', normal, compile_fail, [''])
test('tcfail063', normal, compile_fail, [''])
test('tcfail065', normal, compile_fail, [''])
test('tcfail067', namebase_if_compiler_lt('ghc','6.9', 'tcfail067-6.8'), compile_fail, [''])
test('tcfail067', if_compiler_lt('ghc','6.9', namebase('tcfail067-6.8')), compile_fail, [''])
test('tcfail068', only_compiler_types(['ghc']), compile_fail, ['-fglasgow-exts'])
test('tcfail069', normal, compile_fail, [''])
test('tcfail070', normal, compile_fail, [''])
......@@ -109,9 +109,9 @@ test('tcfail121', normal, compile_fail, [''])
test('tcfail122', only_compiler_types(['ghc']), compile_fail, [''])
test('tcfail123', only_compiler_types(['ghc']), compile_fail, [''])
test('tcfail124', compose(only_compiler_types(['ghc']),
namebase_if_compiler_lt('ghc','6.9', 'tcfail124-6.8')),
if_compiler_lt('ghc','6.9', namebase('tcfail124-6.8'))),
compile_fail, [''])
test('tcfail125', namebase_if_compiler_lt('ghc','6.9', 'tcfail125-6.8'), compile_fail, [''])
test('tcfail125', if_compiler_lt('ghc','6.9', namebase('tcfail125-6.8')), compile_fail, [''])
test('tcfail126', reqlib('mtl'), compile_fail, [''])
test('tcfail127', normal, compile_fail, [''])
test('tcfail128', normal, compile_fail, [''])
......@@ -153,8 +153,8 @@ test('tcfail163', normal, compile_fail, [''])
test('tcfail164', normal, compile_fail, [''])
test('tcfail165', normal, compile, ['']) # Succeeds now!
test('tcfail166', normal, compile_fail, [''])
test('tcfail167', namebase_if_compiler_lt('ghc','6.9', 'tcfail167-6.8'), compile_fail, [''])
test('tcfail168', namebase_if_compiler_lt('ghc','6.9', 'tcfail168-6.8'), compile_fail, [''])
test('tcfail167', if_compiler_lt('ghc','6.9', namebase('tcfail167-6.8')), compile_fail, [''])
test('tcfail168', if_compiler_lt('ghc','6.9', namebase('tcfail168-6.8')), compile_fail, [''])
test('tcfail169', normal, compile_fail, [''])
test('tcfail170', normal, compile_fail, [''])
test('tcfail171', normal, compile_fail, [''])
......@@ -164,7 +164,7 @@ test('tcfail174', normal, compile_fail, [''])
test('tcfail175', normal, compile_fail, [''])
test('tcfail176', normal, compile_fail, [''])
test('tcfail177', expect_broken(1176), compile_fail, [''])
test('tcfail178', namebase_if_compiler_lt('ghc','6.9', 'tcfail178-6.8'), compile_fail, [''])
test('tcfail178', if_compiler_lt('ghc','6.9', namebase('tcfail178-6.8')), compile_fail, [''])
test('tcfail179', normal, compile_fail, [''])
test('tcfail180', normal, compile_fail, [''])
test('tcfail181', normal, compile_fail, [''])
......@@ -175,5 +175,5 @@ test('tcfail185', normal, compile_fail, [''])
test('tcfail186',
extra_clean(['Tcfail186_Help.hi', 'Tcfail186_Help.o']),
multimod_compile_fail, ['tcfail186', '-v0'])
test('tcfail187', namebase_if_compiler_lt('ghc','6.9', 'tcfail187-6.8'), compile_fail, [''])
test('tcfail187', if_compiler_lt('ghc','6.9', namebase('tcfail187-6.8')), compile_fail, [''])
test('tcfail188', 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