blob: 376b126bcf9254f53f7c60176b777bbfe3e65094 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from autotest_lib.server.cros import vboot_constants as vboot
from autotest_lib.server.cros.faft.firmware_test import FirmwareTest
from autotest_lib.server.cros.faft.firmware_test import ConnectionError
class firmware_CorruptFwBodyA(FirmwareTest):
Servo based firmware body A corruption test.
The expected behavior is different if the firmware preamble USE_RO_NORMAL
flag is enabled. In the case USE_RO_NORMAL ON, the firmware corruption
doesn't hurt the boot results since it boots the RO path directly and does
not load and verify the RW firmware body. In the case USE_RO_NORMAL OFF,
the RW firwmare A corruption will result booting the firmware B.
version = 1
def initialize(self, host, cmdline_args, dev_mode=False):
super(firmware_CorruptFwBodyA, self).initialize(host, cmdline_args)
self.switcher.setup_mode('dev' if dev_mode else 'normal')
def cleanup(self):
except ConnectionError:
logging.error("ERROR: DUT did not come up. Need to cleanup!")
super(firmware_CorruptFwBodyA, self).cleanup()
def run_once(self):
if (self.faft_client.bios.get_preamble_flags('a') &
# USE_RO_NORMAL flag is ON. Firmware body corruption doesn't
# hurt the booting results.'The firmware USE_RO_NORMAL flag is enabled.')"Corrupt firmware body A.")
self.check_state((self.checkers.fw_tries_checker, 'A'))
self.switcher.mode_aware_reboot()"Still expected firmware A boot and restore.")
self.check_state((self.checkers.fw_tries_checker, 'A'))
else:'The firmware USE_RO_NORMAL flag is disabled.')"Corrupt firmware body A.")
self.check_state((self.checkers.fw_tries_checker, 'A'))
self.switcher.mode_aware_reboot()"Expected firmware B boot and restore firmware A.")
self.check_state((self.checkers.fw_tries_checker, ('B', False)))
expected_slot = 'B' if self.fw_vboot2 else 'A'"Expected firmware " + expected_slot + " boot, done.")
self.check_state((self.checkers.fw_tries_checker, expected_slot))