From 5ccace47a2085e82400e27987a4effd0e2919da0 Mon Sep 17 00:00:00 2001 From: "Wang, Yang" Date: Tue, 28 Jun 2022 10:25:18 +0800 Subject: [PATCH 1/3] Fix the run_tests.py terminated with exception when timeout occurs. Signed-off-by: Wang, Yang --- demos/tests/run_tests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/demos/tests/run_tests.py b/demos/tests/run_tests.py index e05391cd379..2636dd517e0 100755 --- a/demos/tests/run_tests.py +++ b/demos/tests/run_tests.py @@ -333,7 +333,10 @@ def option_to_args(key, value): execution_time = timeit.default_timer() - start_time demo.parse_output(output, test_case, device) except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e: - output = e.output + if type(e) == subprocess.TimeoutExpired: + output = e.output.decode('utf-8') + else: + output = e.output if isinstance(e, subprocess.CalledProcessError): exit_msg = f'Exit code: {e.returncode}\n' elif isinstance(e, subprocess.TimeoutExpired): From f7d7a1dd5d347f69d41a0427525fbe7f6a9fcabc Mon Sep 17 00:00:00 2001 From: "Wang, Yang" Date: Tue, 13 Sep 2022 13:04:14 +0800 Subject: [PATCH 2/3] Update. Signed-off-by: Wang, Yang --- demos/tests/run_tests.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/demos/tests/run_tests.py b/demos/tests/run_tests.py index 2636dd517e0..c82da1f5066 100755 --- a/demos/tests/run_tests.py +++ b/demos/tests/run_tests.py @@ -333,10 +333,9 @@ def option_to_args(key, value): execution_time = timeit.default_timer() - start_time demo.parse_output(output, test_case, device) except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e: - if type(e) == subprocess.TimeoutExpired: + output = e.output + if not isinstance(output, str): output = e.output.decode('utf-8') - else: - output = e.output if isinstance(e, subprocess.CalledProcessError): exit_msg = f'Exit code: {e.returncode}\n' elif isinstance(e, subprocess.TimeoutExpired): From 19f9ff1052723573f676fa6dfbf6eea2ec9d4ceb Mon Sep 17 00:00:00 2001 From: "Wang, Yang" Date: Tue, 13 Sep 2022 13:30:37 +0800 Subject: [PATCH 3/3] Update. Signed-off-by: Wang, Yang --- demos/tests/run_tests.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/demos/tests/run_tests.py b/demos/tests/run_tests.py index c82da1f5066..079af98de3c 100755 --- a/demos/tests/run_tests.py +++ b/demos/tests/run_tests.py @@ -334,14 +334,11 @@ def option_to_args(key, value): demo.parse_output(output, test_case, device) except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e: output = e.output - if not isinstance(output, str): - output = e.output.decode('utf-8') if isinstance(e, subprocess.CalledProcessError): exit_msg = f'Exit code: {e.returncode}\n' elif isinstance(e, subprocess.TimeoutExpired): exit_msg = f'Command timed out after {e.timeout} seconds\n' - output += exit_msg - print(output) + print('{}\n{}'.format(output, exit_msg)) failed_tests.append(test_descr + '\n' + exit_msg) num_failures += 1 execution_time = -1