test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java

Mon, 11 Aug 2014 19:19:47 +0400

author
fzhinkin
date
Mon, 11 Aug 2014 19:19:47 +0400
changeset 6999
cabe05c85665
parent 6640
9f9257611ade
child 7088
999824269b71
permissions
-rw-r--r--

8054805: Update CLI tests on RTM options to reflect changes in JDK-8054376
Reviewed-by: kvn

     1 /*
     2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 /**
    26  * @test
    27  * @bug 8031320
    28  * @summary Verify UseRTMDeopt option processing on CPUs with rtm support
    29  *          when rtm locking is supported by VM.
    30  * @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
    31  * @build TestUseRTMDeoptOptionOnSupportedConfig
    32  * @run main ClassFileInstaller sun.hotspot.WhiteBox
    33  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
    34  *                   -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnSupportedConfig
    35  */
    37 import com.oracle.java.testlibrary.ExitCode;
    38 import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
    39 import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
    40 import rtm.predicate.SupportedCPU;
    41 import rtm.predicate.SupportedVM;
    43 public class TestUseRTMDeoptOptionOnSupportedConfig
    44         extends CommandLineOptionTest {
    45     private static final String DEFAULT_VALUE = "false";
    47     private TestUseRTMDeoptOptionOnSupportedConfig() {
    48         super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
    49     }
    51     @Override
    52     public void runTestCases() throws Throwable {
    53         // verify that option could be turned on
    54         CommandLineOptionTest.verifySameJVMStartup(
    55                 null, null, ExitCode.OK, "-XX:+UseRTMDeopt");
    56         // verify that option could be turned off
    57         CommandLineOptionTest.verifySameJVMStartup(
    58                 null, null, ExitCode.OK, "-XX:-UseRTMDeopt");
    59         // verify default value
    60         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
    61                 TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE);
    62         // verify default value
    63         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
    64                 TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE,
    65                 "-XX:+UseRTMLocking");
    66         // verify that option is off when UseRTMLocking is off
    67         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
    68                 "false", "-XX:-UseRTMLocking", "-XX:+UseRTMDeopt");
    69         // verify that option could be turned on
    70         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
    71                 "true", "-XX:+UseRTMLocking", "-XX:+UseRTMDeopt");
    72     }
    74     public static void main(String args[]) throws Throwable {
    75         new TestUseRTMDeoptOptionOnSupportedConfig().test();
    76     }
    77 }

mercurial