Path: blob/master/test/hotspot/jtreg/compiler/arguments/BMISupportedCPUTest.java
41149 views
/*1* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package compiler.arguments;2425import jdk.test.lib.process.ExitCode;26import jdk.test.lib.cli.CommandLineOptionTest;2728/**29* Test on bit manipulation related command line options,30* that should be executed on CPU that supports all required31* features.32*33* Note that this test intended to verify that VM could be launched with34* specific options and that values of these options processed correctly.35* In order to do that test launch a new VM with tested options, the same36* flavor-specific flag as one that was used for parent VM (-client, -server,37* -minimal, -graal) and '-version'.38*/39public class BMISupportedCPUTest extends BMICommandLineOptionTestBase {4041/**42* Construct new test on {@code optionName} option.43*44* @param optionName Name of the option to be tested45* without -XX:[+-] prefix.46* @param warningMessage Message that can occur in VM output47* if CPU on test box does not support48* features required by the option.49* @param cpuFeatures CPU features requires by the option.50*/51public BMISupportedCPUTest(String optionName,52String warningMessage,53String... cpuFeatures) {54super(optionName, warningMessage, cpuFeatures, null);55}5657@Override58public void runTestCases() throws Throwable {59/*60Verify that VM will successfully start up without warnings.61VM will be launched with following flags:62-XX:+<tested option> -version63*/64String errorString = String.format("JVM should start with '-XX:+%s'"65+ " flag without any warnings", optionName);66CommandLineOptionTest.verifySameJVMStartup(null,67new String[] { warningMessage }, errorString, errorString,68ExitCode.OK,69CommandLineOptionTest.prepareBooleanFlag(optionName, true));7071/*72Verify that VM will successfully start up without warnings.73VM will be launched with following flags:74-XX:-<tested option> -version75*/76errorString = String.format("JVM should start with '-XX:-%s'"77+ " flag without any warnings", optionName);78CommandLineOptionTest.verifySameJVMStartup(null,79new String[] { warningMessage }, errorString,80errorString, ExitCode.OK,81CommandLineOptionTest.prepareBooleanFlag(optionName, false));8283/*84Verify that on appropriate CPU option in on by default.85VM will be launched with following flags:86-version87*/88CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",89String.format("Option '%s' is expected to have default value "90+ "'true'", optionName));9192/*93Verify that option could be explicitly turned off.94VM will be launched with following flags:95-XX:-<tested option> -version96*/97CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",98String.format("Option '%s' is set to have value 'false'",99optionName),100CommandLineOptionTest.prepareBooleanFlag(optionName, false));101}102}103104105106