comparison tests/run-tests.py @ 8116:c11636f0609e

run-tests: fix error when timeout occurs
author Simon Heimberg <simohe@besonet.ch>
date Wed, 22 Apr 2009 09:11:46 +0200
parents 0eeb4f0a5d21
children 1bb8a75fceb3
comparison
equal deleted inserted replaced
8115:ccf20c92534b 8116:c11636f0609e
303 pass 303 pass
304 304
305 def alarmed(signum, frame): 305 def alarmed(signum, frame):
306 raise Timeout 306 raise Timeout
307 307
308 def run(cmd): 308 def run(cmd, options):
309 """Run command in a sub-process, capturing the output (stdout and stderr). 309 """Run command in a sub-process, capturing the output (stdout and stderr).
310 Return the exist code, and output.""" 310 Return the exist code, and output."""
311 # TODO: Use subprocess.Popen if we're running on Python 2.4 311 # TODO: Use subprocess.Popen if we're running on Python 2.4
312 if os.name == 'nt' or sys.platform.startswith('java'): 312 if os.name == 'nt' or sys.platform.startswith('java'):
313 tochild, fromchild = os.popen4(cmd) 313 tochild, fromchild = os.popen4(cmd)
409 409
410 if options.timeout > 0: 410 if options.timeout > 0:
411 signal.alarm(options.timeout) 411 signal.alarm(options.timeout)
412 412
413 vlog("# Running", cmd) 413 vlog("# Running", cmd)
414 ret, out = run(cmd) 414 ret, out = run(cmd, options)
415 vlog("# Ret was:", ret) 415 vlog("# Ret was:", ret)
416 416
417 if options.timeout > 0: 417 if options.timeout > 0:
418 signal.alarm(0) 418 signal.alarm(0)
419 419