Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/88d9bcb352f654752d7488d8e134ca3fdd346385 >--------------------------------------------------------------- commit 88d9bcb352f654752d7488d8e134ca3fdd346385 Author: Edward Z. Yang <[email protected]> Date: Tue Sep 25 12:12:26 2012 -0700 Add support for per-test timeout adjustment (timeout_multiplier), and tighten up #367 test. Signed-off-by: Edward Z. Yang <[email protected]> >--------------------------------------------------------------- driver/testglobals.py | 3 +++ driver/testlib.py | 26 ++++++++++++++++++-------- tests/concurrent/should_run/all.T | 4 ++-- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/driver/testglobals.py b/driver/testglobals.py index d7e63d1..3f714f3 100644 --- a/driver/testglobals.py +++ b/driver/testglobals.py @@ -255,6 +255,9 @@ class TestOptions: # Should we redirect stdout and stderr to a single file? self.combined_output = False + # How should the timeout be adjusted on this test? + self.timeout_multiplier = 1.0 + # The default set of options global default_testopts default_testopts = TestOptions() diff --git a/driver/testlib.py b/driver/testlib.py index 7f22ac0..6937f67 100644 --- a/driver/testlib.py +++ b/driver/testlib.py @@ -14,6 +14,7 @@ import traceback import copy import glob import types +import math have_subprocess = False try: @@ -218,6 +219,14 @@ def _exit_code( opts, v ): # ----- +def timeout_multiplier( val ): + return lambda opts, v=val: _timeout_multiplier(opts, v) + +def _timeout_multiplier( opts, v ): + opts.timeout_multiplier = v + +# ----- + def extra_run_opts( val ): return lambda opts, v=val: _extra_run_opts(opts, v); @@ -1176,13 +1185,13 @@ def simple_run( name, way, prog, args ): + stdin_comes_from \ + redirection - if getTestOpts().cmd_wrapper != None: - cmd = getTestOpts().cmd_wrapper(cmd); + if opts.cmd_wrapper != None: + cmd = opts.cmd_wrapper(cmd); - cmd = 'cd ' + getTestOpts().testdir + ' && ' + cmd + cmd = 'cd ' + opts.testdir + ' && ' + cmd # run the command - result = runCmdFor(name, cmd) + result = runCmdFor(name, cmd, timeout_multiplier=opts.timeout_multiplier) exit_code = result >> 8 signal = result & 0xff @@ -1287,7 +1296,7 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ): cmd = 'cd ' + getTestOpts().testdir + " && " + cmd - result = runCmdFor(name, cmd) + result = runCmdFor(name, cmd, timeout_multiplier=getTestOpts().timeout_multiplier) exit_code = result >> 8 signal = result & 0xff @@ -1714,23 +1723,24 @@ def runCmd( cmd ): r = os.system(cmd) return r << 8 -def runCmdFor( name, cmd ): +def runCmdFor( name, cmd, timeout_multiplier=1.0 ): if_verbose( 1, cmd ) r = 0 if config.os == 'mingw32': # On MinGW, we will always have timeout assert config.timeout_prog!='' + timeout = int(math.ceil(config.timeout * timeout_multiplier)) if config.timeout_prog != '': if config.check_files_written: fn = name + ".strace" r = rawSystem(["strace", "-o", fn, "-fF", "-e", "creat,open,chdir,clone,vfork", - config.timeout_prog, str(config.timeout), + config.timeout_prog, str(timeout), cmd]) addTestFilesWritten(name, fn) rm_no_fail(fn) else: - r = rawSystem([config.timeout_prog, str(config.timeout), cmd]) + r = rawSystem([config.timeout_prog, str(timeout), cmd]) else: r = os.system(cmd) return r << 8 diff --git a/tests/concurrent/should_run/all.T b/tests/concurrent/should_run/all.T index c77fa48..4726e32 100644 --- a/tests/concurrent/should_run/all.T +++ b/tests/concurrent/should_run/all.T @@ -22,8 +22,8 @@ test('conc072', only_ways(['threaded2']), compile_and_run, ['']) test('conc073', normal, compile_and_run, ['']) # vector code must get inlined to become non-allocating -test('367', composes([skip_if_fast, expect_fail]), compile_and_run, ['-O2']) -test('367_letnoescape', composes([skip_if_fast, expect_fail]), compile_and_run, ['']) +test('367', composes([skip_if_fast, reqlib('vector'), expect_broken(367), timeout_multiplier(0.001)]), compile_and_run, ['-O2']) +test('367_letnoescape', composes([skip_if_fast, expect_broken(367), timeout_multiplier(0.001)]), compile_and_run, ['']) test('1980', normal, compile_and_run, ['']) test('2910', normal, compile_and_run, ['']) _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
