From 1e3d53227feb5e21706494f960a69b87eed3df1b Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Wed, 26 Mar 2014 15:53:46 +0100 Subject: fail tests/run.py if any tests fail --- tests/run.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/run.py b/tests/run.py index 6acbd288..b816d7b3 100755 --- a/tests/run.py +++ b/tests/run.py @@ -3,6 +3,7 @@ import getopt import os import platform +import subprocess import sys root = os.path.dirname(__file__) @@ -36,6 +37,7 @@ else: os.environ['LD_LIBRARY_PATH'] = path # run tests +failed = False for test in os.listdir(root): test_path = os.path.join(root, test) if os.path.isdir(test_path): @@ -47,7 +49,15 @@ for test in os.listdir(root): prog = os.path.join(test_path, 'tst_' + test) if not os.path.exists(prog): continue + + cmd = [ prog ] if report_path: - os.system('%s -xunitxml -o %s/%s.xml' % (prog, report_path, test)) - else: - os.system(prog) + cmd += ['-xunitxml', '-o', os.path.join(report_path, test + '.xml') ] + try: + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + failed = True + +# check for failure +if failed: + sys.exit(1) -- cgit v1.2.3