OLD | NEW |
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging, os, re | 5 import logging, os, re |
6 | 6 |
7 from autotest_lib.client.bin import site_login, site_ui_test | 7 from autotest_lib.client.bin import site_login, site_ui_test |
8 from autotest_lib.client.common_lib import error, site_ui, utils | 8 from autotest_lib.client.common_lib import error, site_ui, utils |
9 | 9 |
10 class graphics_SanAngeles(site_ui_test.UITest): | 10 class graphics_SanAngeles(site_ui_test.UITest): |
11 version = 1 | 11 version = 1 |
12 preserve_srcdir = True | 12 preserve_srcdir = True |
13 | 13 |
14 | 14 |
15 def setup(self): | 15 def setup(self): |
16 os.chdir(self.srcdir) | 16 os.chdir(self.srcdir) |
17 utils.system('make clean') | 17 utils.make('clean') |
18 utils.system('make all') | 18 utils.make('all') |
19 | 19 |
20 | 20 |
21 def run_once(self): | 21 def run_once(self): |
22 cmd_gl = os.path.join(self.srcdir, 'SanOGL') | 22 cmd_gl = os.path.join(self.srcdir, 'SanOGL') |
23 cmd_gles = os.path.join(self.srcdir, 'SanOGLES') | 23 cmd_gles = os.path.join(self.srcdir, 'SanOGLES') |
24 cmd_gles_s = os.path.join(self.srcdir, 'SanOGLES_S') | 24 cmd_gles_s = os.path.join(self.srcdir, 'SanOGLES_S') |
25 if os.path.isfile(cmd_gl): | 25 if os.path.isfile(cmd_gl): |
26 cmd = cmd_gl | 26 cmd = cmd_gl |
27 elif os.path.isfile(cmd_gles): | 27 elif os.path.isfile(cmd_gles): |
28 cmd = cmd_gles | 28 cmd = cmd_gles |
29 elif os.path.isfile(cmd_gles_s): | 29 elif os.path.isfile(cmd_gles_s): |
30 cmd = cmd_gles_s | 30 cmd = cmd_gles_s |
31 else: | 31 else: |
32 raise error.TestFail('Fail to locate SanAngles Observation exe.' | 32 raise error.TestFail('Fail to locate SanAngles Observation exe.' |
33 'Test setup error.') | 33 'Test setup error.') |
34 | 34 |
35 cmd = site_ui.xcommand(cmd) | 35 cmd = site_ui.xcommand(cmd) |
36 result = utils.run(cmd, ignore_status = True) | 36 result = utils.run(cmd, ignore_status = True) |
37 | 37 |
38 report = re.findall(r"frame_rate = ([0-9.]+)", result.stdout) | 38 report = re.findall(r"frame_rate = ([0-9.]+)", result.stdout) |
39 if len(result.stderr) > 0 or not report: | 39 if len(result.stderr) > 0 or not report: |
40 raise error.TestFail('Fail to complete San Angeles Observation' + | 40 raise error.TestFail('Fail to complete San Angeles Observation' + |
41 result.stderr) | 41 result.stderr) |
42 frame_rate = float(report[0]) | 42 frame_rate = float(report[0]) |
43 logging.info('frame_rate = %.1f' % frame_rate) | 43 logging.info('frame_rate = %.1f' % frame_rate) |
44 self.write_perf_keyval( | 44 self.write_perf_keyval( |
45 {'frames_per_sec_rate_san_angeles': frame_rate}) | 45 {'frames_per_sec_rate_san_angeles': frame_rate}) |
OLD | NEW |