FAFT: Use fwtool instead of ectool for DUT using a host
On Ryu, the ectool doesn't exist. Use the fwtool instead.
BUG=chromium:527484
TEST=Ran the firmware_SoftwareSync which uses this method.
Change-Id: Ib9f88b5242ad1a2b86b7f14f426f85e8327a0d28
Reviewed-on: https://chromium-review.googlesource.com/295569
Commit-Ready: Wai-Hong Tam <waihong@chromium.org>
Tested-by: Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Shelley Chen <shchen@chromium.org>
diff --git a/client/cros/faft/rpc_functions.py b/client/cros/faft/rpc_functions.py
index 3bc3f21..48f6c2f 100755
--- a/client/cros/faft/rpc_functions.py
+++ b/client/cros/faft/rpc_functions.py
@@ -179,6 +179,10 @@
"""
return True
+ def _system_has_host(self):
+ """Return True if a host is connected to DUT."""
+ return self._os_if.has_host()
+
def _system_wait_for_client(self, timeout):
"""Wait for the client to come back online.
diff --git a/client/cros/faft/utils/os_interface.py b/client/cros/faft/utils/os_interface.py
index 63cf9be..23f7ce7 100644
--- a/client/cros/faft/utils/os_interface.py
+++ b/client/cros/faft/utils/os_interface.py
@@ -99,6 +99,10 @@
if self.host_shell:
self.host_shell.init(self)
+ def has_host(self):
+ """Return True if a host is connected to DUT."""
+ return self.is_android
+
def run_shell_command(self, cmd):
"""Run a shell command."""
self.shell.run_command(cmd)
diff --git a/server/cros/faft/utils/faft_checkers.py b/server/cros/faft/utils/faft_checkers.py
index 55eb583..f486523 100644
--- a/server/cros/faft/utils/faft_checkers.py
+++ b/server/cros/faft/utils/faft_checkers.py
@@ -255,8 +255,11 @@
the expected copy of EC running firmware.
@return: True if the current EC running copy matches; otherwise, False.
"""
- lines = self.faft_client.system.run_shell_command_get_output(
- 'ectool version')
+ if self.faft_client.system.has_host():
+ cmd = 'fwtool ec version'
+ else:
+ cmd = 'ectool version'
+ lines = self.faft_client.system.run_shell_command_get_output(cmd)
pattern = re.compile("Firmware copy: (.*)")
for line in lines:
matched = pattern.match(line)
@@ -267,6 +270,5 @@
logging.info("Expected EC in %s but now in %s",
expected_copy, matched.group(1))
return False
- logging.info("Wrong output format of 'ectool version':\n%s",
- '\n'.join(lines))
+ logging.info("Wrong output format of '%s':\n%s", cmd, '\n'.join(lines))
return False