// Test is excluded until 8219680 is fixed // @ignore 8219680 // test(CrasherSig.class, "FPE", true, true);
}
privatestaticvoid test(Class<?> crasher, String signal, boolean disk, String dumppath, boolean expectDump) throws Exception { // The JVM may be in a state it can't recover from, so try three times // before concluding functionality is not working. for (int attempt = 0; attempt < ATTEMPTS; attempt++) { try {
verify(runProcess(crasher, signal, disk, dumppath), dumppath, expectDump); return;
} catch (Exception e) {
System.out.println("Attempt " + attempt + ". Verification failed:");
System.out.println(e.getMessage());
System.out.println("Retrying...");
System.out.println();
} catch (OutOfMemoryError | StackOverflowError e) { // Could happen if file is corrupt and parser loops or // tries to allocate more memory than what is available return;
}
} thrownew Exception(ATTEMPTS + " attempts with failure!");
}
privatestaticlong runProcess(Class<?> crasher, String signal, boolean disk, String dumppath) throws Exception {
System.out.println("Test case for crasher " + crasher.getName());
List<String> options = new ArrayList<>();
options.add("-Xmx64m");
options.add("-XX:-CreateCoredumpOnCrash");
options.add("-XX:-TieredCompilation"); // Avoid secondary crashes (see JDK-8293166)
options.add("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
options.add("-XX:StartFlightRecording:dumponexit=true,disk=" + Boolean.toString(disk)); if (dumppath != null) {
options.add("-XX:FlightRecorderOptions=dumppath=" + dumppath);
}
options.add(crasher.getName());
options.add(signal);
Process p = ProcessTools.createTestJvm(options).start();
OutputAnalyzer output = new OutputAnalyzer(p);
System.out.println("========== Crasher process output:");
System.out.println(output.getOutput());
System.out.println("==================================");
if (expectDump) {
Asserts.assertTrue(Files.exists(file), "No emergency jfr recording file " + file + " exists");
Asserts.assertNotEquals(Files.size(file), 0L, "File length 0. Should at least be some bytes");
System.out.printf("File size=%d%n", Files.size(file));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.