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 | |
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): | |
14 version = 1 | |
15 preserve_srcdir = True | |
16 | |
17 def setup(self, tarball='piglit.tar.gz'): | |
18 tarball_path = os.path.join(self.srcdir, tarball) | |
19 dst_path = os.path.join(self.bindir, 'piglit') | |
20 # in-source build, overwrite destination | |
21 shutil.rmtree(dst_path, ignore_errors=True) | |
22 utils.extract_tarball_to_dir(tarball_path, dst_path) | |
23 # patch in a single config file for now | |
24 shutil.copyfile(os.path.join(self.srcdir, 'cros-driver.tests'), | |
25 os.path.join(dst_path, 'tests/cros-driver.tests')) | |
26 os.chdir(dst_path) | |
27 # we have to tell cmake where to find glut | |
28 sysroot = os.environ['SYSROOT'] | |
DaleCurtis
2011/04/04 17:51:56
I'm not positive this will work properly on the bu
| |
29 cmd = 'cmake -DCMAKE_FIND_ROOT_PATH=' + sysroot | |
30 cmd = cmd + ' -DGLUT_INCLUDE_DIR=' + sysroot + '/usr/include' | |
31 cmd = cmd + ' -DGLUT_glut_LIBRARY=' + sysroot + '/usr/lib/libglut.so' | |
32 utils.run(cmd) | |
33 utils.make('-j %d' % utils.count_cpus()) | |
34 | |
35 # hard wiring the cros-driver.test config file for now | |
36 def run_once(self): | |
37 # "results/default/graphics_Piglit/cros-driver") | |
38 results_path = os.path.join(self.outputdir, "cros-driver") | |
39 os.chdir(os.path.join(self.bindir, 'piglit')) | |
40 cmd = "python piglit-run.py" | |
41 cmd = cmd + " tests/cros-driver.tests" | |
42 cmd = cmd + " " + results_path | |
43 cmd = cros_ui.xcommand(cmd) | |
44 utils.run(cmd) | |
45 | |
46 # count number of pass, fail, warn and skip in the test summary | |
47 summary_path = os.path.join(results_path, "summary") | |
48 f = open(summary_path, 'r') | |
49 summary = f.read() | |
50 f.close() | |
51 | |
52 # get passed | |
53 report = re.findall(r"\nresult: pass", summary) | |
54 if not report: | |
55 return error.TestFail('Output missing: pass number unknown!') | |
56 passed = len(report) | |
57 # get failed | |
58 report = re.findall(r"\nresult: fail", summary) | |
59 if not report: | |
60 return error.TestFail('Output missing: fail number unknown!') | |
61 failed = len(report) | |
62 # get warned | |
63 report = re.findall(r"\nresult: warn", summary) | |
64 if not report: | |
65 return error.TestFail('Output missing: warn number unknown!') | |
66 warned = len(report) | |
67 # get skipped | |
68 report = re.findall(r"\nresult: skip", summary) | |
69 if not report: | |
70 return error.TestFail('Output missing: skip number unknown!') | |
71 skipped = len(report) | |
72 | |
73 # doesn't seem to send it to the host console | |
74 logging.info('Piglit: %d pass', passed) | |
75 logging.info('Piglit: %d fail', failed) | |
76 logging.info('Piglit: %d warn', warned) | |
77 logging.info('Piglit: %d skip', skipped) | |
78 | |
79 # output numbers for plotting by harness | |
80 keyvals = {} | |
81 keyvals['count_subtests_pass'] = passed | |
82 keyvals['count_subtests_fail'] = failed | |
83 keyvals['count_subtests_warn'] = warned | |
84 keyvals['count_subtests_skip'] = skipped | |
85 self.write_perf_keyval(keyvals) | |
86 | |
87 # generate human friendly html output | |
88 cmd = "python piglit-summary-html.py" | |
89 cmd = cmd + " " + os.path.join(results_path, "html") | |
90 cmd = cmd + " " + results_path | |
91 utils.run(cmd) | |
92 | |
OLD | NEW |