test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java

Print this page

        

*** 56,101 **** = CommandLineOptionTest.getExperimentalOptionErrorMessage( "UseRTMForStackLocks"); String warningMessage = RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING; CommandLineOptionTest.verifySameJVMStartup( ! new String[] { errorMessage }, null, ExitCode.FAIL, "-XX:+UseRTMForStackLocks"); // verify that we get a warning when trying to use rtm for stack // lock, but not using rtm locking. CommandLineOptionTest.verifySameJVMStartup( ! new String[] { warningMessage }, null, ExitCode.OK, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:+UseRTMForStackLocks", "-XX:-UseRTMLocking"); // verify that we don't get a warning when no using rtm for stack // lock and not using rtm locking. CommandLineOptionTest.verifySameJVMStartup(null, ! new String[] { warningMessage }, ExitCode.OK, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:-UseRTMForStackLocks", "-XX:-UseRTMLocking"); // verify that we don't get a warning when using rtm for stack // lock and using rtm locking. CommandLineOptionTest.verifySameJVMStartup(null, ! new String[] { warningMessage }, ExitCode.OK, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:+UseRTMForStackLocks", "-XX:+UseRTMLocking"); // verify that default value if false CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); // verify that default value is false even with +UseRTMLocking CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:+UseRTMLocking"); // verify that we can turn the option on CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", ! "true", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:+UseRTMLocking", "-XX:+UseRTMForStackLocks"); } public static void main(String args[]) throws Throwable { new TestUseRTMForStackLocksOptionOnSupportedConfig().test(); --- 56,125 ---- = CommandLineOptionTest.getExperimentalOptionErrorMessage( "UseRTMForStackLocks"); String warningMessage = RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING; + String shouldFailMessage = " VM option 'UseRTMForStackLocks' is " + + "experimental%nJVM startup should fail without " + + "-XX:+UnlockExperimentalVMOptions flag"; + CommandLineOptionTest.verifySameJVMStartup( ! new String[] { errorMessage }, null, shouldFailMessage, ! shouldFailMessage + "%nError message expected", ExitCode.FAIL, "-XX:+UseRTMForStackLocks"); + String shouldPassMessage = " VM option 'UseRTMForStackLocks'" + + " is experimental%nJVM startup should pass with " + + "-XX:+UnlockExperimentalVMOptions flag"; // verify that we get a warning when trying to use rtm for stack // lock, but not using rtm locking. CommandLineOptionTest.verifySameJVMStartup( ! new String[] { warningMessage }, null, shouldPassMessage, ! "There should be warning when trying to use rtm for stack " ! + "lock, but not using rtm locking", ExitCode.OK, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:+UseRTMForStackLocks", "-XX:-UseRTMLocking"); // verify that we don't get a warning when no using rtm for stack // lock and not using rtm locking. CommandLineOptionTest.verifySameJVMStartup(null, ! new String[] { warningMessage }, shouldPassMessage, ! "There should not be any warning when use both " ! + "-XX:-UseRTMForStackLocks and -XX:-UseRTMLocking " ! + "flags", ! ExitCode.OK, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:-UseRTMForStackLocks", "-XX:-UseRTMLocking"); // verify that we don't get a warning when using rtm for stack // lock and using rtm locking. CommandLineOptionTest.verifySameJVMStartup(null, ! new String[] { warningMessage }, shouldPassMessage, ! "There should not be any warning when use both " ! + "-XX:+UseRTMForStackLocks and -XX:+UseRTMLocking" ! + " flags", ! ExitCode.OK, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:+UseRTMForStackLocks", "-XX:+UseRTMLocking"); // verify that default value if false CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE, + "Default value of option 'UseRTMForStackLocks' should be false", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); // verify that default value is false even with +UseRTMLocking CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE, + "Default value of option 'UseRTMForStackLocks' should be false", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:+UseRTMLocking"); // verify that we can turn the option on CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks", ! "true", "Value of option 'UseRTMForStackLocks' should " ! + "be able to be set as 'true' when both " ! + "-XX:+UseRTMForStackLocks and " ! + "-XX:+UseRTMLocking flags used", ! CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, "-XX:+UseRTMLocking", "-XX:+UseRTMForStackLocks"); } public static void main(String args[]) throws Throwable { new TestUseRTMForStackLocksOptionOnSupportedConfig().test();