FAFT: Compare the boot IDs to tell reboot too quickly
We expect DUT is offline after calling reboot action. Sometime (may be a
wrong behavior about timing), DUT boots very quickly and comes online soon.
Comparing the boot IDs can tell this scenario.
BUG=chromium-os:225022
TEST=run firmware_ConsecutiveBoot passed.
Change-Id: I5c48efa5f28287b2291260e2b0bd2277891ee9cf
Reviewed-on: https://gerrit.chromium.org/gerrit/49889
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/servo_test.py b/server/cros/servo_test.py
index 7769b9b..6592635 100644
--- a/server/cros/servo_test.py
+++ b/server/cros/servo_test.py
@@ -184,15 +184,23 @@
self._launch_client()
logging.info('Server: Relaunched remote %s.', 'faft')
- def wait_for_client_offline(self, timeout=60):
+ def wait_for_client_offline(self, timeout=60, orig_boot_id=''):
"""Wait for the client to come offline.
@param timeout: Time in seconds to wait the client to come offline.
+ @param orig_boot_id: A string containing the original boot id.
"""
# Wait for the client to come offline.
while timeout > 0 and self._ping_test(self._client.ip, timeout=1):
time.sleep(1)
timeout -= 1
+
+ # As get_boot_id() requires DUT online. So we move the comparison here.
+ if timeout == 0 and orig_boot_id:
+ if self._client.get_boot_id() != orig_boot_id:
+ logging.warn('Reboot done very quickly.')
+ return
+
assert timeout, 'Timed out waiting for client offline.'
logging.info('Server: Client machine is offline.')