Index: tools/testing/dart/test_progress.dart |
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart |
index 6eb4babd0732a23955adbcc4fadb7e1792acc5ce..7751d63677c5c0c49edb19336d21a68bf8944abd 100644 |
--- a/tools/testing/dart/test_progress.dart |
+++ b/tools/testing/dart/test_progress.dart |
@@ -316,25 +316,32 @@ class TestOutcomeLogWriter extends EventListener { |
} |
class UnexpectedCrashDumpArchiver extends EventListener { |
+ final archivedBinaries = new Set<String>(); |
+ |
void done(TestCase test) { |
if (test.unexpectedOutput && test.result == Expectation.CRASH) { |
- var name = "core.dart.${test.lastCommandOutput.pid}"; |
- var file = new File(name); |
- if (file.existsSync()) { |
- // Find the binary - we assume this is the first part of the command |
- var binName = test.lastCommandExecuted.toString().split(' ').first; |
- var binFile = new File(binName); |
- var binBaseName = new Path(binName).filename; |
+ final name = "core.${test.lastCommandOutput.pid}"; |
+ final file = new File(name); |
+ final exists = file.existsSync(); |
+ if (exists) { |
+ // We have a coredump for the process. This coredump will be archived by |
+ // CoreDumpArchiver (see tools/utils.py). For debugging purposes we |
+ // need to archive the crashed binary as well. To simplify the |
+ // archiving code we simply copy binaries into current folder next to |
+ // core dumps and name them `core.${mode}_${arch}_${binary_name}`. |
+ final binName = test.lastCommandExecuted.executable; |
+ final binFile = new File(binName); |
+ final binBaseName = new Path(binName).filename; |
+ if (archivedBinaries.contains(binBaseName)) { |
+ return; |
+ } |
+ |
if (binFile.existsSync()) { |
- var tmpPath = new Path(Directory.systemTemp.path); |
- var dir = new Path(TestUtils |
- .mkdirRecursive( |
- tmpPath, new Path('coredump_${test.lastCommandOutput.pid}')) |
- .path); |
- TestUtils.copyFile(new Path(name), dir.append(name)); |
- TestUtils.copyFile(new Path(binName), dir.append(binBaseName)); |
- print("\nCopied core dump and binary for unexpected crash to: " |
- "$dir"); |
+ final mode = test.configuration['mode']; |
+ final arch = test.configuration['arch']; |
+ TestUtils.copyFile(new Path(binName), |
+ new Path("core.${mode}_${arch}_${binBaseName}")); |
+ archivedBinaries.add(binBaseName); |
} |
} |
} |