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

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

Issue 1153103008: [test] Remove default for zero test cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.3
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 def Truncate(self, string, length): 186 def Truncate(self, string, length):
187 if length and (len(string) > (length - 3)): 187 if length and (len(string) > (length - 3)):
188 return string[:(length - 3)] + "..." 188 return string[:(length - 3)] + "..."
189 else: 189 else:
190 return string 190 return string
191 191
192 def PrintProgress(self, name): 192 def PrintProgress(self, name):
193 self.ClearLine(self.last_status_length) 193 self.ClearLine(self.last_status_length)
194 elapsed = time.time() - self.start_time 194 elapsed = time.time() - self.start_time
195 progress = 0 if not self.runner.total else (
196 ((self.runner.total - self.runner.remaining) * 100) //
197 self.runner.total)
195 status = self.templates['status_line'] % { 198 status = self.templates['status_line'] % {
196 'passed': self.runner.succeeded, 199 'passed': self.runner.succeeded,
197 'remaining': (((self.runner.total - self.runner.remaining) * 100) // 200 'progress': progress,
198 self.runner.total),
199 'failed': len(self.runner.failed), 201 'failed': len(self.runner.failed),
200 'test': name, 202 'test': name,
201 'mins': int(elapsed) / 60, 203 'mins': int(elapsed) / 60,
202 'secs': int(elapsed) % 60 204 'secs': int(elapsed) % 60
203 } 205 }
204 status = self.Truncate(status, 78) 206 status = self.Truncate(status, 78)
205 self.last_status_length = len(status) 207 self.last_status_length = len(status)
206 print status, 208 print status,
207 sys.stdout.flush() 209 sys.stdout.flush()
208 210
209 211
210 class ColorProgressIndicator(CompactProgressIndicator): 212 class ColorProgressIndicator(CompactProgressIndicator):
211 213
212 def __init__(self): 214 def __init__(self):
213 templates = { 215 templates = {
214 'status_line': ("[%(mins)02i:%(secs)02i|" 216 'status_line': ("[%(mins)02i:%(secs)02i|"
215 "\033[34m%%%(remaining) 4d\033[0m|" 217 "\033[34m%%%(progress) 4d\033[0m|"
216 "\033[32m+%(passed) 4d\033[0m|" 218 "\033[32m+%(passed) 4d\033[0m|"
217 "\033[31m-%(failed) 4d\033[0m]: %(test)s"), 219 "\033[31m-%(failed) 4d\033[0m]: %(test)s"),
218 'stdout': "\033[1m%s\033[0m", 220 'stdout': "\033[1m%s\033[0m",
219 'stderr': "\033[31m%s\033[0m", 221 'stderr': "\033[31m%s\033[0m",
220 } 222 }
221 super(ColorProgressIndicator, self).__init__(templates) 223 super(ColorProgressIndicator, self).__init__(templates)
222 224
223 def ClearLine(self, last_line_length): 225 def ClearLine(self, last_line_length):
224 print "\033[1K\r", 226 print "\033[1K\r",
225 227
226 228
227 class MonochromeProgressIndicator(CompactProgressIndicator): 229 class MonochromeProgressIndicator(CompactProgressIndicator):
228 230
229 def __init__(self): 231 def __init__(self):
230 templates = { 232 templates = {
231 'status_line': ("[%(mins)02i:%(secs)02i|%%%(remaining) 4d|" 233 'status_line': ("[%(mins)02i:%(secs)02i|%%%(progress) 4d|"
232 "+%(passed) 4d|-%(failed) 4d]: %(test)s"), 234 "+%(passed) 4d|-%(failed) 4d]: %(test)s"),
233 'stdout': '%s', 235 'stdout': '%s',
234 'stderr': '%s', 236 'stderr': '%s',
235 } 237 }
236 super(MonochromeProgressIndicator, self).__init__(templates) 238 super(MonochromeProgressIndicator, self).__init__(templates)
237 239
238 def ClearLine(self, last_line_length): 240 def ClearLine(self, last_line_length):
239 print ("\r" + (" " * last_line_length) + "\r"), 241 print ("\r" + (" " * last_line_length) + "\r"),
240 242
241 243
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 "duration": test.duration, 356 "duration": test.duration,
355 }) 357 })
356 358
357 359
358 PROGRESS_INDICATORS = { 360 PROGRESS_INDICATORS = {
359 'verbose': VerboseProgressIndicator, 361 'verbose': VerboseProgressIndicator,
360 'dots': DotsProgressIndicator, 362 'dots': DotsProgressIndicator,
361 'color': ColorProgressIndicator, 363 'color': ColorProgressIndicator,
362 'mono': MonochromeProgressIndicator 364 'mono': MonochromeProgressIndicator
363 } 365 }
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