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

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

Issue 1152303003: [test] Remove default for zero test cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.4
Patch Set: Created 5 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
« no previous file with comments | « tools/run-tests.py ('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
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 def Truncate(self, string, length): 193 def Truncate(self, string, length):
194 if length and (len(string) > (length - 3)): 194 if length and (len(string) > (length - 3)):
195 return string[:(length - 3)] + "..." 195 return string[:(length - 3)] + "..."
196 else: 196 else:
197 return string 197 return string
198 198
199 def PrintProgress(self, name): 199 def PrintProgress(self, name):
200 self.ClearLine(self.last_status_length) 200 self.ClearLine(self.last_status_length)
201 elapsed = time.time() - self.start_time 201 elapsed = time.time() - self.start_time
202 progress = 0 if not self.runner.total else (
203 ((self.runner.total - self.runner.remaining) * 100) //
204 self.runner.total)
202 status = self.templates['status_line'] % { 205 status = self.templates['status_line'] % {
203 'passed': self.runner.succeeded, 206 'passed': self.runner.succeeded,
204 'remaining': (((self.runner.total - self.runner.remaining) * 100) // 207 'progress': progress,
205 self.runner.total),
206 'failed': len(self.runner.failed), 208 'failed': len(self.runner.failed),
207 'test': name, 209 'test': name,
208 'mins': int(elapsed) / 60, 210 'mins': int(elapsed) / 60,
209 'secs': int(elapsed) % 60 211 'secs': int(elapsed) % 60
210 } 212 }
211 status = self.Truncate(status, 78) 213 status = self.Truncate(status, 78)
212 self.last_status_length = len(status) 214 self.last_status_length = len(status)
213 print status, 215 print status,
214 sys.stdout.flush() 216 sys.stdout.flush()
215 217
216 218
217 class ColorProgressIndicator(CompactProgressIndicator): 219 class ColorProgressIndicator(CompactProgressIndicator):
218 220
219 def __init__(self): 221 def __init__(self):
220 templates = { 222 templates = {
221 'status_line': ("[%(mins)02i:%(secs)02i|" 223 'status_line': ("[%(mins)02i:%(secs)02i|"
222 "\033[34m%%%(remaining) 4d\033[0m|" 224 "\033[34m%%%(progress) 4d\033[0m|"
223 "\033[32m+%(passed) 4d\033[0m|" 225 "\033[32m+%(passed) 4d\033[0m|"
224 "\033[31m-%(failed) 4d\033[0m]: %(test)s"), 226 "\033[31m-%(failed) 4d\033[0m]: %(test)s"),
225 'stdout': "\033[1m%s\033[0m", 227 'stdout': "\033[1m%s\033[0m",
226 'stderr': "\033[31m%s\033[0m", 228 'stderr': "\033[31m%s\033[0m",
227 } 229 }
228 super(ColorProgressIndicator, self).__init__(templates) 230 super(ColorProgressIndicator, self).__init__(templates)
229 231
230 def ClearLine(self, last_line_length): 232 def ClearLine(self, last_line_length):
231 print "\033[1K\r", 233 print "\033[1K\r",
232 234
233 235
234 class MonochromeProgressIndicator(CompactProgressIndicator): 236 class MonochromeProgressIndicator(CompactProgressIndicator):
235 237
236 def __init__(self): 238 def __init__(self):
237 templates = { 239 templates = {
238 'status_line': ("[%(mins)02i:%(secs)02i|%%%(remaining) 4d|" 240 'status_line': ("[%(mins)02i:%(secs)02i|%%%(progress) 4d|"
239 "+%(passed) 4d|-%(failed) 4d]: %(test)s"), 241 "+%(passed) 4d|-%(failed) 4d]: %(test)s"),
240 'stdout': '%s', 242 'stdout': '%s',
241 'stderr': '%s', 243 'stderr': '%s',
242 } 244 }
243 super(MonochromeProgressIndicator, self).__init__(templates) 245 super(MonochromeProgressIndicator, self).__init__(templates)
244 246
245 def ClearLine(self, last_line_length): 247 def ClearLine(self, last_line_length):
246 print ("\r" + (" " * last_line_length) + "\r"), 248 print ("\r" + (" " * last_line_length) + "\r"),
247 249
248 250
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 "duration": test.duration, 363 "duration": test.duration,
362 }) 364 })
363 365
364 366
365 PROGRESS_INDICATORS = { 367 PROGRESS_INDICATORS = {
366 'verbose': VerboseProgressIndicator, 368 'verbose': VerboseProgressIndicator,
367 'dots': DotsProgressIndicator, 369 'dots': DotsProgressIndicator,
368 'color': ColorProgressIndicator, 370 'color': ColorProgressIndicator,
369 'mono': MonochromeProgressIndicator 371 'mono': MonochromeProgressIndicator
370 } 372 }
OLDNEW
« no previous file with comments | « tools/run-tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698