Tools: autotest: correct exception handling on unit test run.

This commit is contained in:
Pierre Kancir 2021-06-12 22:53:52 +02:00 committed by Andrew Tridgell
parent 6c3bae10ed
commit 25d3659cb1

View File

@ -155,7 +155,7 @@ def build_unit_tests(**kwargs):
def run_unit_test(test):
print("Running (%s)" % test)
subprocess.check_call([test])
subprocess.run([test], check=True)
def run_unit_tests():
@ -165,12 +165,17 @@ def run_unit_tests():
))
tests = glob.glob("%s/*" % binary_dir)
success = True
fail_list = []
for test in tests:
try:
run_unit_test(test)
except Exception as e:
print("Exception running (%s): %s" % (test, e.message))
except subprocess.CalledProcessError:
print("Exception running (%s)" % test)
fail_list.append(os.path.basename(test))
success = False
print("Failing tests:")
for failure in fail_list:
print(" %s" % failure)
return success