From 71c1a05d88c9ac84212d164458c5a501e59be389 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 7 Oct 2017 15:49:58 +0300 Subject: [PATCH] tests/run-tests: Close device under test using "finally". We want to close communication object even if there were exceptions somewhere in the code. This is important for --device exec:/execpty: which may otherwise leave processing running in the background. --- tests/run-tests | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/run-tests b/tests/run-tests index 23fc3d9102..6280a5182b 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -492,9 +492,12 @@ def main(): # we need to access feature_check's from the same directory as the # run-tests script itself. base_path = os.path.dirname(sys.argv[0]) or "." - res = run_tests(pyb, tests, args, base_path) - if pyb: - pyb.close() + try: + res = run_tests(pyb, tests, args, base_path) + finally: + if pyb: + pyb.close() + if not res: sys.exit(1)