Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2011 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 """ | |
| 5 Runs the piglit OpenGL suite of tests. | |
| 6 """ | |
| 7 | |
| 8 import logging, os, re | |
| 9 from autotest_lib.client.bin import utils | |
| 10 from autotest_lib.client.common_lib import error | |
| 11 from autotest_lib.client.cros import cros_ui, cros_ui_test | |
| 12 | |
| 13 class graphics_Piglit(cros_ui_test.UITest): | |
|
DaleCurtis
2011/04/08 16:58:18
Are the crashes you showed me earlier in CrOS comp
| |
| 14 version = 3 | |
| 15 preserve_srcdir = True | |
| 16 | |
| 17 def setup(self): | |
| 18 self.job.setup_dep(['piglit']) | |
| 19 | |
| 20 # hard wiring the cros-driver.test config file for now | |
|
DaleCurtis
2011/04/08 16:58:18
Comment still valid?
ilja
2011/04/08 21:42:24
modified comment
| |
| 21 def run_once(self): | |
| 22 dep = 'piglit' | |
| 23 dep_dir = os.path.join(self.autodir, 'deps', dep) | |
| 24 self.job.install_pkg(dep, 'dep', dep_dir) | |
| 25 # 'results/default/graphics_Piglit/cros-driver') | |
| 26 results_path = os.path.join(self.outputdir, 'cros-driver') | |
| 27 piglit_path = os.path.join(dep_dir, 'piglit') | |
| 28 bin_path = os.path.join(piglit_path, 'bin') | |
| 29 summary = '' | |
| 30 if (os.path.exists(os.path.join(piglit_path, 'piglit-run.py')) and | |
| 31 os.path.exists(bin_path) and | |
| 32 os.listdir(bin_path)): | |
| 33 | |
| 34 os.chdir(piglit_path) | |
| 35 cmd = 'python piglit-run.py' | |
| 36 cmd = cmd + ' tests/cros-driver.tests' | |
| 37 cmd = cmd + ' ' + results_path | |
| 38 cmd = cros_ui.xcommand(cmd) | |
| 39 logging.info('Calling %s' % cmd) | |
| 40 utils.run(cmd) | |
| 41 # count number of pass, fail, warn and skip in the test summary | |
| 42 summary_path = os.path.join(results_path, 'summary') | |
| 43 f = open(summary_path, 'r') | |
| 44 summary = f.read() | |
| 45 f.close() | |
| 46 else: | |
| 47 return error.TestFail('test runs only on x86') | |
|
DaleCurtis
2011/04/08 16:58:18
Should be error.TestError.
ilja
2011/04/08 21:42:24
Done.
ilja
2011/04/08 21:42:24
Done.
| |
| 48 | |
| 49 # get passed | |
|
DaleCurtis
2011/04/08 16:58:18
Could do all three of these sections together plus
ilja
2011/04/08 21:42:24
You are right. But what I am doing here is parsing
| |
| 50 report = re.findall(r'\nresult: pass', summary) | |
| 51 if not report: | |
| 52 return error.TestFail('Output missing: pass number unknown!') | |
| 53 passed = len(report) | |
| 54 # get failed | |
| 55 report = re.findall(r'\nresult: fail', summary) | |
| 56 if not report: | |
| 57 return error.TestFail('Output missing: fail number unknown!') | |
| 58 failed = len(report) | |
| 59 # get warned | |
| 60 report = re.findall(r'\nresult: warn', summary) | |
| 61 if not report: | |
| 62 return error.TestFail('Output missing: warn number unknown!') | |
| 63 warned = len(report) | |
| 64 # get skipped | |
| 65 report = re.findall(r'\nresult: skip', summary) | |
| 66 if not report: | |
| 67 return error.TestFail('Output missing: skip number unknown!') | |
| 68 skipped = len(report) | |
| 69 | |
| 70 # doesn't seem to send it to the host console | |
| 71 logging.info('Piglit: %d pass', passed) | |
| 72 logging.info('Piglit: %d fail', failed) | |
| 73 logging.info('Piglit: %d warn', warned) | |
| 74 logging.info('Piglit: %d skip', skipped) | |
| 75 | |
| 76 # output numbers for plotting by harness | |
| 77 keyvals = {} | |
| 78 keyvals['count_subtests_pass'] = passed | |
| 79 keyvals['count_subtests_fail'] = failed | |
| 80 keyvals['count_subtests_warn'] = warned | |
| 81 keyvals['count_subtests_skip'] = skipped | |
| 82 self.write_perf_keyval(keyvals) | |
| 83 | |
| 84 # generate human friendly html output | |
| 85 cmd = 'python piglit-summary-html.py' | |
| 86 cmd = cmd + ' ' + os.path.join(results_path, 'html') | |
| 87 cmd = cmd + ' ' + results_path | |
| 88 utils.run(cmd) | |
| 89 | |
| OLD | NEW |