[V1] framework/dts: capture exception generated in finnaly sentence

Message ID 20201117091510.7932-1-haiyangx.zhao@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] framework/dts: capture exception generated in finnaly sentence |

Commit Message

Zhao, HaiyangX Nov. 17, 2020, 9:15 a.m. UTC
  if exception raised in execute_tear_downall,
the result will not be saved and DTS will be terminated,
capture the exception to fix it.

Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
 framework/dts.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
  

Comments

Zhao, HaiyangX Nov. 18, 2020, 3:17 a.m. UTC | #1
Tested-by: Haiyang Zhao <haiyangx.zhao@intel.com>

Best Regards,
Zhao Haiyang

> -----Original Message-----
> From: Haiyang Zhao <haiyangx.zhao@intel.com>
> Sent: Tuesday, November 17, 2020 17:15
> To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org
> Cc: Zhao, HaiyangX <haiyangx.zhao@intel.com>
> Subject: [dts][PATCH V1] framework/dts: capture exception generated in
> finnaly sentence
  
Tu, Lijuan Nov. 18, 2020, 3:39 a.m. UTC | #2
> if exception raised in execute_tear_downall, the result will not be saved and
> DTS will be terminated, capture the exception to fix it.
> 
> Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>

Applied
  

Patch

diff --git a/framework/dts.py b/framework/dts.py
index 8a3790e..8c61385 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -486,8 +486,16 @@  def dts_run_suite(duts, tester, test_suites, target, subtitle):
             settings.report_error("GENERIC_ERR")
             log_handler.error(str(e))
         finally:
-            suite_obj.execute_tear_downall()
-            save_all_results()
+            try:
+                suite_obj.execute_tear_downall()
+            except Exception as e:
+                settings.report_error("GENERIC_ERR")
+                log_handler.error(str(e))
+            try:
+                save_all_results()
+            except Exception as e:
+                settings.report_error("GENERIC_ERR")
+                log_handler.error(str(e))
 
 
 def run_all(config_file, pkgName, git, patch, skip_setup,