Home | History | Annotate | Download | only in firmware_Bmpblk
      1 # Copyright 2018 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 import logging
      6 
      7 from autotest_lib.client.common_lib import error
      8 from autotest_lib.server.cros.faft.firmware_test import FirmwareTest
      9 
     10 BIOS_PATH = '/tmp/test.firmware_Bmpblk.bios.bin'
     11 
     12 class firmware_Bmpblk(FirmwareTest):
     13     """
     14     This test checks whether the BIOS was built with a correctly configured
     15     bmpblk to ensure crisp firmware screen images and text. The bmpblk for every
     16     device needs to be explicitly configured for the device's screen resolution
     17     to ensure optimal quality. Relies on flashrom and cbfstool to inspect BIOS.
     18     """
     19     version = 1
     20 
     21     def run_once(self):
     22         self.faft_client.bios.dump_whole(BIOS_PATH)
     23         try:
     24             files = self.faft_client.system.run_shell_command_get_output(
     25                     'cbfstool %s print' % BIOS_PATH)
     26             files = '\n'.join(files)
     27             logging.debug('cbfstool print output:\n\n%s', files)
     28             if 'ramstage' not in files:
     29                 raise error.TestError("Sanity check failed: Can't read CBFS")
     30             if 'vbgfx.bin' not in files:
     31                 raise error.TestNAError('This board has no firmware screens')
     32             if 'vbgfx_not_scaled' in files:
     33                 logging.error("This firmware's bmpblk was built for a generic "
     34                               "1366x768 display resolution. Images will get "
     35                               "scaled up at runtime and look blurry. You need "
     36                               "to explicitly set the panel resolution for this "
     37                               "board in bmpblk/images/boards.yaml and add it "
     38                               "to CROS_BOARDS in the sys-boot/chromeos-bmpblk"
     39                               ".ebuild. Do *not* do this until you are certain "
     40                               "of the panel resolution that the final product "
     41                               "will ship with!")
     42                 raise error.TestFail('bmpblk images not scaled for this board')
     43         finally:
     44             self.faft_client.system.remove_file(BIOS_PATH)
     45