Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: client/site_tests/graphics_GLBench/graphics_GLBench.py

Issue 2873023: Got rid of glxinfo. (Closed) Base URL: http://src.chromium.org/git/autotest.git
Patch Set: strip board id Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/deps/glbench/src/main.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 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 5 import logging
6 import os 6 import os
7 import re 7 import re
8 8
9 from autotest_lib.client.bin import test 9 from autotest_lib.client.bin import test
10 from autotest_lib.client.common_lib import error, site_ui, utils 10 from autotest_lib.client.common_lib import error, site_ui, utils
11 11
12 def md5_file(filename): 12 def md5_file(filename):
13 return utils.system_output('md5sum ' + filename).split()[0] 13 return utils.system_output('md5sum ' + filename).split()[0]
14 14
15 15
16 def get_board_id():
17 glxinfo_output = utils.system_output(site_ui.xcommand('glxinfo'))
18 match = re.search('OpenGL vendor string: (.*)', glxinfo_output)
19 vendor = match.group(1) if match else 'unknown vendor'
20 match = re.search('OpenGL renderer string: (.*)', glxinfo_output)
21 renderer = match.group(1) if match else 'unknown renderer'
22 return (vendor + ' / ' + renderer).strip()
23
24
25 class graphics_GLBench(test.test): 16 class graphics_GLBench(test.test):
26 version = 1 17 version = 1
27 preserve_srcdir = True 18 preserve_srcdir = True
28 19
29 def setup(self): 20 def setup(self):
30 self.job.setup_dep(['glbench']) 21 self.job.setup_dep(['glbench'])
31 22
32 23
33 def run_once(self, options=''): 24 def run_once(self, options=''):
34 dep = 'glbench' 25 dep = 'glbench'
35 dep_dir = os.path.join(self.autodir, 'deps', dep) 26 dep_dir = os.path.join(self.autodir, 'deps', dep)
36 self.job.install_pkg(dep, 'dep', dep_dir) 27 self.job.install_pkg(dep, 'dep', dep_dir)
37 28
38 checksum_table = {} 29 checksum_table = {}
39 checksums_filename = os.path.join(self.autodir, 30 checksums_filename = os.path.join(self.autodir,
40 'deps/glbench/src/checksums') 31 'deps/glbench/src/checksums')
41 checksums = eval(utils.read_file(checksums_filename)) 32 checksums = eval(utils.read_file(checksums_filename))
42 33
43 board_id = get_board_id() 34 exefile = os.path.join(self.autodir, 'deps/glbench/glbench')
35 board_id = utils.system_output(site_ui.xcommand(exefile +
36 ' -get_board_id')).strip()
44 logging.info("Running on: %s", board_id) 37 logging.info("Running on: %s", board_id)
45 checksum_table = checksums.get(board_id, {}) 38 checksum_table = checksums.get(board_id, {})
46 39
47 if checksum_table: 40 if checksum_table:
48 options += ' -save' 41 options += ' -save'
49 out_dir = os.path.join(self.autodir, 'deps/glbench/src/out') 42 out_dir = os.path.join(self.autodir, 'deps/glbench/src/out')
50 else: 43 else:
51 raise error.TestFail("No checksums found for this board: %s" % board_id) 44 raise error.TestFail("No checksums found for this board: %s" % board_id)
52 45
53 exefile = os.path.join(self.autodir, 'deps/glbench/glbench')
54 cmd = "X :1 & sleep 1; DISPLAY=:1 %s %s; kill $!" % (exefile, options) 46 cmd = "X :1 & sleep 1; DISPLAY=:1 %s %s; kill $!" % (exefile, options)
55 self.results = utils.system_output(cmd, retain_output=True) 47 self.results = utils.system_output(cmd, retain_output=True)
56 48
57 keyvals = {} 49 keyvals = {}
58 failed_tests = [] 50 failed_tests = []
59 for keyval in self.results.splitlines(): 51 for keyval in self.results.splitlines():
60 if keyval.strip().startswith('#'): 52 if keyval.strip().startswith('#'):
61 continue 53 continue
62 key, val = keyval.split(':') 54 key, val = keyval.split(':')
63 testname = key.strip() 55 testname = key.strip()
64 56
65 if testname in checksum_table: 57 if testname in checksum_table:
66 if checksum_table[testname] == md5_file( 58 if checksum_table[testname] == md5_file(
67 os.path.join(out_dir, testname)): 59 os.path.join(out_dir, testname)):
68 keyvals[testname] = float(val) 60 keyvals[testname] = float(val)
69 else: 61 else:
70 keyvals[testname] = float('nan') 62 keyvals[testname] = float('nan')
71 failed_tests.append(testname) 63 failed_tests.append(testname)
72 else: 64 else:
73 logging.info('No checksum found for test %s', testname) 65 logging.info('No checksum found for test %s', testname)
74 keyvals[testname] = float(val) 66 keyvals[testname] = float(val)
75 67
76 self.write_perf_keyval(keyvals) 68 self.write_perf_keyval(keyvals)
77 if failed_tests: 69 if failed_tests:
78 raise error.TestFail("Incorrect checksums for %s" % 70 raise error.TestFail("Incorrect checksums for %s" %
79 ', '.join(failed_tests)) 71 ', '.join(failed_tests))
OLDNEW
« no previous file with comments | « client/deps/glbench/src/main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698