OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 # | 6 # |
7 | 7 |
8 """Test driver for the Dart project used by continuous build and developers.""" | 8 """Test driver for the Dart project used by continuous build and developers.""" |
9 | 9 |
10 | 10 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 if output.UnexpectedOutput(): | 277 if output.UnexpectedOutput(): |
278 if output.HasCrashed(): | 278 if output.HasCrashed(): |
279 outcome = 'CRASH' | 279 outcome = 'CRASH' |
280 else: | 280 else: |
281 outcome = 'FAIL' | 281 outcome = 'FAIL' |
282 else: | 282 else: |
283 outcome = 'pass' | 283 outcome = 'pass' |
284 print 'Done %s: %s' % (output.test.GetLabel(), outcome) | 284 print 'Done %s: %s' % (output.test.GetLabel(), outcome) |
285 | 285 |
286 | 286 |
| 287 class StatusFileProgressIndicator(SimpleProgressIndicator): |
| 288 |
| 289 def AboutToRun(self, case): |
| 290 """Called before each test case is run.""" |
| 291 pass |
| 292 |
| 293 def HasRun(self, output): |
| 294 """Called after each test case is run.""" |
| 295 actual_outcome = output.GetOutcome() |
| 296 expected_outcomes = set(output.test.outcomes) |
| 297 if not actual_outcome in expected_outcomes: |
| 298 expected_outcomes.discard(testing.PASS) |
| 299 if expected_outcomes: |
| 300 print 'Incorrect status for %s: %s' % (output.test.GetLabel(), |
| 301 ', '.join(expected_outcomes)) |
| 302 else: |
| 303 print 'Update status for %s: %s' % (output.test.GetLabel(), |
| 304 actual_outcome) |
| 305 |
| 306 |
287 class OneLineProgressIndicatorForBuildBot(OneLineProgressIndicator): | 307 class OneLineProgressIndicatorForBuildBot(OneLineProgressIndicator): |
288 | 308 |
289 def HasRun(self, output): | 309 def HasRun(self, output): |
290 """Called after each test case is run.""" | 310 """Called after each test case is run.""" |
291 super(OneLineProgressIndicatorForBuildBot, self).HasRun(output) | 311 super(OneLineProgressIndicatorForBuildBot, self).HasRun(output) |
292 percent = (((self.total - self.remaining) * 100) // self.total) | 312 percent = (((self.total - self.remaining) * 100) // self.total) |
293 print '@@@STEP_CLEAR@@@' | 313 print '@@@STEP_CLEAR@@@' |
294 print '@@@STEP_TEXT@ %3d%% +%d -%d @@@' % ( | 314 print '@@@STEP_TEXT@ %3d%% +%d -%d @@@' % ( |
295 percent, self.succeeded, len(self.failed)) | 315 percent, self.succeeded, len(self.failed)) |
296 | 316 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 'max_length': 78 | 413 'max_length': 78 |
394 } | 414 } |
395 super(ColorProgressIndicator, self).__init__(cases, context, templates) | 415 super(ColorProgressIndicator, self).__init__(cases, context, templates) |
396 | 416 |
397 | 417 |
398 PROGRESS_INDICATORS = { | 418 PROGRESS_INDICATORS = { |
399 'verbose': VerboseProgressIndicator, | 419 'verbose': VerboseProgressIndicator, |
400 'mono': MonochromeProgressIndicator, | 420 'mono': MonochromeProgressIndicator, |
401 'color': ColorProgressIndicator, | 421 'color': ColorProgressIndicator, |
402 'line': OneLineProgressIndicator, | 422 'line': OneLineProgressIndicator, |
403 'buildbot': OneLineProgressIndicatorForBuildBot | 423 'buildbot': OneLineProgressIndicatorForBuildBot, |
| 424 'status': StatusFileProgressIndicator, |
404 } | 425 } |
405 | 426 |
406 | 427 |
407 # ------------------------- | 428 # ------------------------- |
408 # --- F r a m e w o r k --- | 429 # --- F r a m e w o r k --- |
409 # ------------------------- | 430 # ------------------------- |
410 | 431 |
411 | 432 |
412 class TestCase(object): | 433 class TestCase(object): |
413 """A single test case, like running 'dart' on a single .dart file.""" | 434 """A single test case, like running 'dart' on a single .dart file.""" |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 for entry in timed_tests[:20]: | 1527 for entry in timed_tests[:20]: |
1507 t = FormatTime(entry.duration) | 1528 t = FormatTime(entry.duration) |
1508 print '%4i (%s) %s' % (index, t, entry.GetLabel()) | 1529 print '%4i (%s) %s' % (index, t, entry.GetLabel()) |
1509 index += 1 | 1530 index += 1 |
1510 | 1531 |
1511 return result | 1532 return result |
1512 | 1533 |
1513 | 1534 |
1514 if __name__ == '__main__': | 1535 if __name__ == '__main__': |
1515 sys.exit(Main()) | 1536 sys.exit(Main()) |
OLD | NEW |