blob: c97844bd01edbe57be94ae3d3464ffe1c3cd4ee9 [file] [log] [blame]
# Copyright 2018 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.client.common_lib import error
from autotest_lib.server.cros.faft.firmware_test import FirmwareTest
BIOS_PATH = '/tmp/test.firmware_Bmpblk.bios.bin'
PRINT_CBFS_CMD = 'cbfstool %s print' % BIOS_PATH
LAYOUT_CBFS_CMD = 'cbfstool %s layout' % BIOS_PATH
class firmware_Bmpblk(FirmwareTest):
"""
This test checks whether the BIOS was built with a correctly configured
bmpblk to ensure crisp firmware screen images and text. The bmpblk for every
device needs to be explicitly configured for the device's screen resolution
to ensure optimal quality. Relies on flashrom and cbfstool to inspect BIOS.
"""
version = 1
def run_once(self):
"""Runs a single iteration of the test."""
self.faft_client.bios.dump_whole(BIOS_PATH)
layout = self.faft_client.system.run_shell_command_get_output(
LAYOUT_CBFS_CMD)
layout = '\n'.join(layout)
logging.debug('cbfstool layout output:\n\n%s', layout)
print_cbfs_cmd_options=''
if 'BOOT_STUB' in layout:
print_cbfs_cmd_options=' -r BOOT_STUB'
try:
files = self.faft_client.system.run_shell_command_get_output(
PRINT_CBFS_CMD + print_cbfs_cmd_options)
files = '\n'.join(files)
logging.debug('cbfstool print output:\n\n%s', files)
if 'romstage' not in files:
raise error.TestError("Sanity check failed: Can't read CBFS")
if 'vbgfx.bin' not in files:
raise error.TestNAError('This board has no firmware screens')
if 'vbgfx_not_scaled' in files:
logging.error("This firmware's bmpblk was built for a generic "
"1366x768 display resolution. Images will get "
"scaled up at runtime and look blurry. You need "
"to explicitly set the panel resolution for this "
"board in bmpblk/images/boards.yaml and add it "
"to CROS_BOARDS in the sys-boot/chromeos-bmpblk"
".ebuild. Do *not* do this until you are certain "
"of the panel resolution that the final product "
"will ship with!")
raise error.TestFail('bmpblk images not scaled for this board')
finally:
self.faft_client.system.remove_file(BIOS_PATH)