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 24 import com.oracle.java.testlibrary.*; 25 import com.oracle.java.testlibrary.cli.*; 26 27 /** 28 * Test on bit manipulation related command line options, 29 * that should be executed on CPU that supports all required 30 * features. 31 */ 32 public class BMISupportedCPUTest extends BMICommandLineOptionTestBase { 33 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 BMISupportedCPUTest(String optionName, 45 String warningMessage, 46 String... cpuFeatures) { 47 super(optionName, warningMessage, cpuFeatures, null); 48 } 49 50 @Override 51 public void runTestCases() throws Throwable { 52 // verify that VM will successfully start up without warnings 53 CommandLineOptionTest.verifySameJVMStartup(null, 54 new String[] { warningMessage }, ExitCode.OK, 55 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 56 57 // verify that VM will successfully start up without warnings 58 CommandLineOptionTest.verifySameJVMStartup(null, 59 new String[] { warningMessage }, ExitCode.OK, 60 CommandLineOptionTest.prepareBooleanFlag(optionName, false)); 61 62 // verify that on appropriate CPU option in on by default 63 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true"); 64 65 // verify that option could be explicitly turned off 66 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 67 CommandLineOptionTest.prepareBooleanFlag(optionName, false)); 68 } 69 } 70