hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java
author dlong
Sat, 17 Oct 2015 19:40:30 -0400
changeset 33198 b37ad9fbf681
parent 33144 c56850e328fc
parent 33163 9e128b399e48
child 33230 23bb11a5cf4e
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31372
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     1
/*
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     4
 *
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     8
 *
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    13
 * accompanied this code).
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    14
 *
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    18
 *
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    21
 * questions.
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    22
 */
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    23
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    24
/*
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    25
 * @test
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    26
 * @summary Test VM Options with ranges
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    27
 * @library /testlibrary /runtime/CommandLine/OptionsValidation/common
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    28
 * @modules java.base/sun.misc
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    29
 *          java.management
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    30
 *          jdk.attach
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    31
 *          jdk.management/sun.tools.attach
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    32
 * @run main/othervm/timeout=600 TestOptionsWithRanges
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    33
 */
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    34
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    35
import java.util.ArrayList;
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    36
import java.util.List;
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    37
import java.util.Map;
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    38
import jdk.test.lib.Asserts;
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    39
import optionsvalidation.JVMOption;
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    40
import optionsvalidation.JVMOptionsUtils;
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    41
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    42
public class TestOptionsWithRanges {
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    43
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    44
    public static void main(String[] args) throws Exception {
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    45
        int failedTests;
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    46
        Map<String, JVMOption> allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap();
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    47
        List<JVMOption> allOptions;
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    48
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    49
        /*
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    50
         * Remove CICompilerCount from testing because currently it can hang system
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    51
         */
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    52
        allOptionsAsMap.remove("CICompilerCount");
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    53
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    54
        /*
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 31372
diff changeset
    55
         * Exclude below options as their maximum value would consume too much memory
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 31372
diff changeset
    56
         * and would affect other tests that run in parallel.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 31372
diff changeset
    57
         */
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 31372
diff changeset
    58
        allOptionsAsMap.remove("G1ConcRefinementThreads");
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 31372
diff changeset
    59
        allOptionsAsMap.remove("G1RSetRegionEntries");
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 31372
diff changeset
    60
        allOptionsAsMap.remove("G1RSetSparseRegionEntries");
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 31372
diff changeset
    61
33198
dlong
parents: 33144 33163
diff changeset
    62
        /*
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    63
         * Remove parameters controlling the code cache. As these
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    64
         * parameters have implications on the physical memory
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    65
         * reserved by the VM, setting them to large values may hang
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    66
         * the system and/or may cause concurrently executed tests to
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    67
         * fail. These parameters are rigorously checked when the code
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    68
         * cache is initialized (see
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    69
         * hotspot/src/shared/vm/code/codeCache.cpp), therefore
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    70
         * omitting testing for them does not pose a problem.
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    71
         */
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    72
        allOptionsAsMap.remove("InitialCodeCacheSize");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    73
        allOptionsAsMap.remove("CodeCacheMinimumUseSpace");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    74
        allOptionsAsMap.remove("ReservedCodeCacheSize");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    75
        allOptionsAsMap.remove("NonProfiledCodeHeapSize");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    76
        allOptionsAsMap.remove("ProfiledCodeHeapSize");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    77
        allOptionsAsMap.remove("NonNMethodCodeHeapSize");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    78
        allOptionsAsMap.remove("CodeCacheExpansionSize");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 31372
diff changeset
    79
31372
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    80
        allOptions = new ArrayList<>(allOptionsAsMap.values());
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    81
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    82
        Asserts.assertGT(allOptions.size(), 0, "Options with ranges not found!");
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    83
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    84
        System.out.println("Parsed " + allOptions.size() + " options with ranges. Start test!");
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    85
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    86
        failedTests = JVMOptionsUtils.runCommandLineTests(allOptions);
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    87
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    88
        Asserts.assertEQ(failedTests, 0,
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    89
                String.format("%d tests failed! %s", failedTests, JVMOptionsUtils.getMessageWithFailures()));
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    90
    }
9821df46cf47 8072931: JEP-JDK-8059557: Test task: test framework development
ddmitriev
parents:
diff changeset
    91
}