autotest: ignore servo command errors for test_that
Print but do not raise servo command error if servo host is not
cros host. The goal is to be able to run tests with "test_that" from
workstations while using Sweetberry as the servod device. Sweetberry
does not support many servo commands that autotest verify process
assumes. As a result, using Sweetberry with "test_that" fails
because of servo command errors. This CL prints but does not raise
the servo command errors, so that we can use Sweetberry with
"test_that" command.
BUG=b:148178790
TEST=test_that <ip> power_ServodWrapper \
--args 'test=power_Dummy servo_host=localhost servo_port=9996 \
ina_rate=1 vbat_rate=60 pdash_note=dummy' \
--autotest_dir ~/trunk/src/third_party/autotest/files/
Change-Id: I95f27c4e3d586b3cc4b7218ce994182a149b6e1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2036624
Commit-Queue: Mengqi Guo <mqg@chromium.org>
Tested-by: Mengqi Guo <mqg@chromium.org>
Auto-Submit: Mengqi Guo <mqg@chromium.org>
Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
diff --git a/server/cros/servo/servo.py b/server/cros/servo/servo.py
index 4373dfe..442cb4a 100644
--- a/server/cros/servo/servo.py
+++ b/server/cros/servo/servo.py
@@ -444,9 +444,13 @@
e.filename = '%s:%s' % (self._servo_host.hostname,
self._servo_host.servo_port)
raise
- self.set('usb_mux_oe1', 'on')
self._usb_state = None
- self.switch_usbkey('off')
+ if self.has_control('usb_mux_oe1'):
+ self.set('usb_mux_oe1', 'on')
+ self.switch_usbkey('off')
+ else:
+ logging.warning('Servod command \'usb_mux_oe1\' is not available. '
+ 'Any USB drive related servo routines will fail.')
self._uart.start_capture()
if cold_reset:
self._power_state.reset()