1# Lint as: python2, python3 2# Copyright 2018 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import logging 7from autotest_lib.client.bin import utils 8from autotest_lib.client.common_lib import error 9from autotest_lib.client.cros import kernel_config 10from autotest_lib.client.cros.graphics.graphics_utils import GraphicsTest 11 12class graphics_KernelConfig(GraphicsTest): 13 """Examine a kernel build CONFIG list to verify related flags. 14 """ 15 version = 1 16 arch = None 17 userspace_arch = None 18 19 IS_BUILTIN = [ 20 # Confidence checks; should be present in builds as builtins. 21 ] 22 IS_MODULE = [ 23 # Confidence checks; should be present in builds as modules. 24 ] 25 IS_ENABLED = [ 26 # Confidence checks; should be enabled. 27 ] 28 IS_MISSING = [ 29 # Confidence checks; should be disabled. 30 'DRM_KMS_FB_HELPER' 31 'FB', 32 'FB_CFB_COPYAREA', 33 'FB_CFB_FILLRECT', 34 'FB_CFB_IMAGEBLIT', 35 'FB_CFB_REV_PIXELS_IN_BYTE', 36 'FB_SIMPLE', 37 'FB_SYS_COPYAREA', 38 'FB_SYS_FOPS', 39 'FB_SYS_FILLRECT', 40 'FB_SYS_IMAGEBLIT', 41 'FB_VIRTUAL' 42 ] 43 44 def setup(self): 45 """ Test setup. """ 46 self.arch = utils.get_arch() 47 self.userspace_arch = utils.get_arch_userspace() 48 # Report the full uname for anyone reading logs. 49 logging.info('Running %s kernel, %s userspace: %s', 50 self.arch, self.userspace_arch, 51 utils.system_output('uname -a')) 52 53 @GraphicsTest.failure_report_decorator('graphics_KernelConfig') 54 def run_once(self): 55 """ 56 The actual test that read config and check. 57 """ 58 # Load the list of kernel config variables. 59 config = kernel_config.KernelConfig() 60 config.initialize() 61 logging.debug(config._config) 62 63 # Run the static checks. 64 list(map(config.has_builtin, self.IS_BUILTIN)) 65 list(map(config.has_module, self.IS_MODULE)) 66 list(map(config.is_enabled, self.IS_ENABLED)) 67 list(map(config.is_missing, self.IS_MISSING)) 68 69 # Raise a failure if anything unexpected was seen. 70 if len(config.failures()): 71 raise error.TestFail((", ".join(config.failures()))) 72