faft: Chrome EC class supports a reboot method
So far, we do a EC reboot by either sending a EC command or using client
side ectool. This CL make Chrome EC class provide a single interface
to require EC reboot. Several reboot types are supported:
default: EC soft reboot;
'hard': EC hard/cold reboot;
'ap-off': Leave AP off after EC reboot (by default, EC turns
AP on after reboot if lid is open).
BUG=chromium-os:35254
TEST=run_remote_tests.sh --board link --remote dut FAFTSetup
Change-Id: Iabbd87ee7f06b8ef361bd56016fadc9696517cec
Reviewed-on: https://gerrit.chromium.org/gerrit/36862
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/chrome_ec.py b/server/cros/chrome_ec.py
index 93ac248..cc7445f 100644
--- a/server/cros/chrome_ec.py
+++ b/server/cros/chrome_ec.py
@@ -145,3 +145,24 @@
self.send_key_string_raw(raw)
else:
self.key_press(sp)
+
+
+ def reboot(self, flags=''):
+ """Reboot EC with given flags.
+
+ Args:
+ flags: Optional, a space-separated string of flags passed to the
+ reboot command, including:
+ default: EC soft reboot;
+ 'hard': EC hard/cold reboot;
+ 'ap-off': Leave AP off after EC reboot (by default, EC turns
+ AP on after reboot if lid is open).
+
+ Raises:
+ error.TestError: If the string of flags is invalid.
+ """
+ for flag in flags.split():
+ if flag not in ('hard', 'ap-off'):
+ raise error.TestError(
+ 'The flag %s of EC reboot command is invalid.' % flag)
+ self.send_command("reboot %s" % flags)