< prev index next >

test/hotspot/jtreg/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java

Print this page

 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 package compiler.rtm.cli;
 25 
 26 import jdk.test.lib.process.ExitCode;
 27 import jdk.test.lib.Platform;
 28 import jdk.test.lib.cli.CommandLineOptionTest;
 29 
 30 import java.util.function.BooleanSupplier;
 31 
 32 /**
 33  * Base for all RTM-related CLI tests.
 34  */
 35 public abstract class RTMGenericCommandLineOptionTest {
 36 
 37     protected static final String RTM_INSTR_ERROR
 38             = "RTM instructions are not available on this CPU";
 39     protected static final String RTM_OS_ERROR
 40             = "RTM is not supported on this OS version";
 41     protected static final String RTM_UNSUPPORTED_VM_ERROR
 42             = "RTM locking optimization is not supported in this VM";
 43     protected static final String RTM_FOR_STACK_LOCKS_WARNING
 44             = "UseRTMForStackLocks flag should be off when UseRTMLocking "
 45             + "flag is off";
 46     protected static final String RTM_COUNT_INCR_WARNING
 47             = "must be a power of 2, resetting it to 64";
 48 
 49     protected final String optionName;
 50     protected final String errorMessage;
 51     protected final String experimentalOptionError;
 52     protected final boolean isExperimental;
 53     protected final boolean isBoolean;
 54     protected final String defaultValue;
 55     protected final String[] optionValues;
 56 
 57     /**
 58      * Constructs new genetic RTM CLI test, for option {@code optionName} which
 59      * has default value {@code defaultValue}. Test cases will use option's
 60      * values passed via {@code optionValues} for verification of correct

 67      * @param isBoolean {@code true} if option is binary
 68      * @param isExperimental {@code true} if option is experimental
 69      * @param defaultValue default value of tested option
 70      * @param optionValues different option values
 71      */
 72     public RTMGenericCommandLineOptionTest(
 73             String optionName, boolean isBoolean, boolean isExperimental,
 74             String defaultValue, String... optionValues) {
 75         this.optionName = optionName;
 76         this.isExperimental = isExperimental;
 77         this.isBoolean = isBoolean;
 78         this.defaultValue = defaultValue;
 79         this.optionValues = optionValues;
 80         this.errorMessage = CommandLineOptionTest.
 81                 getUnrecognizedOptionErrorMessage(optionName);
 82         this.experimentalOptionError = CommandLineOptionTest.
 83                 getExperimentalOptionErrorMessage(optionName);
 84     }
 85 
 86     public void runTestCases() throws Throwable {
 87         if (Platform.isX86() || Platform.isX64() || Platform.isPPC()) {
 88             if (Platform.isServer()) {
 89                 runX86SupportedVMTestCases();
 90             } else {
 91                 runX86UnsupportedVMTestCases();
 92             }
 93         } else {
 94             runNonX86TestCases();
 95         }
 96     }
 97 
 98     /**
 99      * Runs test cases on X86 CPU if VM supports RTM locking.
100      * @throws Throwable
101      */
102     protected void runX86SupportedVMTestCases() throws Throwable {
103         runGenericX86TestCases();
104     }
105 
106     /**
107      * Runs test cases on X86 CPU if VM does not support RTM locking.

 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 package compiler.rtm.cli;
 25 
 26 import jdk.test.lib.process.ExitCode;
 27 import jdk.test.lib.Platform;
 28 import jdk.test.lib.cli.CommandLineOptionTest;
 29 
 30 import java.util.function.BooleanSupplier;
 31 
 32 /**
 33  * Base for all RTM-related CLI tests.
 34  */
 35 public abstract class RTMGenericCommandLineOptionTest {
 36 
 37     protected static final String RTM_INSTR_ERROR
 38             = "RTM instructions are not available on this CPU";


 39     protected static final String RTM_UNSUPPORTED_VM_ERROR
 40             = "RTM locking optimization is not supported in this VM";
 41     protected static final String RTM_FOR_STACK_LOCKS_WARNING
 42             = "UseRTMForStackLocks flag should be off when UseRTMLocking "
 43             + "flag is off";
 44     protected static final String RTM_COUNT_INCR_WARNING
 45             = "must be a power of 2, resetting it to 64";
 46 
 47     protected final String optionName;
 48     protected final String errorMessage;
 49     protected final String experimentalOptionError;
 50     protected final boolean isExperimental;
 51     protected final boolean isBoolean;
 52     protected final String defaultValue;
 53     protected final String[] optionValues;
 54 
 55     /**
 56      * Constructs new genetic RTM CLI test, for option {@code optionName} which
 57      * has default value {@code defaultValue}. Test cases will use option's
 58      * values passed via {@code optionValues} for verification of correct

 65      * @param isBoolean {@code true} if option is binary
 66      * @param isExperimental {@code true} if option is experimental
 67      * @param defaultValue default value of tested option
 68      * @param optionValues different option values
 69      */
 70     public RTMGenericCommandLineOptionTest(
 71             String optionName, boolean isBoolean, boolean isExperimental,
 72             String defaultValue, String... optionValues) {
 73         this.optionName = optionName;
 74         this.isExperimental = isExperimental;
 75         this.isBoolean = isBoolean;
 76         this.defaultValue = defaultValue;
 77         this.optionValues = optionValues;
 78         this.errorMessage = CommandLineOptionTest.
 79                 getUnrecognizedOptionErrorMessage(optionName);
 80         this.experimentalOptionError = CommandLineOptionTest.
 81                 getExperimentalOptionErrorMessage(optionName);
 82     }
 83 
 84     public void runTestCases() throws Throwable {
 85         if (Platform.isX86() || Platform.isX64()) {
 86             if (Platform.isServer()) {
 87                 runX86SupportedVMTestCases();
 88             } else {
 89                 runX86UnsupportedVMTestCases();
 90             }
 91         } else {
 92             runNonX86TestCases();
 93         }
 94     }
 95 
 96     /**
 97      * Runs test cases on X86 CPU if VM supports RTM locking.
 98      * @throws Throwable
 99      */
100     protected void runX86SupportedVMTestCases() throws Throwable {
101         runGenericX86TestCases();
102     }
103 
104     /**
105      * Runs test cases on X86 CPU if VM does not support RTM locking.
< prev index next >