faft: Implement a FAFT test for Ctrl-U developer boot USB
This test requires a USB disk plugged-in, which contains a Chrome OS test
image (built by "build_image test"). On runtime, this test first switches
DUT to developer mode. When dev_boot_usb=0, pressing Ctrl-U on developer
screen should not boot the USB disk. When dev_boot_usb=1, pressing Ctrl-U
should boot the USB disk.
Several helpful methods are added to FAFT infrastructure, like:
FAFTClient:
- get_dev_boot_usb: Get dev_boot_usb value
- set_dev_boot_usb: Set dev_boot_usb value
- is_removable_device_boot: Check the current boot device is removable
FAFTSequence:
- dev_boot_usb_checker: Check the current boot is from a developer USB
BUG=chromium-os:35255
TEST=run_remote_tests.sh --board daisy --remote dut firmware_DevBootUSB
Change-Id: I717a0c2bdc086031ad721ba915668416bd5a7256
Reviewed-on: https://gerrit.chromium.org/gerrit/35553
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mike Truty <truty@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/client/cros/faft_client.py b/client/cros/faft_client.py
index 516d667..76b4b22 100644
--- a/client/cros/faft_client.py
+++ b/client/cros/faft_client.py
@@ -239,6 +239,26 @@
self._chromeos_interface.cs.request_recovery()
+ def get_dev_boot_usb(self):
+ """Get dev_boot_usb value which controls developer mode boot from USB.
+
+ Returns:
+ True if enable, False if disable.
+ """
+ self._chromeos_interface.log('Getting dev_boot_usb')
+ return self._chromeos_interface.cs.dev_boot_usb == '1'
+
+
+ def set_dev_boot_usb(self, value):
+ """Set dev_boot_usb value which controls developer mode boot from USB.
+
+ Args:
+ value: True to enable, False to disable.
+ """
+ self._chromeos_interface.log('Setting dev_boot_usb to %s' % str(value))
+ self._chromeos_interface.cs.dev_boot_usb = 1 if value else 0
+
+
def get_gbb_flags(self):
"""Get the GBB flags.
@@ -518,6 +538,17 @@
return header_a != header_b
+ def is_removable_device_boot(self):
+ """Check the current boot device is removable.
+
+ Returns:
+ True: if a removable device boots.
+ False: if a non-removable device boots.
+ """
+ root_part = self._chromeos_interface.get_root_part()
+ return self._chromeos_interface.is_removable_device(root_part)
+
+
def setup_EC_image(self, ec_path):
"""Setup the new EC image for later update.