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..2d80d1d45c5c3877893e3a2b586ee51ca48c3ea7 |
--- /dev/null |
+++ b/client/site_tests/graphics_Piglit/graphics_Piglit.py |
@@ -0,0 +1,92 @@ |
+# 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 |
+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): |
+ version = 1 |
+ preserve_srcdir = True |
+ |
+ def setup(self, tarball='piglit.tar.gz'): |
+ tarball_path = os.path.join(self.srcdir, tarball) |
+ dst_path = os.path.join(self.bindir, 'piglit') |
+ # in-source build, overwrite destination |
+ shutil.rmtree(dst_path, ignore_errors=True) |
+ utils.extract_tarball_to_dir(tarball_path, dst_path) |
+ # patch in a single config file for now |
+ shutil.copyfile(os.path.join(self.srcdir, 'cros-driver.tests'), |
+ os.path.join(dst_path, 'tests/cros-driver.tests')) |
+ os.chdir(dst_path) |
+ # we have to tell cmake where to find glut |
+ sysroot = os.environ['SYSROOT'] |
DaleCurtis
2011/04/04 17:51:56
I'm not positive this will work properly on the bu
|
+ cmd = 'cmake -DCMAKE_FIND_ROOT_PATH=' + sysroot |
+ cmd = cmd + ' -DGLUT_INCLUDE_DIR=' + sysroot + '/usr/include' |
+ cmd = cmd + ' -DGLUT_glut_LIBRARY=' + sysroot + '/usr/lib/libglut.so' |
+ utils.run(cmd) |
+ utils.make('-j %d' % utils.count_cpus()) |
+ |
+ # hard wiring the cros-driver.test config file for now |
+ def run_once(self): |
+ # "results/default/graphics_Piglit/cros-driver") |
+ results_path = os.path.join(self.outputdir, "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) |
+ |