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