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

Side by Side Diff: tools/testrunner/local/progress.py

Issue 17089003: Optimized test output checking - avoid redundant checks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « tools/testrunner/local/execution.py ('k') | tools/testrunner/network/endpoint.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 def Starting(self): 51 def Starting(self):
52 pass 52 pass
53 53
54 def Done(self): 54 def Done(self):
55 pass 55 pass
56 56
57 def AboutToRun(self, test): 57 def AboutToRun(self, test):
58 pass 58 pass
59 59
60 def HasRun(self, test): 60 def HasRun(self, test, has_unexpected_output):
61 pass 61 pass
62 62
63 def PrintFailureHeader(self, test): 63 def PrintFailureHeader(self, test):
64 if test.suite.IsNegativeTest(test): 64 if test.suite.IsNegativeTest(test):
65 negative_marker = '[negative] ' 65 negative_marker = '[negative] '
66 else: 66 else:
67 negative_marker = '' 67 negative_marker = ''
68 print "=== %(label)s %(negative)s===" % { 68 print "=== %(label)s %(negative)s===" % {
69 'label': test.GetLabel(), 69 'label': test.GetLabel(),
70 'negative': negative_marker 70 'negative': negative_marker
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 print "=== %i tests CRASHED" % self.runner.crashed 104 print "=== %i tests CRASHED" % self.runner.crashed
105 print "===" 105 print "==="
106 106
107 107
108 class VerboseProgressIndicator(SimpleProgressIndicator): 108 class VerboseProgressIndicator(SimpleProgressIndicator):
109 109
110 def AboutToRun(self, test): 110 def AboutToRun(self, test):
111 print 'Starting %s...' % test.GetLabel() 111 print 'Starting %s...' % test.GetLabel()
112 sys.stdout.flush() 112 sys.stdout.flush()
113 113
114 def HasRun(self, test): 114 def HasRun(self, test, has_unexpected_output):
115 if test.suite.HasUnexpectedOutput(test): 115 if has_unexpected_output:
116 if test.output.HasCrashed(): 116 if test.output.HasCrashed():
117 outcome = 'CRASH' 117 outcome = 'CRASH'
118 else: 118 else:
119 outcome = 'FAIL' 119 outcome = 'FAIL'
120 else: 120 else:
121 outcome = 'pass' 121 outcome = 'pass'
122 print 'Done running %s: %s' % (test.GetLabel(), outcome) 122 print 'Done running %s: %s' % (test.GetLabel(), outcome)
123 123
124 124
125 class DotsProgressIndicator(SimpleProgressIndicator): 125 class DotsProgressIndicator(SimpleProgressIndicator):
126 126
127 def HasRun(self, test): 127 def HasRun(self, test, has_unexpected_output):
128 total = self.runner.succeeded + len(self.runner.failed) 128 total = self.runner.succeeded + len(self.runner.failed)
129 if (total > 1) and (total % 50 == 1): 129 if (total > 1) and (total % 50 == 1):
130 sys.stdout.write('\n') 130 sys.stdout.write('\n')
131 if test.suite.HasUnexpectedOutput(test): 131 if has_unexpected_output:
132 if test.output.HasCrashed(): 132 if test.output.HasCrashed():
133 sys.stdout.write('C') 133 sys.stdout.write('C')
134 sys.stdout.flush() 134 sys.stdout.flush()
135 elif test.output.HasTimedOut(): 135 elif test.output.HasTimedOut():
136 sys.stdout.write('T') 136 sys.stdout.write('T')
137 sys.stdout.flush() 137 sys.stdout.flush()
138 else: 138 else:
139 sys.stdout.write('F') 139 sys.stdout.write('F')
140 sys.stdout.flush() 140 sys.stdout.flush()
141 else: 141 else:
(...skipping 10 matching lines...) Expand all
152 self.last_status_length = 0 152 self.last_status_length = 0
153 self.start_time = time.time() 153 self.start_time = time.time()
154 154
155 def Done(self): 155 def Done(self):
156 self.PrintProgress('Done') 156 self.PrintProgress('Done')
157 print "" # Line break. 157 print "" # Line break.
158 158
159 def AboutToRun(self, test): 159 def AboutToRun(self, test):
160 self.PrintProgress(test.GetLabel()) 160 self.PrintProgress(test.GetLabel())
161 161
162 def HasRun(self, test): 162 def HasRun(self, test, has_unexpected_output):
163 if test.suite.HasUnexpectedOutput(test): 163 if has_unexpected_output:
164 self.ClearLine(self.last_status_length) 164 self.ClearLine(self.last_status_length)
165 self.PrintFailureHeader(test) 165 self.PrintFailureHeader(test)
166 stdout = test.output.stdout.strip() 166 stdout = test.output.stdout.strip()
167 if len(stdout): 167 if len(stdout):
168 print self.templates['stdout'] % stdout 168 print self.templates['stdout'] % stdout
169 stderr = test.output.stderr.strip() 169 stderr = test.output.stderr.strip()
170 if len(stderr): 170 if len(stderr):
171 print self.templates['stderr'] % stderr 171 print self.templates['stderr'] % stderr
172 print "Command: %s" % EscapeCommand(self.runner.GetCommand(test)) 172 print "Command: %s" % EscapeCommand(self.runner.GetCommand(test))
173 if test.output.HasCrashed(): 173 if test.output.HasCrashed():
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 def Done(self): 249 def Done(self):
250 self.progress_indicator.Done() 250 self.progress_indicator.Done()
251 self.outputter.FinishAndWrite(self.outfile) 251 self.outputter.FinishAndWrite(self.outfile)
252 if self.outfile != sys.stdout: 252 if self.outfile != sys.stdout:
253 self.outfile.close() 253 self.outfile.close()
254 254
255 def AboutToRun(self, test): 255 def AboutToRun(self, test):
256 self.progress_indicator.AboutToRun(test) 256 self.progress_indicator.AboutToRun(test)
257 257
258 def HasRun(self, test): 258 def HasRun(self, test, has_unexpected_output):
259 self.progress_indicator.HasRun(test) 259 self.progress_indicator.HasRun(test, has_unexpected_output)
260 fail_text = "" 260 fail_text = ""
261 if test.suite.HasUnexpectedOutput(test): 261 if has_unexpected_output:
262 stdout = test.output.stdout.strip() 262 stdout = test.output.stdout.strip()
263 if len(stdout): 263 if len(stdout):
264 fail_text += "stdout:\n%s\n" % stdout 264 fail_text += "stdout:\n%s\n" % stdout
265 stderr = test.output.stderr.strip() 265 stderr = test.output.stderr.strip()
266 if len(stderr): 266 if len(stderr):
267 fail_text += "stderr:\n%s\n" % stderr 267 fail_text += "stderr:\n%s\n" % stderr
268 fail_text += "Command: %s" % EscapeCommand(self.runner.GetCommand(test)) 268 fail_text += "Command: %s" % EscapeCommand(self.runner.GetCommand(test))
269 if test.output.HasCrashed(): 269 if test.output.HasCrashed():
270 fail_text += "exit code: %d\n--- CRASHED ---" % test.output.exit_code 270 fail_text += "exit code: %d\n--- CRASHED ---" % test.output.exit_code
271 if test.output.HasTimedOut(): 271 if test.output.HasTimedOut():
272 fail_text += "--- TIMEOUT ---" 272 fail_text += "--- TIMEOUT ---"
273 self.outputter.HasRunTest( 273 self.outputter.HasRunTest(
274 [test.GetLabel()] + self.runner.context.mode_flags + test.flags, 274 [test.GetLabel()] + self.runner.context.mode_flags + test.flags,
275 test.duration, 275 test.duration,
276 fail_text) 276 fail_text)
277 277
278 278
279 PROGRESS_INDICATORS = { 279 PROGRESS_INDICATORS = {
280 'verbose': VerboseProgressIndicator, 280 'verbose': VerboseProgressIndicator,
281 'dots': DotsProgressIndicator, 281 'dots': DotsProgressIndicator,
282 'color': ColorProgressIndicator, 282 'color': ColorProgressIndicator,
283 'mono': MonochromeProgressIndicator 283 'mono': MonochromeProgressIndicator
284 } 284 }
OLDNEW
« no previous file with comments | « tools/testrunner/local/execution.py ('k') | tools/testrunner/network/endpoint.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698