aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsuan Ting Chen <roccochen@chromium.org>2022-05-17 18:57:36 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-26 14:03:22 +0000
commitfb39b5f12a9460202c22dfa8be901987eb7f840c (patch)
tree5d69b7bd36bb848e0e5bae8728635d5fb7c88901
parent8c3b46e920f30ca742719df66eb45d8877d164c6 (diff)
downloadautotest-fb39b5f12a9460202c22dfa8be901987eb7f840c.tar.gz
FAFT: MiniOS: Use normal mode in MiniOS related tests
After CL:3558060, MiniOS is allowed under both normal and dev mode for images with debug features. Hence, there is no reason to force DUT in dev mode while running MiniOS related tests. Change the behavior from forcing dev mode to forcing normal mode for all the MiniOS related tests, this contains: - firmware_MiniosPriority.* - firmware_MiniosMenu.* - firmware_CorruptMinios.* - firmware_CorruptBothKernelAB Also change the names of related utilities. BUG=b:227382828, b:202217528 TEST=/usr/bin/test_that --fast --no-retry --iterations 1 --board=cherry $DUT_IP --autotest_dir ~/trunk/src/third_party/autotest/files/ firmware_MiniosPriority.minios_a firmware_MiniosPriority.minios_b firmware_CorruptMinios.minios_a firmware_CorruptMinios.minios_b firmware_MiniosMenu firmware_MiniosMenu.old firmware_CorruptBothKernelAB Cq-Depend: chromium:3564250 Change-Id: Id7583ceaa369dfeb51ef6b34ba8758137aaad6ad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3650304 Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Commit-Queue: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
-rw-r--r--server/cros/faft/utils/faft_checkers.py13
-rw-r--r--server/cros/faft/utils/mode_switcher.py29
-rw-r--r--server/site_tests/firmware_CorruptBothMiniosAB/firmware_CorruptBothMiniosAB.py7
-rw-r--r--server/site_tests/firmware_CorruptMinios/firmware_CorruptMinios.py11
-rw-r--r--server/site_tests/firmware_MiniosMenu/firmware_MiniosMenu.py9
-rw-r--r--server/site_tests/firmware_MiniosPriority/firmware_MiniosPriority.py9
6 files changed, 35 insertions, 43 deletions
diff --git a/server/cros/faft/utils/faft_checkers.py b/server/cros/faft/utils/faft_checkers.py
index 8cadd2b983..6bd46e0398 100644
--- a/server/cros/faft/utils/faft_checkers.py
+++ b/server/cros/faft/utils/faft_checkers.py
@@ -218,15 +218,14 @@ class FAFTCheckers(object):
logging.info("Wrong output format of '%s':\n%s", cmd, '\n'.join(lines))
return False
- def dev_boot_minios_checker(self):
- """Check the current boot is a success MiniOS boot in developer mode.
+ def minios_checker(self):
+ """Check the current boot is a success MiniOS boot via SSH.
- The DUT must be in developer mode to allow SSH connection, and we can
- only use the raw command, host.run_output(), to check since autotest
- client libraries cannot be installed in MiniOS.
+ The DUT with test image should allow SSH connection, and we will use the
+ raw command, host.run_output(), to check since autotest client libraries
+ cannot be installed in MiniOS.
- @return True if DUT booted to MiniOS in developer mode; otherwise,
- False.
+ @return True if DUT booted to MiniOS; otherwise, False.
@raise TestError if DUT does not enable MiniOS.
"""
diff --git a/server/cros/faft/utils/mode_switcher.py b/server/cros/faft/utils/mode_switcher.py
index 25d044508e..2d1d75d15e 100644
--- a/server/cros/faft/utils/mode_switcher.py
+++ b/server/cros/faft/utils/mode_switcher.py
@@ -957,11 +957,10 @@ class _BaseModeSwitcher(object):
return
raise ConnectionError('DUT is still up unexpectedly')
- def trigger_dev_to_minios(self, minios_priority=None):
- """In developer mode, reboot to MiniOS with specified priority.
+ def launch_minios(self, minios_priority=None):
+ """Reboot to recovery mode and launch MiniOS with specified priority.
The DUT must have the config 'minios_enabled'.
- This method will reboot DUT to recovery mode and boot into MiniOS.
@param minios_priority: Set to 'a' or 'b' for specified priority; Set to
None to skip assigning the priority.
@@ -970,12 +969,13 @@ class _BaseModeSwitcher(object):
"""
raise NotImplementedError
- def trigger_minios_to_dev(self):
- """Leave MiniOS and reboot to developer mode.
+ def leave_minios(self, is_devsw_boot=False):
+ """Leave MiniOS and use a mode-aware way to reboot DUT.
The DUT must have the config 'minios_enabled'.
This method will reboot DUT to leave MiniOS.
+ @param is_devsw_boot: True to bypass the developer screen.
@raise ConnectionError: Failed to wait DUT offline.
@raise NotImplementedError: DUT does not support MiniOS.
"""
@@ -1003,23 +1003,18 @@ class _MenuSwitcher(_BaseModeSwitcher):
self.wait_for_client_offline()
self.bypasser.trigger_dev_to_normal()
- def trigger_dev_to_minios(self, minios_priority=None):
- """In developer mode, reboot to MiniOS with specified priority.
-
+ def launch_minios(self, minios_priority=None):
+ """Reboot to recovery mode and launch MiniOS with specified priority.
The DUT must have the config 'minios_enabled'.
- This method will reboot DUT to recovery mode and boot into MiniOS.
@param minios_priority: Set to 'a' or 'b' for specified priority; Set to
None to skip assigning the priority.
@raise ConnectionError: Failed to wait DUT offline.
@raise NotImplementedError: DUT does not support MiniOS.
- @raise TestError: DUT is not in developer mode.
"""
# Validity check
if not self.faft_config.minios_enabled:
raise NotImplementedError
- if not self.checkers.mode_checker('dev'):
- raise error.TestError('DUT is not in developer mode.')
# Set MiniOS priority
if minios_priority:
@@ -1041,20 +1036,22 @@ class _MenuSwitcher(_BaseModeSwitcher):
self.servo.ctrl_r()
self.faft_framework.wait_for('minios_screen')
- def trigger_minios_to_dev(self):
- """Leave MiniOS and reboot to developer mode.
+ def leave_minios(self, is_devsw_boot=False):
+ """Leave MiniOS and use a mode-aware way to reboot DUT.
The DUT must have the config 'minios_enabled'.
This method will reboot DUT to leave MiniOS.
+ @param is_devsw_boot: True to bypass the developer screen.
@raise ConnectionError: Failed to wait DUT offline.
@raise NotImplementedError: DUT does not support MiniOS.
"""
# mode_aware_reboot() cannot be used here since it leverages autotest
# libraries which don't exist within MiniOS.
self.simple_reboot(sync_before_boot=False)
- self.faft_framework.wait_for('firmware_screen')
- self.bypass_dev_mode()
+ if is_devsw_boot:
+ self.faft_framework.wait_for('firmware_screen')
+ self.bypass_dev_mode()
class _KeyboardDevSwitcher(_MenuSwitcher):
diff --git a/server/site_tests/firmware_CorruptBothMiniosAB/firmware_CorruptBothMiniosAB.py b/server/site_tests/firmware_CorruptBothMiniosAB/firmware_CorruptBothMiniosAB.py
index ab1fedfc02..6f54d080c2 100644
--- a/server/site_tests/firmware_CorruptBothMiniosAB/firmware_CorruptBothMiniosAB.py
+++ b/server/site_tests/firmware_CorruptBothMiniosAB/firmware_CorruptBothMiniosAB.py
@@ -34,14 +34,13 @@ class firmware_CorruptBothMiniosAB(FirmwareTest):
self.backup_kernel(kernel_type='MINIOS')
self.host = host
- # SSH to MiniOS is only available in developer mode
- self.switcher.setup_mode('dev')
+ self.switcher.setup_mode('normal')
self.setup_usbkey(usbkey=True, host=True, used_for_recovery=True)
def cleanup(self):
if not self.test_skipped:
try:
- self.switcher.trigger_minios_to_dev()
+ self.switcher.leave_minios()
self.restore_kernel(kernel_type='MINIOS')
except Exception as e:
logging.error('Caught exception: %s', str(e))
@@ -54,7 +53,7 @@ class firmware_CorruptBothMiniosAB(FirmwareTest):
self.faft_client.minios.corrupt_sig('b')
# Try to boot to MiniOS and expect a failed boot
- self.switcher.trigger_dev_to_minios()
+ self.switcher.launch_minios()
logging.info('DUT should fail to boot MiniOS, verifying...')
if self.host.ping_wait_up(
timeout=self.faft_config.delay_reboot_to_ping):
diff --git a/server/site_tests/firmware_CorruptMinios/firmware_CorruptMinios.py b/server/site_tests/firmware_CorruptMinios/firmware_CorruptMinios.py
index 7a966ce46f..0aa32d1afd 100644
--- a/server/site_tests/firmware_CorruptMinios/firmware_CorruptMinios.py
+++ b/server/site_tests/firmware_CorruptMinios/firmware_CorruptMinios.py
@@ -33,8 +33,7 @@ class firmware_CorruptMinios(FirmwareTest):
self.backup_kernel(kernel_type='MINIOS')
self.host = host
- # SSH to MiniOS is only available for developer mode
- self.switcher.setup_mode('dev')
+ self.switcher.setup_mode('normal')
self.setup_usbkey(usbkey=False)
self.minios_section = minios_section
self.restored_priority = self.faft_client.system.get_minios_priority()
@@ -42,7 +41,7 @@ class firmware_CorruptMinios(FirmwareTest):
def cleanup(self):
if not self.test_skipped:
try:
- self.switcher.trigger_minios_to_dev()
+ self.switcher.leave_minios()
self.restore_kernel(kernel_type='MINIOS')
self.faft_client.system.set_minios_priority(
self.restored_priority)
@@ -56,9 +55,9 @@ class firmware_CorruptMinios(FirmwareTest):
self.faft_client.minios.corrupt_sig(self.minios_section)
logging.info('Try to boot with prioritizing the corrupted section')
- self.switcher.trigger_dev_to_minios(self.minios_section)
- self.check_state(self.checkers.dev_boot_minios_checker)
- self.switcher.trigger_minios_to_dev()
+ self.switcher.launch_minios(self.minios_section)
+ self.check_state(self.checkers.minios_checker)
+ self.switcher.leave_minios()
logging.info('Restore MiniOS section: %r', self.minios_section)
self.faft_client.minios.restore_sig(self.minios_section)
diff --git a/server/site_tests/firmware_MiniosMenu/firmware_MiniosMenu.py b/server/site_tests/firmware_MiniosMenu/firmware_MiniosMenu.py
index 3a4ec3795e..b1844350b7 100644
--- a/server/site_tests/firmware_MiniosMenu/firmware_MiniosMenu.py
+++ b/server/site_tests/firmware_MiniosMenu/firmware_MiniosMenu.py
@@ -30,15 +30,14 @@ class firmware_MiniosMenu(FirmwareTest):
self.test_skipped = False
self.host = host
- # SSH to MiniOS is only available in developer mode
- self.switcher.setup_mode('dev')
+ self.switcher.setup_mode('normal')
self.setup_usbkey(usbkey=False)
self.older_version = older_version
def cleanup(self):
if not self.test_skipped:
try:
- self.switcher.trigger_minios_to_dev()
+ self.switcher.leave_minios()
except Exception as e:
logging.error('Caught exception: %s', str(e))
super(firmware_MiniosMenu, self).cleanup()
@@ -47,7 +46,7 @@ class firmware_MiniosMenu(FirmwareTest):
"""Run a single iteration of the test."""
logging.info('Boot into recovery mode, older_version: %s',
self.older_version)
- self.switcher.enable_rec_mode_and_reboot(usb_state='host')
+ self.switcher.reboot_to_mode(to_mode="rec", wait_for_dut_up=False)
self.wait_for('firmware_screen')
self.menu_switcher.trigger_rec_to_minios(self.older_version)
- self.check_state(self.checkers.dev_boot_minios_checker)
+ self.check_state(self.checkers.minios_checker)
diff --git a/server/site_tests/firmware_MiniosPriority/firmware_MiniosPriority.py b/server/site_tests/firmware_MiniosPriority/firmware_MiniosPriority.py
index 83d78e54a6..da51a9478f 100644
--- a/server/site_tests/firmware_MiniosPriority/firmware_MiniosPriority.py
+++ b/server/site_tests/firmware_MiniosPriority/firmware_MiniosPriority.py
@@ -33,8 +33,7 @@ class firmware_MiniosPriority(FirmwareTest):
self.test_skipped = False
self.host = host
- # SSH to MiniOS is only available in developer mode
- self.switcher.setup_mode('dev')
+ self.switcher.setup_mode('normal')
self.setup_usbkey(usbkey=False)
self.minios_priority = minios_priority
self.restored_priority = self.faft_client.system.get_minios_priority()
@@ -42,7 +41,7 @@ class firmware_MiniosPriority(FirmwareTest):
def cleanup(self):
if not self.test_skipped:
try:
- self.switcher.trigger_minios_to_dev()
+ self.switcher.leave_minios()
self.faft_client.system.set_minios_priority(
self.restored_priority)
except Exception as e:
@@ -51,5 +50,5 @@ class firmware_MiniosPriority(FirmwareTest):
def run_once(self):
"""Run a single iteration of the test."""
- self.switcher.trigger_dev_to_minios(self.minios_priority)
- self.check_state(self.checkers.dev_boot_minios_checker)
+ self.switcher.launch_minios(self.minios_priority)
+ self.check_state(self.checkers.minios_checker)