Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: client/site_tests/graphics_TearTest/graphics_TearTest.py

Issue 2047001: Added teartest UI. (Closed) Base URL: ssh://git@chromiumos-git//autotest.git
Patch Set: List failed tests in the exception message. Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/site_tests/graphics_TearTest/control ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2010 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 import logging, os
6
7 from autotest_lib.client.bin import site_login, site_ui_test
8 from autotest_lib.client.common_lib import error, site_ui, utils
9
10
11 def html_button(label, onclick=None):
12 return ('''<input type="button" value="%s" onclick="do_submit('%s')"/>''' %
13 (label, onclick if onclick else label))
14
15 TEMPLATE = '''
16 <h5>{0}</h5>
17 <table>
18 <tr> <td>{1[0][desc]}</td> <td>{1[0][result]}</td> </tr>
19 <tr> <td>{1[1][desc]}</td> <td>{1[1][result]}</td> </tr>
20 <tr> <td>{1[2][desc]}</td> <td>{1[2][result]}</td> </tr>
21 </table>
22 '''
23
24 class graphics_TearTest(site_ui_test.UITest):
25 version = 1
26
27
28 def setup(self):
29 self.job.setup_dep(['glbench'])
30
31
32 def run_once(self):
33 dep = 'glbench'
34 dep_dir = os.path.join(self.autodir, 'deps', dep)
35 self.job.install_pkg(dep, 'dep', dep_dir)
36
37 exefile = os.path.join(self.autodir, 'deps/glbench/teartest')
38
39 while True:
40 tests = [
41 dict(cmd=exefile+' --tests uniform',
42 desc='Uniform updates', result=''),
43 dict(cmd=exefile+' --tests teximage2d',
44 desc='glTexImage2D updates', result=''),
45 dict(cmd=exefile+' --tests pixmap',
46 desc='Pixmap to texture', result=''),
47 ]
48
49 header = ("These tests check vertical synchronization. You will " +
50 "see two vertical lines scrolling horizontally. The test " +
51 "passes if lines stay straight with no tearing.<br/>" +
52 html_button('Start'))
53 dialog = site_ui.Dialog(question=TEMPLATE.format(header, tests),
54 choices=[])
55 result = dialog.get_result()
56
57 header = html_button('Restart')
58
59 for test in tests:
60 cmd = test['cmd']
61 logging.info("command launched: %s" % cmd)
62 utils.system(site_ui.xcommand(cmd))
63
64 test['result'] = html_button('Pass') + html_button('Fail')
65 dialog = site_ui.Dialog(question=TEMPLATE.format(header, tests),
66 choices=[])
67 result = dialog.get_result()
68 test['result'] = result if result else 'Timeout'
69
70 passed = all(test['result'] == 'Pass' for test in tests)
71 header = ("Test %s.<br/>" % ("passed" if passed else "failed") +
72 html_button('Done') + html_button('Restart'))
73 dialog = site_ui.Dialog(question=TEMPLATE.format(header, tests),
74 choices=[])
75 result = dialog.get_result()
76
77 if result != 'Restart':
78 break
79
80 if not passed:
81 raise error.TestFail('Failed: ' +
82 ', '.join(test['desc'] for test in tests
83 if test['result'] != 'Pass'))
OLDNEW
« no previous file with comments | « client/site_tests/graphics_TearTest/control ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698