aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-09 15:43:18 -0700
committeralon@honor <none@none>2010-10-09 15:43:18 -0700
commit069b614367e19e5dca4e70729a0a90032224693e (patch)
treeb5d2d3f12419e1718f4c2f78b943d57d56167cdb
parenteec779fced0cb0e9df260768d90aa0832f7bef1b (diff)
allow test runner to not check timeouts when running code
-rw-r--r--tests/runner.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 28ffc7c7..96f57ef0 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -19,11 +19,12 @@ exec(open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'settings.py'
def timeout_run(proc, timeout, note):
start = time.time()
- while time.time() - start < timeout and proc.poll() is None:
- time.sleep(0.1)
- if proc.poll() is None:
- proc.kill() # XXX bug: killing emscripten.py does not kill it's child process!
- raise Exception("Timed out: " + note)
+ if timeout is not None:
+ while time.time() - start < timeout and proc.poll() is None:
+ time.sleep(0.1)
+ if proc.poll() is None:
+ proc.kill() # XXX bug: killing emscripten.py does not kill it's child process!
+ raise Exception("Timed out: " + note)
return proc.communicate()[0]
class T(unittest.TestCase):
@@ -70,8 +71,8 @@ class T(unittest.TestCase):
output_processor(output)
if output is not None and 'Traceback' in output: print output; assert 0
- def run_generated_code(self, filename, args=[]):
- return timeout_run(Popen([JS_ENGINE] + JS_ENGINE_OPTS + [filename] + args, stdout=PIPE, stderr=STDOUT), 120, 'Execution')
+ def run_generated_code(self, filename, args=[], check_timeout=True):
+ return timeout_run(Popen([JS_ENGINE] + JS_ENGINE_OPTS + [filename] + args, stdout=PIPE, stderr=STDOUT), 120 if check_timeout else None, 'Execution')
## Does a complete test - builds, runs, checks output, etc.
def do_test(self, src, expected_output, args=[], output_nicerizer=None, output_processor=None, no_build=False, main_file=None):