test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java

Print this page
rev 6420 : 8054805: Update CLI tests on RTM options to reflect changes in JDK-8054376
Reviewed-by:


  36 
  37 import com.oracle.java.testlibrary.ExitCode;
  38 import com.oracle.java.testlibrary.cli.*;
  39 import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
  40 import rtm.predicate.SupportedCPU;
  41 import rtm.predicate.SupportedVM;
  42 
  43 public class TestUseRTMLockingOptionOnSupportedConfig
  44         extends CommandLineOptionTest {
  45     private static final String DEFAULT_VALUE = "false";
  46 
  47     private TestUseRTMLockingOptionOnSupportedConfig() {
  48         super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
  49     }
  50 
  51     @Override
  52     public void runTestCases() throws Throwable {
  53         String unrecongnizedOption
  54                 = CommandLineOptionTest.getUnrecognizedOptionErrorMessage(
  55                 "UseRTMLocking");
  56         String experimentalOptionError
  57                 = CommandLineOptionTest.getExperimentalOptionErrorMessage(
  58                 "UseRTMLocking");
  59         // verify that options is experimental
  60         CommandLineOptionTest.verifySameJVMStartup(
  61                 new String[] { experimentalOptionError }, null, ExitCode.FAIL,
  62                 "-XX:+UseRTMLocking");
  63         // verify that there are no warning or error in VM output
  64         CommandLineOptionTest.verifySameJVMStartup(null,
  65                 new String[]{
  66                         RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR,
  67                         unrecongnizedOption
  68                 }, ExitCode.OK,
  69                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  70                 "-XX:+UseRTMLocking");
  71 
  72         CommandLineOptionTest.verifySameJVMStartup(null,
  73                 new String[]{
  74                         RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR,
  75                         unrecongnizedOption
  76                 }, ExitCode.OK,
  77                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  78                 "-XX:-UseRTMLocking");
  79         // verify that UseRTMLocking is of by default
  80         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
  81                 TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE,
  82                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
  83         // verify that we can change UseRTMLocking value
  84         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
  85                 TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE,
  86                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  87                 "-XX:-UseRTMLocking");
  88         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
  89                 "true", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  90                 "-XX:+UseRTMLocking");
  91     }
  92 
  93     public static void main(String args[]) throws Throwable {
  94         new TestUseRTMLockingOptionOnSupportedConfig().test();
  95     }
  96 }


  36 
  37 import com.oracle.java.testlibrary.ExitCode;
  38 import com.oracle.java.testlibrary.cli.*;
  39 import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
  40 import rtm.predicate.SupportedCPU;
  41 import rtm.predicate.SupportedVM;
  42 
  43 public class TestUseRTMLockingOptionOnSupportedConfig
  44         extends CommandLineOptionTest {
  45     private static final String DEFAULT_VALUE = "false";
  46 
  47     private TestUseRTMLockingOptionOnSupportedConfig() {
  48         super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
  49     }
  50 
  51     @Override
  52     public void runTestCases() throws Throwable {
  53         String unrecongnizedOption
  54                 =  CommandLineOptionTest.getUnrecognizedOptionErrorMessage(
  55                 "UseRTMLocking");







  56         // verify that there are no warning or error in VM output
  57         CommandLineOptionTest.verifySameJVMStartup(null,
  58                 new String[]{
  59                         RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR,
  60                         unrecongnizedOption
  61                 }, ExitCode.OK, "-XX:+UseRTMLocking"
  62         );

  63 
  64         CommandLineOptionTest.verifySameJVMStartup(null,
  65                 new String[]{
  66                         RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR,
  67                         unrecongnizedOption
  68                 }, ExitCode.OK, "-XX:-UseRTMLocking"
  69         );

  70         // verify that UseRTMLocking is of by default
  71         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
  72                 TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE);

  73         // verify that we can change UseRTMLocking value
  74         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
  75                 TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE,

  76                 "-XX:-UseRTMLocking");
  77         CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
  78                 "true", "-XX:+UseRTMLocking");

  79     }
  80 
  81     public static void main(String args[]) throws Throwable {
  82         new TestUseRTMLockingOptionOnSupportedConfig().test();
  83     }
  84 }