Merge
authorddmitriev
Tue, 24 Nov 2015 20:01:45 +0000
changeset 34277 d457b9400c99
parent 34274 458a7bb38555 (current diff)
parent 34276 fef7c43ec4a5 (diff)
child 34279 92de270a7364
child 34280 72bfaaffee36
child 34285 0b07014c15e9
Merge
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java	Tue Nov 24 18:32:35 2015 +0000
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java	Tue Nov 24 20:01:45 2015 +0000
@@ -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());
 
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/DoubleJVMOption.java	Tue Nov 24 18:32:35 2015 +0000
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/DoubleJVMOption.java	Tue Nov 24 20:01:45 2015 +0000
@@ -123,22 +123,28 @@
     protected List<String> getValidValues() {
         List<String> validValues = new ArrayList<>();
 
-        validValues.add(formatValue(min));
-        validValues.add(formatValue(max));
-
-        if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_NEGATIVE) < 0)
-                && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_NEGATIVE) > 0)) {
-            validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_NEGATIVE));
+        if (testMinRange) {
+            validValues.add(formatValue(min));
+        }
+        if (testMaxRange) {
+            validValues.add(formatValue(max));
         }
 
-        if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_ZERO) < 0)
-                && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_ZERO) > 0)) {
-            validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_ZERO));
-        }
+        if (testMinRange) {
+            if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_NEGATIVE) < 0)
+                    && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_NEGATIVE) > 0)) {
+                validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_NEGATIVE));
+            }
 
