test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
Print this page
*** 57,93 ****
= CommandLineOptionTest.getUnrecognizedOptionErrorMessage(
"UseRTMLocking");
String errorMessage = RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR;
if (Platform.isX86() || Platform.isX64()) {
// verify that we get an error when use +UseRTMLocking
// on unsupported CPU
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage },
! new String[] { unrecongnizedOption },
ExitCode.FAIL, "-XX:+UseRTMLocking");
// verify that we can pass -UseRTMLocking without
// getting any error messages
! CommandLineOptionTest.verifySameJVMStartup(
! null,
! new String[]{
! errorMessage,
! unrecongnizedOption
! }, ExitCode.OK, "-XX:-UseRTMLocking");
// verify that UseRTMLocking is false by default
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
! TestUseRTMLockingOptionOnUnsupportedCPU.DEFAULT_VALUE);
} else {
// verify that on non-x86 CPUs RTMLocking could not be used
CommandLineOptionTest.verifySameJVMStartup(
new String[] { unrecongnizedOption },
! null, ExitCode.FAIL, "-XX:+UseRTMLocking");
CommandLineOptionTest.verifySameJVMStartup(
new String[] { unrecongnizedOption },
! null, ExitCode.FAIL, "-XX:-UseRTMLocking");
}
}
public static void main(String args[]) throws Throwable {
new TestUseRTMLockingOptionOnUnsupportedCPU().test();
--- 57,104 ----
= CommandLineOptionTest.getUnrecognizedOptionErrorMessage(
"UseRTMLocking");
String errorMessage = RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR;
if (Platform.isX86() || Platform.isX64()) {
+ String shouldFailMessage = "JVM startup should fail with option "
+ + "-XX:+UseRTMLocking on unsupported CPU";
// verify that we get an error when use +UseRTMLocking
// on unsupported CPU
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage },
! new String[] { unrecongnizedOption }, shouldFailMessage,
! shouldFailMessage + ". Error message should be shown",
ExitCode.FAIL, "-XX:+UseRTMLocking");
+
+ String shouldPassMessage = "JVM startup should pass with option "
+ + "-XX:-UseRTMLocking even on unsupported CPU";
// verify that we can pass -UseRTMLocking without
// getting any error messages
! CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
! errorMessage, unrecongnizedOption }, shouldPassMessage,
! shouldPassMessage + " without any warnings", ExitCode.OK,
! "-XX:-UseRTMLocking");
// verify that UseRTMLocking is false by default
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
! TestUseRTMLockingOptionOnUnsupportedCPU.DEFAULT_VALUE,
! String.format("Default value of option 'UseRTMLocking' "
! +"should be '%s'", DEFAULT_VALUE));
} else {
+ String shouldFailMessage = "RTMLocking should be unrecognized"
+ + " on non-x86 CPUs. JVM startup should fail."
+ + "Error message should be shown";
// verify that on non-x86 CPUs RTMLocking could not be used
CommandLineOptionTest.verifySameJVMStartup(
new String[] { unrecongnizedOption },
! null, shouldFailMessage, shouldFailMessage,
! ExitCode.FAIL, "-XX:+UseRTMLocking");
CommandLineOptionTest.verifySameJVMStartup(
new String[] { unrecongnizedOption },
! null, shouldFailMessage, shouldFailMessage,
! ExitCode.FAIL, "-XX:-UseRTMLocking");
}
}
public static void main(String args[]) throws Throwable {
new TestUseRTMLockingOptionOnUnsupportedCPU().test();