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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 void _writeTestOutcomeRecord(Map record) { | 309 void _writeTestOutcomeRecord(Map record) { |
| 310 if (_sink == null) { | 310 if (_sink == null) { |
| 311 _sink = new File(TestUtils.testOutcomeFileName()) | 311 _sink = new File(TestUtils.testOutcomeFileName()) |
| 312 .openWrite(mode: FileMode.APPEND); | 312 .openWrite(mode: FileMode.APPEND); |
| 313 } | 313 } |
| 314 _sink.write("${JSON.encode(record)}\n"); | 314 _sink.write("${JSON.encode(record)}\n"); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 class UnexpectedCrashDumpArchiver extends EventListener { | 318 class UnexpectedCrashDumpArchiver extends EventListener { |
| 319 final archivedBinaries = new Set<String>(); | |
| 320 | |
| 319 void done(TestCase test) { | 321 void done(TestCase test) { |
| 320 if (test.unexpectedOutput && test.result == Expectation.CRASH) { | 322 if (test.unexpectedOutput && test.result == Expectation.CRASH) { |
| 321 var name = "core.dart.${test.lastCommandOutput.pid}"; | 323 final name = "core.${test.lastCommandOutput.pid}"; |
| 322 var file = new File(name); | 324 final file = new File(name); |
| 323 if (file.existsSync()) { | 325 final exists = file.existsSync(); |
| 324 // Find the binary - we assume this is the first part of the command | 326 print("\nLooking for a core dump ${name}: ${exists ? '' : 'not'} found"); |
|
kustermann
2017/01/18 17:12:35
Maybe remove this line?
Vyacheslav Egorov (Google)
2017/01/18 19:56:59
Done.
| |
| 325 var binName = test.lastCommandExecuted.toString().split(' ').first; | 327 if (exists) { |
| 326 var binFile = new File(binName); | 328 // We have a coredump for the process. This coredump will be archived by |
| 327 var binBaseName = new Path(binName).filename; | 329 // CoreDumpArchiver (see tools/utils.py). For debugging purposes we |
| 330 // need to archive the crashed binary as well. To simplify the | |
| 331 // archiving code we simply copy binaries into current folder next to | |
| 332 // core dumps and name them `core.$binary_name`. | |
| 333 final binName = test.lastCommandExecuted.executable; | |
| 334 final binFile = new File(binName); | |
| 335 final binBaseName = new Path(binName).filename; | |
| 336 if (archivedBinaries.contains(binBaseName)) { | |
| 337 return; | |
| 338 } | |
| 339 | |
| 328 if (binFile.existsSync()) { | 340 if (binFile.existsSync()) { |
| 329 var tmpPath = new Path(Directory.systemTemp.path); | 341 TestUtils.copyFile(new Path(binName), new Path("core.${binBaseName}")) ; |
|
kustermann
2017/01/18 17:12:35
Consider making binBaseName contain the configurat
Vyacheslav Egorov (Google)
2017/01/18 19:56:59
Done.
Bill Hesse
2017/01/24 16:01:21
On buildbots, we often test modes separately, but
| |
| 330 var dir = new Path(TestUtils | 342 archivedBinaries.add(binBaseName); |
| 331 .mkdirRecursive( | |
| 332 tmpPath, new Path('coredump_${test.lastCommandOutput.pid}')) | |
| 333 .path); | |
| 334 TestUtils.copyFile(new Path(name), dir.append(name)); | |
| 335 TestUtils.copyFile(new Path(binName), dir.append(binBaseName)); | |
| 336 print("\nCopied core dump and binary for unexpected crash to: " | |
| 337 "$dir"); | |
| 338 } | 343 } |
| 339 } | 344 } |
| 340 } | 345 } |
| 341 } | 346 } |
| 342 } | 347 } |
| 343 | 348 |
| 344 class SummaryPrinter extends EventListener { | 349 class SummaryPrinter extends EventListener { |
| 345 final bool jsonOnly; | 350 final bool jsonOnly; |
| 346 | 351 |
| 347 SummaryPrinter({bool jsonOnly}) | 352 SummaryPrinter({bool jsonOnly}) |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 return new VerboseProgressIndicator(startTime); | 695 return new VerboseProgressIndicator(startTime); |
| 691 case 'status': | 696 case 'status': |
| 692 return new ProgressIndicator(startTime); | 697 return new ProgressIndicator(startTime); |
| 693 case 'buildbot': | 698 case 'buildbot': |
| 694 return new BuildbotProgressIndicator(startTime); | 699 return new BuildbotProgressIndicator(startTime); |
| 695 default: | 700 default: |
| 696 assert(false); | 701 assert(false); |
| 697 return null; | 702 return null; |
| 698 } | 703 } |
| 699 } | 704 } |
| OLD | NEW |