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

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

Issue 1874973003: [test] Simplify progress indicators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 | « tools/testrunner/local/execution.py ('k') | tools/testrunner/network/network_execution.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 def SetRunner(self, runner): 48 def SetRunner(self, runner):
49 self.runner = runner 49 self.runner = runner
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):
58 pass
59
60 def HasRun(self, test, has_unexpected_output): 57 def HasRun(self, test, has_unexpected_output):
61 pass 58 pass
62 59
63 def Heartbeat(self): 60 def Heartbeat(self):
64 pass 61 pass
65 62
66 def PrintFailureHeader(self, test): 63 def PrintFailureHeader(self, test):
67 if test.suite.IsNegativeTest(test): 64 if test.suite.IsNegativeTest(test):
68 negative_marker = '[negative] ' 65 negative_marker = '[negative] '
69 else: 66 else:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 print 137 print
141 print "===" 138 print "==="
142 print "=== %i tests failed" % len(self.runner.failed) 139 print "=== %i tests failed" % len(self.runner.failed)
143 if self.runner.crashed > 0: 140 if self.runner.crashed > 0:
144 print "=== %i tests CRASHED" % self.runner.crashed 141 print "=== %i tests CRASHED" % self.runner.crashed
145 print "===" 142 print "==="
146 143
147 144
148 class VerboseProgressIndicator(SimpleProgressIndicator): 145 class VerboseProgressIndicator(SimpleProgressIndicator):
149 146
150 def AboutToRun(self, test):
151 print 'Starting %s...' % test.GetLabel()
152 sys.stdout.flush()
153
154 def HasRun(self, test, has_unexpected_output): 147 def HasRun(self, test, has_unexpected_output):
155 if has_unexpected_output: 148 if has_unexpected_output:
156 if test.output.HasCrashed(): 149 if test.output.HasCrashed():
157 outcome = 'CRASH' 150 outcome = 'CRASH'
158 else: 151 else:
159 outcome = 'FAIL' 152 outcome = 'FAIL'
160 else: 153 else:
161 outcome = 'pass' 154 outcome = 'pass'
162 print 'Done running %s: %s' % (test.GetLabel(), outcome) 155 print 'Done running %s: %s' % (test.GetLabel(), outcome)
163 sys.stdout.flush() 156 sys.stdout.flush()
(...skipping 30 matching lines...) Expand all
194 def __init__(self, templates): 187 def __init__(self, templates):
195 super(CompactProgressIndicator, self).__init__() 188 super(CompactProgressIndicator, self).__init__()
196 self.templates = templates 189 self.templates = templates
197 self.last_status_length = 0 190 self.last_status_length = 0
198 self.start_time = time.time() 191 self.start_time = time.time()
199 192
200 def Done(self): 193 def Done(self):
201 self.PrintProgress('Done') 194 self.PrintProgress('Done')
202 print "" # Line break. 195 print "" # Line break.
203 196
204 def AboutToRun(self, test): 197 def HasRun(self, test, has_unexpected_output):
205 self.PrintProgress(test.GetLabel()) 198 self.PrintProgress(test.GetLabel())
206
207 def HasRun(self, test, has_unexpected_output):
208 if has_unexpected_output: 199 if has_unexpected_output:
209 self.ClearLine(self.last_status_length) 200 self.ClearLine(self.last_status_length)
210 self.PrintFailureHeader(test) 201 self.PrintFailureHeader(test)
211 stdout = test.output.stdout.strip() 202 stdout = test.output.stdout.strip()
212 if len(stdout): 203 if len(stdout):
213 print self.templates['stdout'] % stdout 204 print self.templates['stdout'] % stdout
214 stderr = test.output.stderr.strip() 205 stderr = test.output.stderr.strip()
215 if len(stderr): 206 if len(stderr):
216 print self.templates['stderr'] % stderr 207 print self.templates['stderr'] % stderr
217 print "Command: %s" % self._EscapeCommand(test) 208 print "Command: %s" % self._EscapeCommand(test)
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 "variant": test.variant, 379 "variant": test.variant,
389 }) 380 })
390 381
391 382
392 PROGRESS_INDICATORS = { 383 PROGRESS_INDICATORS = {
393 'verbose': VerboseProgressIndicator, 384 'verbose': VerboseProgressIndicator,
394 'dots': DotsProgressIndicator, 385 'dots': DotsProgressIndicator,
395 'color': ColorProgressIndicator, 386 'color': ColorProgressIndicator,
396 'mono': MonochromeProgressIndicator 387 'mono': MonochromeProgressIndicator
397 } 388 }
OLDNEW
« no previous file with comments | « tools/testrunner/local/execution.py ('k') | tools/testrunner/network/network_execution.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698