Index: client/site_tests/graphics_Piglit/graphics_Piglit.py |
diff --git a/client/site_tests/graphics_Piglit/graphics_Piglit.py b/client/site_tests/graphics_Piglit/graphics_Piglit.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2ce2f2c1a804a4abe569c5fdd8c4665928b3212d |
--- /dev/null |
+++ b/client/site_tests/graphics_Piglit/graphics_Piglit.py |
@@ -0,0 +1,82 @@ |
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+""" |
+Runs the piglit OpenGL suite of tests. |
+""" |
+ |
+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.
|
+from autotest_lib.client.bin import utils |
+from autotest_lib.client.common_lib import error |
+from autotest_lib.client.cros import cros_ui, cros_ui_test |
+ |
+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,
|
+ version = 1 |
+ preserve_srcdir = True |
+ |
+ def setup(self, tarball='piglit.tar.gz'): |
+ dst_path = os.path.join(self.bindir, 'piglit') |
+ #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
|
+ sysroot = os.environ['SYSROOT'] |
+ packages_path = os.path.join(sysroot, "usr/local/autotest/packages") |
+ tarball_path = os.path.join(packages_path, tarball) |
+ utils.extract_tarball_to_dir(tarball_path, dst_path) |
+ |
+ # hard wiring the cros-driver.test config file for now |
+ def run_once(self): |
+ 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.
|
+ "../../results/default/graphics_Piglit/cros-driver") |
+ os.chdir(os.path.join(self.bindir, 'piglit')) |
+ cmd = "python piglit-run.py" |
+ cmd = cmd + " tests/cros-driver.tests" |
+ cmd = cmd + " " + results_path |
+ cmd = cros_ui.xcommand(cmd) |
+ utils.run(cmd) |
+ |
+ # count number of pass, fail, warn and skip in the test summary |
+ summary_path = os.path.join(results_path, "summary") |
+ f = open(summary_path, 'r') |
+ summary = f.read() |
+ f.close() |
+ |
+ # get passed |
+ report = re.findall(r"\nresult: pass", summary) |
+ if not report: |
+ return error.TestFail('Output missing: pass number unknown!') |
+ passed = len(report) |
+ # get failed |
+ report = re.findall(r"\nresult: fail", summary) |
+ if not report: |
+ return error.TestFail('Output missing: fail number unknown!') |
+ failed = len(report) |
+ # get warned |
+ report = re.findall(r"\nresult: warn", summary) |
+ if not report: |
+ return error.TestFail('Output missing: warn number unknown!') |
+ warned = len(report) |
+ # get skipped |
+ report = re.findall(r"\nresult: skip", summary) |
+ if not report: |
+ return error.TestFail('Output missing: skip number unknown!') |
+ skipped = len(report) |
+ |
+ # doesn't seem to send it to the host console |
+ logging.info('Piglit: %d pass', passed) |
+ logging.info('Piglit: %d fail', failed) |
+ logging.info('Piglit: %d warn', warned) |
+ logging.info('Piglit: %d skip', skipped) |
+ |
+ # output numbers for plotting by harness |
+ keyvals = {} |
+ keyvals['count_subtests_pass'] = passed |
+ keyvals['count_subtests_fail'] = failed |
+ keyvals['count_subtests_warn'] = warned |
+ keyvals['count_subtests_skip'] = skipped |
+ self.write_perf_keyval(keyvals) |
+ |
+ # generate human friendly html output |
+ cmd = "python piglit-summary-html.py" |
+ cmd = cmd + " " + os.path.join(results_path, "html") |
+ cmd = cmd + " " + results_path |
+ utils.run(cmd) |
+ |