faft: Skip checking GBB flags after the first test finished
There is no need to set GBB flags at the beginning of every test. We
just need to set them when running the first test. This saves us about
8 seconds per test.
BUG=chromium-os:34392
TEST=Run a test suite. Check GBB flags is only set in the first test.
Change-Id: Ib23e1326d208634e7331ff2bb54000529d11afb0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35811
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index 9cb9559..06f2586 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -129,6 +129,10 @@
_backup_firmware_sha = ()
+ # True if this is the first test in the same run
+ _first_test = True
+ _setup_invalidated = False
+
def initialize(self, host, cmdline_args, use_pyauto=False, use_faft=False):
# Parse arguments from command line
@@ -182,11 +186,13 @@
'reboot_action': (self.sync_and_warm_reboot),
'firmware_action': (None)
})
- self.clear_set_gbb_flags(vboot.GBB_FLAG_DEV_SCREEN_SHORT_DELAY |
- vboot.GBB_FLAG_FORCE_DEV_SWITCH_ON |
- vboot.GBB_FLAG_FORCE_DEV_BOOT_USB |
- vboot.GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK,
- vboot.GBB_FLAG_ENTER_TRIGGERS_TONORM)
+ if FAFTSequence._first_test:
+ logging.info('Running first test. Set proper GBB flags.')
+ self.clear_set_gbb_flags(vboot.GBB_FLAG_DEV_SCREEN_SHORT_DELAY |
+ vboot.GBB_FLAG_FORCE_DEV_SWITCH_ON |
+ vboot.GBB_FLAG_FORCE_DEV_BOOT_USB |
+ vboot.GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK,
+ vboot.GBB_FLAG_ENTER_TRIGGERS_TONORM)
if self._install_image_path:
self.install_test_image(self._install_image_path,
self._firmware_update)
@@ -196,9 +202,19 @@
"""Autotest cleanup function."""
self._faft_sequence = ()
self._faft_template = {}
+ FAFTSequence._first_test = self._setup_invalidated
super(FAFTSequence, self).cleanup()
+ def invalidate_setup(self):
+ """Invalidate current setup flag.
+
+ This reset the first test flag so that the next test setup
+ properly again.
+ """
+ self._setup_invalidated = True
+
+
def reset_client(self):
"""Reset client, if necessary.