test/compiler/arguments/BMIUnsupportedCPUTest.java

Mon, 28 Jul 2014 15:06:38 -0700

author
fzhinkin
date
Mon, 28 Jul 2014 15:06:38 -0700
changeset 6997
dbb05f6d93c4
parent 0
f90c822e73f8
permissions
-rw-r--r--

8051344: JVM crashed in Compile::start() during method parsing w/ UseRTMDeopt turned on
Summary: call rtm_deopt() only if there were no compilation bailouts before.
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  */
    24 import com.oracle.java.testlibrary.*;
    25 import com.oracle.java.testlibrary.cli.*;
    27 /**
    28  * Test on bit manipulation related command line options,
    29  * that should be executed on CPU that does not support
    30  * required features.
    31  */
    32 public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
    34     /**
    35      * Construct new test on {@code optionName} option.
    36      *
    37      * @param optionName Name of the option to be tested
    38      *                   without -XX:[+-] prefix.
    39      * @param warningMessage Message that can occur in VM output
    40      *                       if CPU on test box does not support
    41      *                       features required by the option.
    42      * @param cpuFeatures CPU features requires by the option.
    43      */
    44     public BMIUnsupportedCPUTest(String optionName,
    45                                  String warningMessage,
    46                                  String... cpuFeatures) {
    47         super(optionName, warningMessage, null, cpuFeatures);
    48     }
    50     @Override
    51     public void runTestCases() throws Throwable {
    52         if (Platform.isX86() || Platform.isX64()) {
    53             unsupportedX86CPUTestCases();
    54         } else {
    55             unsupportedNonX86CPUTestCases();
    56         }
    57     }
    59     /**
    60      * Run test cases common for all bit manipulation related VM options
    61      * targeted to X86 CPU that does not support required features.
    62      *
    63      * @throws Throwable if test failed.
    64      */
    65     public void unsupportedX86CPUTestCases() throws Throwable {
    67         // verify that VM will succesfully start up, but output will
    68         // contain a warning
    69         CommandLineOptionTest.
    70             verifyJVMStartup("-XX:+" + optionName,
    71                              new String[] { warningMessage },
    72                              new String[] { errorMessage },
    73                              ExitCode.OK);
    75         // verify that VM will succesfully startup without any warnings
    76         CommandLineOptionTest.
    77             verifyJVMStartup("-XX:-" + optionName,
    78                              null,
    79                              new String[] { warningMessage, errorMessage },
    80                              ExitCode.OK);
    82         // verify that on unsupported CPUs option is off by default
    83         CommandLineOptionTest.verifyOptionValue(optionName, "false");
    85         // verify that on unsupported CPUs option will be off even if
    86         // it was explicitly turned on by uset
    87         CommandLineOptionTest.verifyOptionValue(optionName, "false",
    88                                                      "-XX:+" + optionName);
    90     }
    92     /**
    93      * Run test cases common for all bit manipulation related VM options
    94      * targeted to non-X86 CPU that does not support required features.
    95      *
    96      * @throws Throwable if test failed.
    97      */
    98     public void unsupportedNonX86CPUTestCases() throws Throwable {
   100         // verify that VM known nothing about tested option
   101         CommandLineOptionTest.
   102             verifyJVMStartup("-XX:+" + optionName,
   103                              new String[] { errorMessage },
   104                              null,
   105                              ExitCode.FAIL);
   107         CommandLineOptionTest.
   108             verifyJVMStartup("-XX:-" + optionName,
   109                              new String[] { errorMessage },
   110                              null,
   111                              ExitCode.FAIL);
   112     }
   113 }

mercurial