test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java Tue Jan 16 15:42:23 2018
--- new/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java Tue Jan 16 15:42:22 2018
*** 371,414 ****
--- 371,423 ----
* @param valid indicates whether the JVM should fail or not
* @return true - if test passed
* @throws Exception if java process can not be started
*/
private boolean runJavaWithParam(String optionValue, boolean valid) throws Exception {
! int exitCode = 0;
boolean result = true;
String errorMessage = null;
+ String explicitGC = null;
List<String> runJava = new ArrayList<>();
! OutputAnalyzer out = null;
if (VMType != null) {
runJava.add(VMType);
}
if (GCType != null &&
!(prepend.contains("-XX:+UseConcMarkSweepGC") ||
prepend.contains("-XX:+UseSerialGC") ||
prepend.contains("-XX:+UseParallelGC") ||
prepend.contains("-XX:+UseG1GC"))) {
! runJava.add(GCType);
! explicitGC = GCType;
+ }
+
+ if (explicitGC != null) {
+ runJava.add(explicitGC);
}
runJava.addAll(prepend);
runJava.add(optionValue);
runJava.add(JVMStartup.class.getName());
out = new OutputAnalyzer(ProcessTools.createJavaProcessBuilder(runJava.toArray(new String[0])).start());
exitCode = out.getExitValue();
+ String exitCodeString = null;
+ if (exitCode != 0) {
+ exitCodeString = exitCode + " [0x" + Integer.toHexString(exitCode).toUpperCase() + "]";
+ }
if (out.getOutput().contains("A fatal error has been detected by the Java Runtime Environment")) {
/* Always consider "fatal error" in output as fail */
! errorMessage = "JVM output reports a fatal error. JVM exited with code " + exitCodeString + "!";
} else if (valid == true) {
if (!allowedExitCodes.contains(exitCode)) {
! errorMessage = "JVM exited with unexpected error code = " + exitCodeString;
} else if ((exitCode != 0) && (out.getOutput().isEmpty() == true)) {
! errorMessage = "JVM exited with error(exitcode == " + exitCodeString + "), but with empty stdout and stderr. " +
"Description of error is needed!";
} else if (out.getOutput().contains("is outside the allowed range")) {
errorMessage = "JVM output contains \"is outside the allowed range\"";
}
} else {
*** 416,434 ****
--- 425,443 ----
String value = optionValue.substring(optionValue.lastIndexOf("=") + 1);
String errorMessageCommandLineValue = getErrorMessageCommandLine(value);
if (exitCode == 0) {
errorMessage = "JVM successfully exit";
} else if (exitCode != 1) {
! errorMessage = "JVM exited with code " + exitCodeString + " which does not equal to 1";
} else if (!out.getOutput().contains(errorMessageCommandLineValue)) {
errorMessage = "JVM output does not contain expected output \"" + errorMessageCommandLineValue + "\"";
}
}
if (errorMessage != null) {
String fullOptionString = String.format("%s %s %s %s",
! VMType == null ? "" : VMType, GCType == null ? "" : GCType, prependString.toString(), optionValue).trim().replaceAll(" +", " ");
! VMType == null ? "" : VMType, explicitGC == null ? "" : explicitGC, prependString.toString(), optionValue).trim().replaceAll(" +", " ");
failedMessage(name, fullOptionString, valid, errorMessage);
printOutputContent(out);
result = false;
}
test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File