Commit 6e542a62 authored by thomie's avatar thomie
Browse files

Testsuite: add function compile_timeout_multiplier (#10345)

And rename timeout_multiplier to run_timeout_multiplier.

timeout_multiplier was added in commit
a0038979. The name suggested that it
would affect any test, but it actually only affected tests that had a
run component, and only that run component (as needed by test T367).

Differential Revision: https://phabricator.haskell.org/D982
parent 5ddd9041
......@@ -278,7 +278,8 @@ class TestOptions:
self.combined_output = False
# How should the timeout be adjusted on this test?
self.timeout_multiplier = 1.0
self.compile_timeout_multiplier = 1.0
self.run_timeout_multiplier = 1.0
# The default set of options
global default_testopts
......
......@@ -249,11 +249,17 @@ def signal_exit_code( val ):
# -----
def timeout_multiplier( val ):
return lambda name, opts, v=val: _timeout_multiplier(name, opts, v)
def compile_timeout_multiplier( val ):
return lambda name, opts, v=val: _compile_timeout_multiplier(name, opts, v)
def _timeout_multiplier( name, opts, v ):
opts.timeout_multiplier = v
def _compile_timeout_multiplier( name, opts, v ):
opts.compile_timeout_multiplier = v
def run_timeout_multiplier( val ):
return lambda name, opts, v=val: _run_timeout_multiplier(name, opts, v)
def _run_timeout_multiplier( name, opts, v ):
opts.run_timeout_multiplier = v
# -----
......@@ -1256,7 +1262,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf,
'> {errname} 2>&1'
).format(**locals())
result = runCmdFor(name, cmd)
result = runCmdFor(name, cmd, timeout_multiplier=opts.compile_timeout_multiplier)
if result != 0 and not should_fail:
actual_stderr = qualify(name, 'comp.stderr')
......@@ -1338,7 +1344,7 @@ def simple_run( name, way, prog, args ):
cmd = 'cd ' + opts.testdir + ' && ' + cmd
# run the command
result = runCmdFor(name, cmd, timeout_multiplier=opts.timeout_multiplier)
result = runCmdFor(name, cmd, timeout_multiplier=opts.run_timeout_multiplier)
exit_code = result >> 8
signal = result & 0xff
......@@ -1384,6 +1390,8 @@ def rts_flags(way):
# Run a program in the interpreter and check its output
def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ):
opts = getTestOpts()
outname = add_suffix(name, 'interp.stdout')
errname = add_suffix(name, 'interp.stderr')
rm_no_fail(outname)
......@@ -1449,7 +1457,7 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ):
cmd = 'cd ' + getTestOpts().testdir + " && " + cmd
result = runCmdFor(name, cmd, timeout_multiplier=getTestOpts().timeout_multiplier)
result = runCmdFor(name, cmd, timeout_multiplier=opts.run_timeout_multiplier)
exit_code = result >> 8
signal = result & 0xff
......
......@@ -22,8 +22,12 @@ test('conc072', only_ways(['threaded2']), compile_and_run, [''])
test('conc073', normal, compile_and_run, [''])
# vector code must get inlined to become non-allocating
test('T367', [reqlib('vector'), omit_ways(['ghci']), timeout_multiplier(0.001)], compile_and_run, ['-O2 -fno-omit-yields'])
test('T367_letnoescape', [timeout_multiplier(0.02), expect_broken_for(7297,['optllvm'])], compile_and_run, ['-fno-omit-yields'])
test('T367',
[reqlib('vector'), omit_ways(['ghci']), run_timeout_multiplier(0.001)],
compile_and_run, ['-O2 -fno-omit-yields'])
test('T367_letnoescape',
[run_timeout_multiplier(0.02), expect_broken_for(7297,['optllvm'])],
compile_and_run, ['-fno-omit-yields'])
test('T1980', normal, compile_and_run, [''])
test('T2910', normal, compile_and_run, [''])
......
......@@ -84,6 +84,7 @@ test('T984', normal, compile_fail, [''])
test('T7848', normal, compile_fail, ['-dppr-user-length=100'])
test('ExportCommaComma', normal, compile_fail, [''])
test('T8430', literate, compile_fail, [''])
test('T8431', [timeout_multiplier(0.05)], compile_fail, ['-XAlternativeLayoutRule'])
test('T8431', compile_timeout_multiplier(0.05),
compile_fail, ['-XAlternativeLayoutRule'])
test('T8506', normal, compile_fail, [''])
test('T9225', 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