-        if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_POSITIVE) < 0)
-                && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_POSITIVE) > 0)) {
-            validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_POSITIVE));
+            if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_ZERO) < 0)
+                    && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_ZERO) > 0)) {
+                validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_ZERO));
+            }
+
+            if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_POSITIVE) < 0)
+                    && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_POSITIVE) > 0)) {
+                validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_POSITIVE));
+            }
         }
 
         return validValues;
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/IntJVMOption.java	Tue Nov 24 18:32:35 2015 +0000
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/IntJVMOption.java	Tue Nov 24 20:01:45 2015 +0000
@@ -200,43 +200,51 @@
     protected List<String> getValidValues() {
         List<String> validValues = new ArrayList<>();
 
-        validValues.add(min.toString());
-        validValues.add(max.toString());
-
-        if ((min.compareTo(MINUS_ONE) == -1) && (max.compareTo(MINUS_ONE) == 1)) {
-            /*
-             * Add -1 as valid value if min is less than -1 and max is greater than -1
-             */
-            validValues.add("-1");
+        if (testMinRange) {
+            validValues.add(min.toString());
+        }
+        if (testMaxRange) {
+            validValues.add(max.toString());
         }
 
-        if ((min.compareTo(BigInteger.ZERO) == -1) && (max.compareTo(BigInteger.ZERO) == 1)) {
-            /*
-             * Add 0 as valid value if min is less than 0 and max is greater than 0
-             */
-            validValues.add("0");
-        }
-        if ((min.compareTo(BigInteger.ONE) == -1) && (max.compareTo(BigInteger.ONE) == 1)) {
-            /*
-             * Add 1 as valid value if min is less than 1 and max is greater than 1
-             */
-            validValues.add("1");
+        if (testMinRange) {
+            if ((min.compareTo(MINUS_ONE) == -1) && (max.compareTo(MINUS_ONE) == 1)) {
+                /*
+                 * Add -1 as valid value if min is less than -1 and max is greater than -1
+                 */
+                validValues.add("-1");
+            }
+
+            if ((min.compareTo(BigInteger.ZERO) == -1) && (max.compareTo(BigInteger.ZERO) == 1)) {
+                /*
+                 * Add 0 as valid value if min is less than 0 and max is greater than 0
+                 */
+                validValues.add("0");
+            }
+            if ((min.compareTo(BigInteger.ONE) == -1) && (max.compareTo(BigInteger.ONE) == 1)) {
+                /*
+                 * Add 1 as valid value if min is less than 1 and max is greater than 1
+                 */
+                validValues.add("1");
+            }
         }
 
-        if ((min.compareTo(MAX_4_BYTE_INT_PLUS_ONE) == -1) && (max.compareTo(MAX_4_BYTE_INT_PLUS_ONE) == 1)) {
-            /*
-             * Check for overflow when flag is assigned to the
-             * 4 byte int variable
-             */
-            validValues.add(MAX_4_BYTE_INT_PLUS_ONE.toString());
-        }
+        if (testMaxRange) {
+            if ((min.compareTo(MAX_4_BYTE_INT_PLUS_ONE) == -1) && (max.compareTo(MAX_4_BYTE_INT_PLUS_ONE) == 1)) {
+                /*
+                 * Check for overflow when flag is assigned to the
+                 * 4 byte int variable
+                 */
+                validValues.add(MAX_4_BYTE_INT_PLUS_ONE.toString());
+            }
 
-        if ((min.compareTo(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE) == -1) && (max.compareTo(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE) == 1)) {
-            /*
-             * Check for overflow when flag is assigned to the
-             * 4 byte unsigned int variable
-             */
-            validValues.add(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE.toString());
+            if ((min.compareTo(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE) == -1) && (max.compareTo(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE) == 1)) {
+                /*
+                 * Check for overflow when flag is assigned to the
+                 * 4 byte unsigned int variable
+                 */
+                validValues.add(MAX_4_BYTE_UNSIGNED_INT_PLUS_ONE.toString());
+            }
         }
 
         return validValues;
@@ -252,24 +260,28 @@
     protected List<String> getInvalidValues() {
         List<String> invalidValues = new ArrayList<>();
 
+        /* Return invalid values only for options which have defined range in VM */
         if (withRange) {
-            /* Return invalid values only for options which have defined range in VM */
-            if ((is32Bit && min.compareTo(MIN_4_BYTE_INT) != 0)
-                    || (!is32Bit && min.compareTo(MIN_LONG) != 0)) {
-                invalidValues.add(min.subtract(BigInteger.ONE).toString());
-            }
+            if (unsigned) {
+                /* Only add non-negative out-of-range values for unsigned options */
+                if (min.compareTo(BigInteger.ZERO) == 1) {
+                    invalidValues.add(min.subtract(BigInteger.ONE).toString());
+                }
 
-            if (!unsigned
-                    && ((is32Bit && (max.compareTo(MAX_4_BYTE_INT) != 0))
-                    || (!is32Bit && (max.compareTo(MAX_LONG) != 0)))) {
-                invalidValues.add(max.add(BigInteger.ONE).toString());
-            }
-
-            if (unsigned
-                    && ((is32Bit && (max.compareTo(MAX_4_BYTE_UNSIGNED_INT) != 0))
-                    || (!is32Bit && !uint64 && (max.compareTo(MAX_UNSIGNED_LONG) != 0))
-                    || (uint64 && (max.compareTo(MAX_UNSIGNED_LONG_64) != 0)))) {
-                invalidValues.add(max.add(BigInteger.ONE).toString());
+                if ((is32Bit && (max.compareTo(MAX_4_BYTE_UNSIGNED_INT) != 0))
+                        || (!is32Bit && !uint64 && (max.compareTo(MAX_UNSIGNED_LONG) != 0))
+                        || (uint64 && (max.compareTo(MAX_UNSIGNED_LONG_64) != 0))) {
+                    invalidValues.add(max.add(BigInteger.ONE).toString());
+                }
+            } else {
+                if ((is32Bit && min.compareTo(MIN_4_BYTE_INT) != 0)
+                        || (!is32Bit && min.compareTo(MIN_LONG) != 0)) {
+                    invalidValues.add(min.subtract(BigInteger.ONE).toString());
+                }
+                if ((is32Bit && (max.compareTo(MAX_4_BYTE_INT) != 0))
+                        || (!is32Bit && (max.compareTo(MAX_LONG) != 0))) {
+                    invalidValues.add(max.add(BigInteger.ONE).toString());
+                }
             }
         }
 
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java	Tue Nov 24 18:32:35 2015 +0000
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java	Tue Nov 24 20:01:45 2015 +0000
@@ -55,6 +55,16 @@
     protected boolean withRange;
 
     /**
+     * Test valid min range value and additional small values
+     */
+    protected boolean testMinRange;
+
+    /**
+     * Test valid max range value and additional big values
+     */
+    protected boolean testMaxRange;
+
+    /**
      * Prepend string which added before testing option to the command line
      */
     private final List<String> prepend;
@@ -64,6 +74,8 @@
         this.prepend = new ArrayList<>();
         prependString = new StringBuilder();
         withRange = false;
+        testMinRange = true;
+        testMaxRange = true;
     }
 
     /**
@@ -136,6 +148,20 @@
     }
 
     /**
+     * Exclude testing of min range value for this option
+     */
+    public final void excludeTestMinRange() {
+        testMinRange = false;
+    }
+
+    /**
+     * Exclude testing of max range value for this option
+     */
+    public final void excludeTestMaxRange() {
+        testMaxRange = false;
+    }
+
+    /**
      * Set new minimum option value
      *
      * @param min new minimum value