--- old/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java 2015-11-25 11:30:14.765851210 +0300 +++ new/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java 2015-11-25 11:30:14.657797211 +0300 @@ -25,7 +25,10 @@ import com.sun.tools.attach.VirtualMachine; import com.sun.tools.attach.AttachOperationFailedException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import java.util.Set; import jdk.test.lib.DynamicVMOption; import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; @@ -64,6 +67,8 @@ */ protected boolean testMaxRange; + private Set allowedExitCodes; + /** * Prepend string which added before testing option to the command line */ @@ -73,6 +78,9 @@ protected JVMOption() { this.prepend = new ArrayList<>(); prependString = new StringBuilder(); + allowedExitCodes = new HashSet<>(); + allowedExitCodes.add(0); + allowedExitCodes.add(1); withRange = false; testMinRange = true; testMaxRange = true; @@ -161,6 +169,10 @@ testMaxRange = false; } + public final void setAllowedExitCodes(Integer... allowedExitCodes) { + this.allowedExitCodes.addAll(Arrays.asList(allowedExitCodes)); + } + /** * Set new minimum option value * @@ -384,13 +396,13 @@ printOutputContent(out); result = false; } else if (valid == true) { - if ((exitCode != 0) && (exitCode != 1)) { + if (!allowedExitCodes.contains(exitCode)) { failedMessage(name, fullOptionString, valid, "JVM exited with unexpected error code = " + exitCode); printOutputContent(out); result = false; - } else if ((exitCode == 1) && (out.getOutput().isEmpty() == true)) { - failedMessage(name, fullOptionString, valid, "JVM exited with error(exitcode == 1)" - + ", but with empty stdout and stderr. Description of error is needed!"); + } else if ((exitCode != 0) && (out.getOutput().isEmpty() == true)) { + failedMessage(name, fullOptionString, valid, "JVM exited with error(exitcode == " + exitCode + + + "), but with empty stdout and stderr. Description of error is needed!"); result = false; } else if (out.getOutput().contains("is outside the allowed range")) { failedMessage(name, fullOptionString, valid, "JVM output contains \"is outside the allowed range\"");