hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java
changeset 34275 9b1771bfd6cf
parent 34242 e530decd7c63
child 34317 e93b85bf4cc2
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java	Tue Nov 24 02:54:54 2015 +0000
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java	Tue Nov 24 09:42:05 2015 +0300
@@ -41,22 +41,45 @@
 
 public class TestOptionsWithRanges {
 
+    private static Map<String, JVMOption> allOptionsAsMap;
+
+    private static void excludeTestMaxRange(String optionName) {
+        JVMOption option = allOptionsAsMap.get(optionName);
+
+        if (option != null) {
+            option.excludeTestMaxRange();
+        }
+    }
+
+    private static void excludeTestMinRange(String optionName) {
+        JVMOption option = allOptionsAsMap.get(optionName);
+
+        if (option != null) {
+            option.excludeTestMinRange();
+        }
+    }
+
+    private static void excludeTestRange(String optionName) {
+        allOptionsAsMap.remove(optionName);
+    }
+
     public static void main(String[] args) throws Exception {
         int failedTests;
-        Map<String, JVMOption> allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap();
         List<JVMOption> allOptions;
 
+        allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap();
+
         /*
          * Remove CICompilerCount from testing because currently it can hang system
          */
-        allOptionsAsMap.remove("CICompilerCount");
+        excludeTestMaxRange("CICompilerCount");
 
         /*
          * JDK-8136766
          * Temporarily remove ThreadStackSize from testing because Windows can set it to 0
          * (for default OS size) but other platforms insist it must be greater than 0
-         */
-        allOptionsAsMap.remove("ThreadStackSize");
+        */
+        excludeTestRange("ThreadStackSize");
 
         /*
          * JDK-8141650
@@ -64,7 +87,7 @@
          * "The shared miscellaneous data space is not large enough to preload requested classes."
          * message at min value.
          */
-        allOptionsAsMap.remove("SharedMiscDataSize");
+        excludeTestRange("SharedMiscDataSize");
 
         /*
          * JDK-8142874
@@ -72,25 +95,25 @@
          * "The shared miscellaneous data space is not large enough to preload requested classes."
          * message at max values.
          */
-        allOptionsAsMap.remove("SharedReadWriteSize");
-        allOptionsAsMap.remove("SharedReadOnlySize");
-        allOptionsAsMap.remove("SharedMiscDataSize");
-        allOptionsAsMap.remove("SharedMiscCodeSize");
+        excludeTestRange("SharedReadWriteSize");
+        excludeTestRange("SharedReadOnlySize");
+        excludeTestRange("SharedMiscDataSize");
+        excludeTestRange("SharedMiscCodeSize");
 
         /*
          * Exclude MallocMaxTestWords as it is expected to exit VM at small values (>=0)
          */
-        allOptionsAsMap.remove("MallocMaxTestWords");
+        excludeTestMinRange("MallocMaxTestWords");
 
         /*
          * Exclude below options as their maximum value would consume too much memory
          * and would affect other tests that run in parallel.
          */
-        allOptionsAsMap.remove("G1ConcRefinementThreads");
-        allOptionsAsMap.remove("G1RSetRegionEntries");
-        allOptionsAsMap.remove("G1RSetSparseRegionEntries");
-        allOptionsAsMap.remove("G1UpdateBufferSize");
-        allOptionsAsMap.remove("InitialBootClassLoaderMetaspaceSize");
+        excludeTestMaxRange("G1ConcRefinementThreads");
+        excludeTestMaxRange("G1RSetRegionEntries");
+        excludeTestMaxRange("G1RSetSparseRegionEntries");
+        excludeTestMaxRange("G1UpdateBufferSize");
+        excludeTestMaxRange("InitialBootClassLoaderMetaspaceSize");
 
         /*
          * Remove parameters controlling the code cache. As these
@@ -102,13 +125,13 @@
          * hotspot/src/shared/vm/code/codeCache.cpp), therefore
          * omitting testing for them does not pose a problem.
          */
-        allOptionsAsMap.remove("InitialCodeCacheSize");
-        allOptionsAsMap.remove("CodeCacheMinimumUseSpace");
-        allOptionsAsMap.remove("ReservedCodeCacheSize");
-        allOptionsAsMap.remove("NonProfiledCodeHeapSize");
-        allOptionsAsMap.remove("ProfiledCodeHeapSize");
-        allOptionsAsMap.remove("NonNMethodCodeHeapSize");
-        allOptionsAsMap.remove("CodeCacheExpansionSize");
+        excludeTestMaxRange("InitialCodeCacheSize");
+        excludeTestMaxRange("CodeCacheMinimumUseSpace");
+        excludeTestMaxRange("ReservedCodeCacheSize");
+        excludeTestMaxRange("NonProfiledCodeHeapSize");
+        excludeTestMaxRange("ProfiledCodeHeapSize");
+        excludeTestMaxRange("NonNMethodCodeHeapSize");
+        excludeTestMaxRange("CodeCacheExpansionSize");
 
         allOptions = new ArrayList<>(allOptionsAsMap.values());