From f3bb8e135a67f9aa5556b09ca8cfe58389962686 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Fri, 16 Mar 2018 17:44:28 +0000 Subject: [PATCH] fw/execution: record UI state on error Record UI state if an error occurs during setup, run, and output processing stages (for other stages, the UI state is unlikely to be relevant as they typically would not include UI manipulation). --- wa/framework/execution.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/wa/framework/execution.py b/wa/framework/execution.py index 7a8504d3..b8fb19a6 100644 --- a/wa/framework/execution.py +++ b/wa/framework/execution.py @@ -500,8 +500,16 @@ class Runner(object): with signal.wrap('JOB_TARGET_CONFIG', self, context): job.configure_target(context) - with signal.wrap('JOB_SETUP', self, context): - job.setup(context) + try: + with signal.wrap('JOB_SETUP', self, context): + job.setup(context) + except Exception as e: + job.set_status(Status.FAILED) + log.log_error(e, self.logger) + if isinstance(e, TargetError) or isinstance(e, TimeoutError): + context.tm.verify_target_responsive() + self.context.record_ui_state('setup-error') + raise e try: @@ -517,6 +525,7 @@ class Runner(object): log.log_error(e, self.logger) if isinstance(e, TargetError) or isinstance(e, TimeoutError): context.tm.verify_target_responsive() + self.context.record_ui_state('run-error') raise e finally: try: @@ -528,6 +537,7 @@ class Runner(object): job.set_status(Status.PARTIAL) if isinstance(e, TargetError) or isinstance(e, TimeoutError): context.tm.verify_target_responsive() + self.context.record_ui_state('output-error') raise except KeyboardInterrupt: