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 6 7from autotest_lib.client.bin import test 8from autotest_lib.client.common_lib import error, utils 9from autotest_lib.client.cros.graphics import graphics_utils 10 11 12class graphics_Gbm(test.test): 13 """ 14 Test the gbm implementation. 15 """ 16 version = 1 17 preserve_srcdir = True 18 GSC = None 19 20 def setup(self): 21 os.chdir(self.srcdir) 22 utils.make('clean') 23 utils.make('all') 24 25 def initialize(self): 26 self.GSC = graphics_utils.GraphicsStateChecker() 27 28 def cleanup(self): 29 if self.GSC: 30 self.GSC.finalize() 31 32 def run_once(self): 33 cmd = os.path.join(self.srcdir, 'gbmtest') 34 cmd = graphics_utils.xcommand(cmd) 35 result = utils.run(cmd, 36 stderr_is_expected=False, 37 stdout_tee=utils.TEE_TO_LOGS, 38 stderr_tee=utils.TEE_TO_LOGS, 39 ignore_status=True) 40 report = re.findall(r'\[ PASSED \]', result.stdout) 41 if not report: 42 raise error.TestFail('Failed: Gbm test failed (' + result.stdout + 43 ')') 44