OLD | NEW |
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 os | 5 import os |
6 | 6 |
7 from autotest_lib.client.bin import test | 7 from autotest_lib.client.bin import test |
8 from autotest_lib.client.common_lib import utils | 8 from autotest_lib.client.common_lib import utils |
9 | 9 |
10 class gl_Bench(test.test): | 10 class gl_Bench(test.test): |
11 version = 1 | 11 version = 1 |
12 preserve_srcdir = True | 12 preserve_srcdir = True |
13 | 13 |
14 def setup(self): | 14 def setup(self): |
15 os.chdir(self.srcdir) | 15 self.job.setup_dep(['glbench']) |
16 utils.system('make clean') | |
17 utils.system('make') | |
18 | 16 |
19 | 17 |
20 def run_once(self, options=''): | 18 def run_once(self, options=''): |
21 exefile = os.path.join(self.bindir, 'gl_Bench') | 19 dep = 'glbench' |
| 20 dep_dir = os.path.join(self.autodir, 'deps', dep) |
| 21 self.job.install_pkg(dep, 'dep', dep_dir) |
| 22 |
| 23 exefile = os.path.join(self.autodir, 'deps/glbench/glbench') |
22 cmd = "X :1 & sleep 1; DISPLAY=:1 %s %s; kill $!" % (exefile, options) | 24 cmd = "X :1 & sleep 1; DISPLAY=:1 %s %s; kill $!" % (exefile, options) |
23 self.results = utils.system_output(cmd, retain_output=True) | 25 self.results = utils.system_output(cmd, retain_output=True) |
24 | 26 |
25 keyvals = {} | 27 keyvals = {} |
26 for keyval in self.results.splitlines(): | 28 for keyval in self.results.splitlines(): |
27 if keyval.strip().startswith('#'): | 29 if keyval.strip().startswith('#'): |
28 continue | 30 continue |
29 key, val = keyval.split(':') | 31 key, val = keyval.split(':') |
30 keyvals[key.strip()] = float(val) | 32 keyvals[key.strip()] = float(val) |
31 | 33 |
32 self.write_perf_keyval(keyvals) | 34 self.write_perf_keyval(keyvals) |
OLD | NEW |