--- old/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java 2015-11-25 11:30:14.005471220 +0300 +++ new/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java 2015-11-25 11:30:13.901419222 +0300 @@ -63,12 +63,26 @@ allOptionsAsMap.remove(optionName); } + private static void setAllowedExitCodes(String optionName, Integer... allowedExitCodes) { + JVMOption option = allOptionsAsMap.get(optionName); + + if (option != null) { + option.setAllowedExitCodes(allowedExitCodes); + } + } + public static void main(String[] args) throws Exception { int failedTests; List allOptions; allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap(); + /* Shared flags can cause JVM to exit with 2 error code */ + setAllowedExitCodes("SharedReadWriteSize", 2); + setAllowedExitCodes("SharedReadOnlySize", 2); + setAllowedExitCodes("SharedMiscDataSize", 2); + setAllowedExitCodes("SharedMiscCodeSize", 2); + /* * Remove CICompilerCount from testing because currently it can hang system */ @@ -82,23 +96,13 @@ excludeTestRange("ThreadStackSize"); /* - * JDK-8141650 - * Temporarily exclude SharedMiscDataSize as it will exit the VM with exit code 2 and - * "The shared miscellaneous data space is not large enough to preload requested classes." - * message at min value. - */ - excludeTestRange("SharedMiscDataSize"); - - /* - * JDK-8142874 - * Temporarily exclude Shared* flagse as they will exit the VM with exit code 2 and - * "The shared miscellaneous data space is not large enough to preload requested classes." - * message at max values. + * JDK-8143958 + * Temporarily exclude testing of max range for Shared* flags */ - excludeTestRange("SharedReadWriteSize"); - excludeTestRange("SharedReadOnlySize"); - excludeTestRange("SharedMiscDataSize"); - excludeTestRange("SharedMiscCodeSize"); + excludeTestMaxRange("SharedReadWriteSize"); + excludeTestMaxRange("SharedReadOnlySize"); + excludeTestMaxRange("SharedMiscDataSize"); + excludeTestMaxRange("SharedMiscCodeSize"); /* * Exclude MallocMaxTestWords as it is expected to exit VM at small values (>=0) --- 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\""); --- old/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java 2015-11-25 11:30:15.270103203 +0300 +++ new/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java 2015-11-25 11:30:15.162049205 +0300 @@ -161,13 +161,6 @@ option.addPrepend("-XX:+UseConcMarkSweepGC"); } - if (name.startsWith("Shared")) { - option.addPrepend("-XX:+UnlockDiagnosticVMOptions"); - String fileName = "Test" + name + ".jsa"; - option.addPrepend("-XX:SharedArchiveFile=" + fileName); - option.addPrepend("-Xshare:dump"); - } - switch (name) { case "MinHeapFreeRatio": option.addPrepend("-XX:MaxHeapFreeRatio=100"); @@ -196,6 +189,16 @@ case "InitialTenuringThreshold": option.addPrepend("-XX:MaxTenuringThreshold=" + option.getMax()); break; + case "SharedReadWriteSize": + case "SharedReadOnlySize": + case "SharedMiscDataSize": + case "SharedMiscCodeSize": + case "SharedBaseAddress": + case "SharedSymbolTableBucketSize": + option.addPrepend("-XX:+UnlockDiagnosticVMOptions"); + option.addPrepend("-XX:SharedArchiveFile=TestOptionsWithRanges.jsa"); + option.addPrepend("-Xshare:dump"); + break; default: /* Do nothing */ break;