autotest: make some servo/servohost verifiers non-critical
We don't want disconnect servo if only non-critical verifier(s)
failing, as some repair actions that depends on servo may
still run(e.g. if EC corrupted, lid_open and pwr_button will
fail, but we should not block firmware repair in this case).
BUG=chromium:1056705
TEST=run repair job locally
Change-Id: I51583f4b187b9ccd75e9f26e902c82a40be9a69d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2099989
Commit-Queue: Garry Wang <xianuowang@chromium.org>
Tested-by: Garry Wang <xianuowang@chromium.org>
Reviewed-by: Xixuan Wu <xixuan@chromium.org>
diff --git a/server/hosts/servo_host.py b/server/hosts/servo_host.py
index 9cf4ef2..e17a16c 100644
--- a/server/hosts/servo_host.py
+++ b/server/hosts/servo_host.py
@@ -246,13 +246,12 @@
self._servo_state = servo_constants.SERVO_STATE_WORKING
self.record('INFO', None, None,
'ServoHost verify set servo_state as WORKING')
- except:
+ except Exception as e:
self._servo_state = servo_constants.SERVO_STATE_BROKEN
self.record('INFO', None, None,
'ServoHost verify set servo_state as BROKEN')
- self.disconnect_servo()
- self.stop_servod()
- raise
+ if self._is_critical_error(e):
+ raise
def repair(self, silent=False):
@@ -272,13 +271,29 @@
# reboot request created by this servo because it passed repair.
if self.is_labstation():
self.withdraw_reboot_request()
- except:
+ except Exception as e:
self._servo_state = servo_constants.SERVO_STATE_BROKEN
self.record('INFO', None, None,
'ServoHost repair set servo_state as BROKEN')
- self.disconnect_servo()
- self.stop_servod()
- raise
+ if self._is_critical_error(e):
+ self.disconnect_servo()
+ self.stop_servod()
+ raise
+
+
+ def _is_critical_error(self, error):
+ if (isinstance(error, hosts.AutoservVerifyDependencyError)
+ and not error.is_critical()):
+ logging.warning('Non-critical verify failure(s) detected during'
+ ' verify/repair servo, servo connection will'
+ ' still up but may not fully functional.'
+ ' Some repair actions and servo depended'
+ ' tests may not run.')
+ return False
+ logging.info('Critical verify failure(s) detected during repair/verify'
+ ' servo. Disconnecting servo and stop servod, all repair '
+ 'action and tests that depends on servo will not run.')
+ return True
def get_servo(self):