staticvoid printTestOutput(TestResult tr) {
System.out.println("*** exitValue = " + tr.exitValue); for (String x : tr.testOutput) {
System.out.println(x);
}
}
/* *Returnstheminimumstacksizethisplatformwillallowedbasedonthe *contentsoftheerrormessagetheJVMoutputswhentoosmallofa *-Xsssizewasused. * *TheTestResultargumentmustcontaintheresultofhavingalreadyrun *theJVMwithtoosmallofastacksize.
*/ static String getMinStackAllowed(TestResult tr) { /* *TheJVMoutputwillcontaininoneofthelines: *"TheJavathreadstacksizespecifiedistoosmall.Specifyatleast100k" *Althoughtheactualsizewillvary.Weneedtoextractthissize *stringfromtheoutputandreturnit.
*/
String matchStr = "Specify at least "; for (String x : tr.testOutput) { int match_idx = x.indexOf(matchStr); if (match_idx >= 0) { int size_start_idx = match_idx + matchStr.length(); int k_start_idx = x.indexOf("k", size_start_idx); return x.substring(size_start_idx, k_start_idx + 1); // include the "k"
}
}
System.out.println("Expect='" + matchStr + "'");
System.out.println("Actual:");
printTestOutput(tr);
System.out.println("FAILED: Could not get the stack size from the output"); thrownew RuntimeException("test fails");
}
if (tr.isOK()) {
System.out.println("PASSED: VM launched with minimum allowed stack size of " + stackSize);
} else { // Likely a crash
System.out.println("Test output:");
printTestOutput(tr);
System.out.println("FAILED: VM failed to launch with minimum allowed stack size of " + stackSize); thrownew RuntimeException("test fails");
}
}
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.