faft: Use port numbers when retrieving servod logs
Previously, this logic used a hardcoded /var/log/servod.log, which
doesn't exist on servo hosts with more than one servo. As a result,
test runs in the lab failed to record the servod log.
Now, it uses the port-based /var/log/servod_PORT.log file names, and
skips old log data only if the log is actually the same file (inode).
BUG=chromium:932820
TEST=Run firmware_FAFTSetup with remote servod; look for servod.log.
Change-Id: Iaab05a38a22ca1dc18ca9f52ab74ec128ccaf517
Reviewed-on: https://chromium-review.googlesource.com/1597848
Tested-by: Dana Goyette <dgoyette@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Dana Goyette <dgoyette@chromium.org>
diff --git a/server/cros/servo/servo.py b/server/cros/servo/servo.py
index 7e2d017..ec4622c 100644
--- a/server/cros/servo/servo.py
+++ b/server/cros/servo/servo.py
@@ -274,13 +274,24 @@
self._uart = _Uart(self)
self._usb_state = None
self._programmer = None
-
+ self._prev_log_inode = None
+ self._prev_log_size = 0
@property
def servo_serial(self):
"""Returns the serial number of the servo board."""
return self._servo_serial
+ def fetch_servod_log(self, filename=None, skip_old=False):
+ """Save the servod log into the given local file.
+
+ @param filename: save the contents into a file with the given name.
+ @param skip_old: if True, skip past the old data in the log file.
+ @type filename: str
+ @type skip_old: bool
+ @rtype: None
+ """
+ return self._servo_host.fetch_servod_log(filename, skip_old)
def get_power_state_controller(self):
"""Return the power state controller for this Servo.