| 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 os.chdir(self.srcdir) |
| 16 utils.system('make clean') | 16 utils.system('make clean') |
| 17 utils.system('make') | 17 utils.system('make') |
| 18 | 18 |
| 19 | 19 |
| 20 def run_once(self, options=''): | 20 def run_once(self, options=''): |
| 21 exefile = os.path.join(self.bindir, 'gl_Bench') | 21 exefile = os.path.join(self.bindir, 'gl_Bench') |
| 22 cmd = "X :1 & sleep 1; DISPLAY=:1 %s %s; kill $!" % (exefile, options) | 22 cmd = "X :1 & sleep 1; DISPLAY=:1 %s %s; kill $!" % (exefile, options) |
| 23 self.results = utils.system_output(cmd, retain_output=True) | 23 self.results = utils.system_output(cmd, retain_output=True) |
| 24 | 24 |
| 25 for keyval in self.results.splitlines(): | 25 keyvals = {} |
| 26 if keyval.strip().startswith('#'): | 26 for keyval in self.results.splitlines(): |
| 27 » continue | 27 if keyval.strip().startswith('#'): |
| 28 key, val = keyval.split(':') | 28 continue |
| 29 self.write_perf_keyval({key.strip(): val.strip()}) | 29 key, val = keyval.split(':') |
| 30 keyvals[key.strip()] = float(val) |
| 31 |
| 32 self.write_perf_keyval(keyvals) |
| OLD | NEW |