Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test_progress; | 5 library test_progress; |
| 6 | 6 |
| 7 import "dart:async"; | 7 import "dart:async"; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 import "dart:io" as io; | 9 import "dart:io" as io; |
| 10 import "dart:convert" show JSON; | 10 import "dart:convert" show JSON; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 | 269 |
| 270 void _writeTestOutcomeRecord(Map record) { | 270 void _writeTestOutcomeRecord(Map record) { |
| 271 if (_sink == null) { | 271 if (_sink == null) { |
| 272 _sink = new File(TestUtils.testOutcomeFileName()) | 272 _sink = new File(TestUtils.testOutcomeFileName()) |
| 273 .openWrite(mode: FileMode.APPEND); | 273 .openWrite(mode: FileMode.APPEND); |
| 274 } | 274 } |
| 275 _sink.write("${JSON.encode(record)}\n"); | 275 _sink.write("${JSON.encode(record)}\n"); |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | 278 |
| 279 | |
| 280 class UnexpectedCrashDumpArchiver extends EventListener { | |
| 281 void done(TestCase test) { | |
| 282 if (test.unexpectedOutput && test.result == Expectation.CRASH) { | |
| 283 var name = "core.dart.${test.lastCommandOutput.pid}"; | |
| 284 var file = new File(name); | |
| 285 if (file.existsSync()) { | |
| 286 // Find the binary - we assume this is the first part of the command | |
| 287 var binName = test.lastCommandExecuted.toString().split(' ').first; | |
| 288 var binFile = new File(binName); | |
| 289 var binBaseName = new Path(binName).filename; | |
| 290 if (file.existsSync()) { | |
|
Bill Hesse
2014/01/29 07:01:52
I think this is always true, since it was true abo
ricow1
2014/01/29 09:41:38
yes, thank you
| |
| 291 var dir = new Path(TestUtils.mkdirRecursive(new Path('/tmp'), | |
|
Bill Hesse
2014/01/29 07:01:52
We don't want to use Directory.systemTemp for this
ricow1
2014/01/29 09:41:38
Done.
| |
| 292 new Path('coredump_${test.lastCommandOutput.pid}')).path); | |
| 293 TestUtils.copyFile(new Path(name), dir.append(name)); | |
| 294 TestUtils.copyFile(new Path(binName), dir.append(binBaseName)); | |
|
Bill Hesse
2014/01/29 07:01:52
I hate to see all these new uses of Path go in, bu
ricow1
2014/01/29 09:41:38
Yes I thought about that, but our copy functions t
| |
| 295 print("\nCopied core dump and binary for unexpected crash to: " | |
| 296 "$dir"); | |
| 297 } | |
| 298 } | |
| 299 } | |
| 300 } | |
| 301 } | |
| 302 | |
| 303 | |
| 279 class SummaryPrinter extends EventListener { | 304 class SummaryPrinter extends EventListener { |
| 280 void allTestsKnown() { | 305 void allTestsKnown() { |
| 281 if (SummaryReport.total > 0) { | 306 if (SummaryReport.total > 0) { |
| 282 SummaryReport.printReport(); | 307 SummaryReport.printReport(); |
| 283 } | 308 } |
| 284 } | 309 } |
| 285 } | 310 } |
| 286 | 311 |
|
Bill Hesse
2014/01/29 07:01:52
Add a line here?
ricow1
2014/01/29 09:41:38
Done.
| |
| 287 class TimingPrinter extends EventListener { | 312 class TimingPrinter extends EventListener { |
| 288 final _command2testCases = new Map<Command, List<TestCase>>(); | 313 final _command2testCases = new Map<Command, List<TestCase>>(); |
| 289 final _commandOutputs = new Set<CommandOutput>(); | 314 final _commandOutputs = new Set<CommandOutput>(); |
| 290 DateTime _startTime; | 315 DateTime _startTime; |
| 291 | 316 |
| 292 TimingPrinter(this._startTime); | 317 TimingPrinter(this._startTime); |
| 293 | 318 |
| 294 void done(TestCase testCase) { | 319 void done(TestCase testCase) { |
| 295 for (var commandOutput in testCase.commandOutputs.values) { | 320 for (var commandOutput in testCase.commandOutputs.values) { |
| 296 var command = commandOutput.command; | 321 var command = commandOutput.command; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 class LineProgressIndicator extends EventListener { | 474 class LineProgressIndicator extends EventListener { |
| 450 void done(TestCase test) { | 475 void done(TestCase test) { |
| 451 var status = 'pass'; | 476 var status = 'pass'; |
| 452 if (test.unexpectedOutput) { | 477 if (test.unexpectedOutput) { |
| 453 status = 'fail'; | 478 status = 'fail'; |
| 454 } | 479 } |
| 455 print('Done ${test.configurationString} ${test.displayName}: $status'); | 480 print('Done ${test.configurationString} ${test.displayName}: $status'); |
| 456 } | 481 } |
| 457 } | 482 } |
| 458 | 483 |
| 484 | |
| 459 class TestFailurePrinter extends EventListener { | 485 class TestFailurePrinter extends EventListener { |
| 460 bool _printSummary; | 486 bool _printSummary; |
| 461 var _formatter; | 487 var _formatter; |
| 462 var _failureSummary = <String>[]; | 488 var _failureSummary = <String>[]; |
| 463 var _failedTests= 0; | 489 var _failedTests= 0; |
| 464 | 490 |
| 465 TestFailurePrinter(this._printSummary, | 491 TestFailurePrinter(this._printSummary, |
| 466 [this._formatter = const Formatter()]); | 492 [this._formatter = const Formatter()]); |
| 467 | 493 |
| 468 void done(TestCase test) { | 494 void done(TestCase test) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 return new VerboseProgressIndicator(startTime); | 656 return new VerboseProgressIndicator(startTime); |
| 631 case 'status': | 657 case 'status': |
| 632 return new ProgressIndicator(startTime); | 658 return new ProgressIndicator(startTime); |
| 633 case 'buildbot': | 659 case 'buildbot': |
| 634 return new BuildbotProgressIndicator(startTime); | 660 return new BuildbotProgressIndicator(startTime); |
| 635 default: | 661 default: |
| 636 assert(false); | 662 assert(false); |
| 637 break; | 663 break; |
| 638 } | 664 } |
| 639 } | 665 } |
| OLD | NEW |