8251121: six SA tests leave core files behind on macOS

Reviewed-by: dholmes, dcubed
This commit is contained in:
Chris Plummer 2020-08-06 18:21:21 -07:00
parent c202bd705e
commit db46b297fa
2 changed files with 13 additions and 2 deletions

View File

@ -174,7 +174,6 @@ public class ClhsdbCDSCore {
}
private static void cleanup() {
if (coreFileName != null) remove(coreFileName);
remove(SHARED_ARCHIVE_NAME);
}

View File

@ -107,8 +107,20 @@ public class CoreUtils {
// Find the core file
String coreFileLocation = parseCoreFileLocationFromOutput(crashOutputString);
if (coreFileLocation != null) {
Asserts.assertGT(new File(coreFileLocation).length(), 0L, "Unexpected core size");
System.out.println("Found core file: " + coreFileLocation);
Asserts.assertGT(new File(coreFileLocation).length(), 0L, "Unexpected core size");
// Make sure the core file is moved into the cwd if not already there.
Path corePath = Paths.get(coreFileLocation);
if (corePath.getParent() != null) {
Path coreFileName = corePath.getFileName();
System.out.println("Moving core file to cwd: " + coreFileName);
long startTime = System.currentTimeMillis();
Files.move(corePath, coreFileName);
System.out.println("Core file move took " + (System.currentTimeMillis() - startTime) + "ms");
coreFileLocation = coreFileName.toString();
}
return coreFileLocation; // success!
}