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 if (exists) { |
325 var binName = test.lastCommandExecuted.toString().split(' ').first; | 327 // We have a coredump for the process. This coredump will be archived by |
326 var binFile = new File(binName); | 328 // CoreDumpArchiver (see tools/utils.py). For debugging purposes we |
327 var binBaseName = new Path(binName).filename; | 329 // need to archive the crashed binary as well. To simplify the |
| 330 // archiving code we simply copy binaries into current folder next to |
| 331 // core dumps and name them `core.${mode}_${arch}_${binary_name}`. |
| 332 final binName = test.lastCommandExecuted.executable; |
| 333 final binFile = new File(binName); |
| 334 final binBaseName = new Path(binName).filename; |
| 335 if (archivedBinaries.contains(binBaseName)) { |
| 336 return; |
| 337 } |
| 338 |
328 if (binFile.existsSync()) { | 339 if (binFile.existsSync()) { |
329 var tmpPath = new Path(Directory.systemTemp.path); | 340 final mode = test.configuration['mode']; |
330 var dir = new Path(TestUtils | 341 final arch = test.configuration['arch']; |
331 .mkdirRecursive( | 342 TestUtils.copyFile(new Path(binName), |
332 tmpPath, new Path('coredump_${test.lastCommandOutput.pid}')) | 343 new Path("core.${mode}_${arch}_${binBaseName}")); |
333 .path); | 344 archivedBinaries.add(binBaseName); |
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 } | 345 } |
339 } | 346 } |
340 } | 347 } |
341 } | 348 } |
342 } | 349 } |
343 | 350 |
344 class SummaryPrinter extends EventListener { | 351 class SummaryPrinter extends EventListener { |
345 final bool jsonOnly; | 352 final bool jsonOnly; |
346 | 353 |
347 SummaryPrinter({bool jsonOnly}) | 354 SummaryPrinter({bool jsonOnly}) |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 return new VerboseProgressIndicator(startTime); | 697 return new VerboseProgressIndicator(startTime); |
691 case 'status': | 698 case 'status': |
692 return new ProgressIndicator(startTime); | 699 return new ProgressIndicator(startTime); |
693 case 'buildbot': | 700 case 'buildbot': |
694 return new BuildbotProgressIndicator(startTime); | 701 return new BuildbotProgressIndicator(startTime); |
695 default: | 702 default: |
696 assert(false); | 703 assert(false); |
697 return null; | 704 return null; |
698 } | 705 } |
699 } | 706 } |
OLD | NEW |