xref: /aosp_15_r20/external/autotest/client/site_tests/graphics_Gbm/graphics_Gbm.py (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Lint as: python2, python3
2# Copyright 2014 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 os, re
7import logging
8from autotest_lib.client.common_lib import error, utils
9from autotest_lib.client.cros.graphics import graphics_utils
10
11
12class graphics_Gbm(graphics_utils.GraphicsTest):
13    """Test the gbm implementation.
14    """
15    version = 1
16    preserve_srcdir = True
17
18    def setup(self):
19        """Setup the test code."""
20        os.chdir(self.srcdir)
21        utils.make('clean')
22        utils.make('all')
23
24    def initialize(self):
25        super(graphics_Gbm, self).initialize()
26
27    def cleanup(self):
28        super(graphics_Gbm, self).cleanup()
29
30    @graphics_utils.GraphicsTest.failure_report_decorator('graphics_Gbm')
31    def run_once(self):
32        """Main body to exercise the test code."""
33        board = utils.get_current_board()
34        if board in ['monroe', 'fizz-moblab', 'guado_moblab']:
35            # Monroe has a hardware problem requiring hard cycling. Moblab
36            # images behave odd compared to non-moblab images.
37            logging.info('Skipping test.')
38            return
39        cmd = os.path.join(self.srcdir, 'gbmtest')
40        result = utils.run(
41            cmd,
42            stderr_is_expected=False,
43            stdout_tee=utils.TEE_TO_LOGS,
44            stderr_tee=utils.TEE_TO_LOGS,
45            ignore_status=True)
46        report = re.findall(r'\[  PASSED  \]', result.stdout)
47        if not report:
48            raise error.TestFail('Failed: Gbm test failed (' + result.stdout +
49                                 ')')
50