Commit 39c6c735 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add namebase_if_compiler_lt to the testsuite driver

Allows us to use a different name base for foo.stderr for old compilers, e.g.
test('tc141',
     namebase_if_compiler_lt('ghc', '6.9', 'tc141-6.8'),
     compile_fail,
     [''])
parent de51abf3
...@@ -125,6 +125,10 @@ def getTestRun(): ...@@ -125,6 +125,10 @@ def getTestRun():
class TestOptions: class TestOptions:
def __init__(self): def __init__(self):
# if not None then we look for namebase.stderr etc rather than
# using the test name
self.namebase = None;
# skip this test? # skip this test?
self.skip = 0; self.skip = 0;
......
...@@ -331,6 +331,15 @@ def _expect_fail_ways_if_compiler_lt( opts, compiler, version, ways ): ...@@ -331,6 +331,15 @@ def _expect_fail_ways_if_compiler_lt( opts, compiler, version, ways ):
version_lt(config.compiler_version, version): version_lt(config.compiler_version, version):
opts.expect_fail_for = ways opts.expect_fail_for = ways
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_if_compiler_lt( opts, compiler, version, namebase ):
if config.compiler_type == compiler and \
version_lt(config.compiler_version, version):
opts.namebase = namebase
# --- # ---
def skip_if_tag( tag ): def skip_if_tag( tag ):
...@@ -632,7 +641,12 @@ def do_compile( name, way, should_fail, top_mod, extra_hc_opts ): ...@@ -632,7 +641,12 @@ def do_compile( name, way, should_fail, top_mod, extra_hc_opts ):
# of whether we expected the compilation to fail or not (successful # of whether we expected the compilation to fail or not (successful
# compilations may generate warnings). # compilations may generate warnings).
(platform_specific, expected_stderr_file) = platform_wordsize_qualify(name, 'stderr') if getTestOpts().namebase == None:
namebase = name
else:
namebase = getTestOpts().namebase
(platform_specific, expected_stderr_file) = platform_wordsize_qualify(namebase, 'stderr')
actual_stderr_file = qualify(name, 'comp.stderr') actual_stderr_file = qualify(name, 'comp.stderr')
if not compare_outputs('stderr', normalise_errmsg, normalise_whitespace, \ if not compare_outputs('stderr', normalise_errmsg, normalise_whitespace, \
...@@ -994,8 +1008,13 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ): ...@@ -994,8 +1008,13 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ):
# Utils # Utils
def check_stdout_ok( name ): def check_stdout_ok( name ):
if getTestOpts().namebase == None:
namebase = name
else:
namebase = getTestOpts().namebase
actual_stdout_file = qualify(name, 'run.stdout') actual_stdout_file = qualify(name, 'run.stdout')
(platform_specific, expected_stdout_file) = platform_wordsize_qualify(name, 'stdout') (platform_specific, expected_stdout_file) = platform_wordsize_qualify(namebase, 'stdout')
def norm(str): def norm(str):
if platform_specific: if platform_specific:
...@@ -1011,8 +1030,13 @@ def dump_stdout( name ): ...@@ -1011,8 +1030,13 @@ def dump_stdout( name ):
print read_no_crs(qualify(name, 'run.stdout')) print read_no_crs(qualify(name, 'run.stdout'))
def check_stderr_ok( name ): def check_stderr_ok( name ):
if getTestOpts().namebase == None:
namebase = name
else:
namebase = getTestOpts().namebase
actual_stderr_file = qualify(name, 'run.stderr') actual_stderr_file = qualify(name, 'run.stderr')
(platform_specific, expected_stderr_file) = platform_wordsize_qualify(name, 'stderr') (platform_specific, expected_stderr_file) = platform_wordsize_qualify(namebase, 'stderr')
def norm(str): def norm(str):
if platform_specific: if platform_specific:
......
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