test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java

Print this page

        

*** 55,91 **** "true"); } @Override protected void runX86SupportedVMTestCases() throws Throwable { // verify that option is experimental CommandLineOptionTest.verifySameJVMStartup( ! new String[]{ experimentalOptionError }, ! null, ExitCode.FAIL, prepareOptionValue("true")); CommandLineOptionTest.verifySameJVMStartup( ! new String[]{ experimentalOptionError }, ! null, ExitCode.FAIL, prepareOptionValue("false")); // verify that if we turn it on, then VM output will contain // warning saying that this option could be turned on only // when we use rtm locking CommandLineOptionTest.verifySameJVMStartup( new String[]{ RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING ! }, ! null, ExitCode.OK, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, prepareOptionValue("true") ); // verify that options is turned off by default CommandLineOptionTest.verifyOptionValueForSameVM(optionName, TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); // verify that it could not be turned on without rtm locking CommandLineOptionTest.verifyOptionValueForSameVM(optionName, TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, prepareOptionValue("true")); } public static void main(String args[]) throws Throwable { --- 55,108 ---- "true"); } @Override protected void runX86SupportedVMTestCases() throws Throwable { + String shouldFailMessage = String.format("VM option '%s' is " + + "experimental%nJVM startup should fail without " + + "-XX:+UnlockExperimentalVMOptions flag", optionName); + // verify that option is experimental CommandLineOptionTest.verifySameJVMStartup( ! new String[] { experimentalOptionError }, null, ! shouldFailMessage, shouldFailMessage + "%nError message " ! + "should be shown", ExitCode.FAIL, ! prepareOptionValue("true")); CommandLineOptionTest.verifySameJVMStartup( ! new String[]{ experimentalOptionError }, null, ! shouldFailMessage, shouldFailMessage + "%nError message " ! + "should be shown", ExitCode.FAIL, ! prepareOptionValue("false")); + String shouldPassMessage = String.format("VM option '%s' is " + + " experimental%nJVM startup should pass with " + + "-XX:+UnlockExperimentalVMOptions flag", optionName); // verify that if we turn it on, then VM output will contain // warning saying that this option could be turned on only // when we use rtm locking CommandLineOptionTest.verifySameJVMStartup( new String[]{ RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING ! }, null, shouldPassMessage, "There should be warning when try " ! + "to use rtm for stack lock, but not using rtm locking", ! ExitCode.OK, CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, prepareOptionValue("true") ); // verify that options is turned off by default CommandLineOptionTest.verifyOptionValueForSameVM(optionName, TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE, + String.format("Default value of option '%s' should be '%s'", + optionName, DEFAULT_VALUE), CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS); // verify that it could not be turned on without rtm locking CommandLineOptionTest.verifyOptionValueForSameVM(optionName, TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE, + String.format("Value of '%s' shouldn't able to be set to " + + "'true' without setting -XX:+UseRTMLocking flag", + optionName), CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, prepareOptionValue("true")); } public static void main(String args[]) throws Throwable {