mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8374181: failure_handler: The cores.html file is formatted incorrectly and so hides the core dump information
Reviewed-by: erikj
This commit is contained in:
parent
15b7a4252b
commit
e89c1290ca
@ -29,13 +29,14 @@ import com.sun.javatest.TestResult;
|
||||
import com.sun.javatest.regtest.config.RegressionParameters;
|
||||
import jdk.test.failurehandler.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* The jtreg test execution observer, which gathers info about
|
||||
@ -85,11 +86,15 @@ public class GatherDiagnosticInfoObserver implements Harness.Observer {
|
||||
testJdk, compileJdk);
|
||||
gatherEnvInfo(workDir, name, log,
|
||||
gathererFactory.getEnvironmentInfoGatherer());
|
||||
Files.walk(workDir)
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(f -> (f.getFileName().toString().contains("core") || f.getFileName().toString().contains("mdmp")))
|
||||
.forEach(core -> gatherCoreInfo(workDir, name,
|
||||
core, log, gathererFactory.getCoreInfoGatherer()));
|
||||
// generate a cores.html file after parsing the core dump files (if any)
|
||||
List<Path> coreFiles;
|
||||
try (Stream<Path> paths = Files.walk(workDir)) {
|
||||
coreFiles = paths.filter(Files::isRegularFile)
|
||||
.filter(f -> (f.getFileName().toString().contains("core")
|
||||
|| f.getFileName().toString().contains("mdmp")))
|
||||
.toList();
|
||||
}
|
||||
gatherCoreInfo(workDir, name, coreFiles, log, gathererFactory.getCoreInfoGatherer());
|
||||
} catch (Throwable e) {
|
||||
log.printf("ERROR: exception in observer %s:", name);
|
||||
e.printStackTrace(log);
|
||||
@ -103,16 +108,22 @@ public class GatherDiagnosticInfoObserver implements Harness.Observer {
|
||||
}
|
||||
}
|
||||
|
||||
private void gatherCoreInfo(Path workDir, String name, Path core, PrintWriter log,
|
||||
CoreInfoGatherer gatherer) {
|
||||
private void gatherCoreInfo(Path workDir, String name, List<Path> coreFiles,
|
||||
PrintWriter log, CoreInfoGatherer gatherer) {
|
||||
if (coreFiles.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
try (HtmlPage html = new HtmlPage(workDir, CORES_OUTPUT, true)) {
|
||||
try (ElapsedTimePrinter timePrinter
|
||||
= new ElapsedTimePrinter(new Stopwatch(), name, log)) {
|
||||
gatherer.gatherCoreInfo(html.getRootSection(), core);
|
||||
// gather information from the contents of each core file
|
||||
for (Path coreFile : coreFiles) {
|
||||
gatherer.gatherCoreInfo(html.getRootSection(), coreFile);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.printf("ERROR: exception in observer on getting environment "
|
||||
+ "information %s:", name);
|
||||
log.printf("ERROR: exception in %s observer while gathering information from"
|
||||
+ " core dump file", name);
|
||||
e.printStackTrace(log);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user