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