< prev index next >

test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java

Print this page

        

@@ -39,41 +39,64 @@
 import optionsvalidation.JVMOption;
 import optionsvalidation.JVMOptionsUtils;
 
 public class TestOptionsWithRanges {
 
+    private static Map<String, JVMOption> allOptionsAsMap; 
+
+    private static void notTestMaxRange(String optionName) {
+        JVMOption option = allOptionsAsMap.get(optionName);
+
+        if (option != null) {
+            option.notTestMaxRange();
+        }
+    }
+
+    private static void notTestMinRange(String optionName) {
+        JVMOption option = allOptionsAsMap.get(optionName);
+
+        if (option != null) {
+            option.notTestMinRange();
+        }
+    }
+
+    private static void notTestRange(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");
+        notTestMaxRange("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");
+        notTestRange("ThreadStackSize");
 
         /*
          * Exclude MallocMaxTestWords as it is expected to exit VM at small values (>=0)
          */
-        allOptionsAsMap.remove("MallocMaxTestWords");
+        notTestMinRange("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");
+        notTestMaxRange("G1ConcRefinementThreads");
+        notTestMaxRange("G1RSetRegionEntries");
+        notTestMaxRange("G1RSetSparseRegionEntries");
+        notTestMaxRange("G1UpdateBufferSize");
+        notTestMaxRange("InitialBootClassLoaderMetaspaceSize");
 
         /*
          * Remove parameters controlling the code cache. As these
          * parameters have implications on the physical memory
          * reserved by the VM, setting them to large values may hang

@@ -81,17 +104,17 @@
          * fail. These parameters are rigorously checked when the code
          * cache is initialized (see
          * 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");
+        notTestMaxRange("InitialCodeCacheSize");
+        notTestMaxRange("CodeCacheMinimumUseSpace");
+        notTestMaxRange("ReservedCodeCacheSize");
+        notTestMaxRange("NonProfiledCodeHeapSize");
+        notTestMaxRange("ProfiledCodeHeapSize");
+        notTestMaxRange("NonNMethodCodeHeapSize");
+        notTestMaxRange("CodeCacheExpansionSize");
 
         allOptions = new ArrayList<>(allOptionsAsMap.values());
 
         Asserts.assertGT(allOptions.size(), 0, "Options with ranges not found!");
 
< prev index next >