aboutsummaryrefslogtreecommitdiff
path: root/meson_test.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-07-22 23:57:00 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-07-23 22:28:03 +0300
commitfa74ef4c5785453ebdd1aaa1380aa7a632336c5b (patch)
tree6494ce9b4db6ff92ea3a4e3553727d58cfa6e970 /meson_test.py
parent5148972bfe5f4d2012ec29cf913ec8cf5eafd47e (diff)
downloadmeson-fa74ef4c5785453ebdd1aaa1380aa7a632336c5b.zip
meson-fa74ef4c5785453ebdd1aaa1380aa7a632336c5b.tar.gz
meson-fa74ef4c5785453ebdd1aaa1380aa7a632336c5b.tar.bz2
Added timeout kwarg to tests.
Diffstat (limited to 'meson_test.py')
-rwxr-xr-xmeson_test.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/meson_test.py b/meson_test.py
index 452ce74..5dedd01 100755
--- a/meson_test.py
+++ b/meson_test.py
@@ -97,12 +97,21 @@ def run_single_test(wrap, test):
child_env.update(test.env)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=child_env)
- (stdo, stde) = p.communicate()
+ timed_out = False
+ try:
+ (stdo, stde) = p.communicate(timeout=test.timeout)
+ except subprocess.TimeoutExpired:
+ timed_out = True
+ p.kill()
+ (stdo, stde) = p.communicate()
endtime = time.time()
duration = endtime - starttime
stdo = stdo.decode()
stde = stde.decode()
- if (not test.should_fail and p.returncode == 0) or \
+ if timed_out:
+ res = 'TIMEOUT'
+ tests_failed = True
+ elif (not test.should_fail and p.returncode == 0) or \
(test.should_fail and p.returncode != 0):
res = 'OK'
else: