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, shutil | |
|
DaleCurtis
2011/03/26 00:58:57
Unused shutil.
ilja
2011/03/30 05:26:49
It is used now to copy a file.
| |
| 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/03/26 00:58:57
You should be fine with test.test here, you're not
ilja
2011/03/30 05:26:49
Will keep UItest for now.
On 2011/03/26 00:58:57,
| |
| 14 version = 1 | |
| 15 preserve_srcdir = True | |
| 16 | |
| 17 def setup(self, tarball='piglit.tar.gz'): | |
| 18 dst_path = os.path.join(self.bindir, 'piglit') | |
| 19 #if not os.path.exists(dst_path): | |
|
DaleCurtis
2011/03/26 00:58:57
If you go the ebuild route, the tarball should be
ilja
2011/03/30 05:26:49
I've decided to not use ebuild and follow the sugg
| |
| 20 sysroot = os.environ['SYSROOT'] | |
| 21 packages_path = os.path.join(sysroot, "usr/local/autotest/packages") | |
| 22 tarball_path = os.path.join(packages_path, tarball) | |
| 23 utils.extract_tarball_to_dir(tarball_path, dst_path) | |
| 24 | |
| 25 # hard wiring the cros-driver.test config file for now | |
| 26 def run_once(self): | |
| 27 results_path = os.path.join(self.bindir, | |
|
DaleCurtis
2011/03/26 00:58:57
self.outputdir + '/cros-driver' should work.
Ther
ilja
2011/03/30 05:26:49
Done.
| |
| 28 "../../results/default/graphics_Piglit/cros-driver") | |
| 29 os.chdir(os.path.join(self.bindir, 'piglit')) | |
| 30 cmd = "python piglit-run.py" | |
| 31 cmd = cmd + " tests/cros-driver.tests" | |
| 32 cmd = cmd + " " + results_path | |
| 33 cmd = cros_ui.xcommand(cmd) | |
| 34 utils.run(cmd) | |
| 35 | |
| 36 # count number of pass, fail, warn and skip in the test summary | |
| 37 summary_path = os.path.join(results_path, "summary") | |
| 38 f = open(summary_path, 'r') | |
| 39 summary = f.read() | |
| 40 f.close() | |
| 41 | |
| 42 # get passed | |
| 43 report = re.findall(r"\nresult: pass", summary) | |
| 44 if not report: | |
| 45 return error.TestFail('Output missing: pass number unknown!') | |
| 46 passed = len(report) | |
| 47 # get failed | |
| 48 report = re.findall(r"\nresult: fail", summary) | |
| 49 if not report: | |
| 50 return error.TestFail('Output missing: fail number unknown!') | |
| 51 failed = len(report) | |
| 52 # get warned | |
| 53 report = re.findall(r"\nresult: warn", summary) | |
| 54 if not report: | |
| 55 return error.TestFail('Output missing: warn number unknown!') | |
| 56 warned = len(report) | |
| 57 # get skipped | |
| 58 report = re.findall(r"\nresult: skip", summary) | |
| 59 if not report: | |
| 60 return error.TestFail('Output missing: skip number unknown!') | |
| 61 skipped = len(report) | |
| 62 | |
| 63 # doesn't seem to send it to the host console | |
| 64 logging.info('Piglit: %d pass', passed) | |
| 65 logging.info('Piglit: %d fail', failed) | |
| 66 logging.info('Piglit: %d warn', warned) | |
| 67 logging.info('Piglit: %d skip', skipped) | |
| 68 | |
| 69 # output numbers for plotting by harness | |
| 70 keyvals = {} | |
| 71 keyvals['count_subtests_pass'] = passed | |
| 72 keyvals['count_subtests_fail'] = failed | |
| 73 keyvals['count_subtests_warn'] = warned | |
| 74 keyvals['count_subtests_skip'] = skipped | |
| 75 self.write_perf_keyval(keyvals) | |
| 76 | |
| 77 # generate human friendly html output | |
| 78 cmd = "python piglit-summary-html.py" | |
| 79 cmd = cmd + " " + os.path.join(results_path, "html") | |
| 80 cmd = cmd + " " + results_path | |
| 81 utils.run(cmd) | |
| 82 | |
| OLD | NEW |