< prev index next >

test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java

Print this page




  32  * support instructions required by the tested option.
  33  */
  34 public class GenericTestCaseForSupportedCPU extends
  35         SHAOptionsBase.TestCase {
  36     public GenericTestCaseForSupportedCPU(String optionName) {
  37         super(optionName,
  38                 new AndPredicate(
  39                     new OrPredicate(Platform::isSparc, Platform::isAArch64),
  40                     SHAOptionsBase.getPredicateForOption(optionName)));
  41     }
  42 
  43     @Override
  44     protected void verifyWarnings() throws Throwable {
  45 
  46         String shouldPassMessage = String.format("JVM should start with option"
  47                 + " '%s' without any warnings", optionName);
  48         // Verify that there are no warning when option is explicitly enabled.
  49         CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
  50                         SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
  51                 }, shouldPassMessage, shouldPassMessage, ExitCode.OK,

  52                 CommandLineOptionTest.prepareBooleanFlag(optionName, true));
  53 
  54         // Verify that option could be disabled even if +UseSHA was passed to
  55         // JVM.
  56         CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
  57                         SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
  58                 }, shouldPassMessage, String.format("It should be able to "
  59                         + "disable option '%s' even if %s was passed to JVM",
  60                         optionName, CommandLineOptionTest.prepareBooleanFlag(
  61                             SHAOptionsBase.USE_SHA_OPTION, true)),
  62                 ExitCode.OK,

  63                 CommandLineOptionTest.prepareBooleanFlag(
  64                         SHAOptionsBase.USE_SHA_OPTION, true),
  65                 CommandLineOptionTest.prepareBooleanFlag(optionName, false));
  66 
  67         if (!optionName.equals(SHAOptionsBase.USE_SHA_OPTION)) {
  68             // Verify that if -XX:-UseSHA is passed to the JVM, it is not possible
  69             // to enable the tested option and a warning is printed.
  70             CommandLineOptionTest.verifySameJVMStartup(
  71                     new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) },
  72                     null,
  73                     shouldPassMessage,
  74                     String.format("Enabling option '%s' should not be possible and should result in a warning if %s was passed to JVM",
  75                                   optionName,
  76                                   CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false)),
  77                     ExitCode.OK,

  78                     CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false),
  79                     CommandLineOptionTest.prepareBooleanFlag(optionName, true));
  80         }
  81     }
  82 
  83     @Override
  84     protected void verifyOptionValues() throws Throwable {
  85         // Verify that "It should be able to disable option "
  86 
  87         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
  88                 String.format("Option '%s' should be enabled by default",
  89                         optionName));

  90 
  91         // Verify that it is possible to explicitly enable the option.
  92         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
  93                 String.format("Option '%s' was set to have value 'true'",
  94                         optionName),

  95                 CommandLineOptionTest.prepareBooleanFlag(optionName, true));
  96 
  97         // Verify that it is possible to explicitly disable the option.
  98         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
  99                 String.format("Option '%s' was set to have value 'false'",
 100                         optionName),

 101                 CommandLineOptionTest.prepareBooleanFlag(optionName, false));
 102 
 103         // verify that option is disabled when -UseSHA was passed to JVM.
 104         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
 105                 String.format("Option '%s' should have value 'false' when %s"
 106                         + " flag set to JVM", optionName,
 107                         CommandLineOptionTest.prepareBooleanFlag(
 108                             SHAOptionsBase.USE_SHA_OPTION, false)),

 109                 CommandLineOptionTest.prepareBooleanFlag(optionName, true),
 110                 CommandLineOptionTest.prepareBooleanFlag(
 111                         SHAOptionsBase.USE_SHA_OPTION, false));
 112 
 113         // Verify that it is possible to explicitly disable the tested option
 114         // even if +UseSHA was passed to JVM.
 115         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
 116                 String.format("Option '%s' should have value 'false' if set so"
 117                         + " even if %s flag set to JVM", optionName,
 118                         CommandLineOptionTest.prepareBooleanFlag(
 119                             SHAOptionsBase.USE_SHA_OPTION, true)),

 120                 CommandLineOptionTest.prepareBooleanFlag(
 121                         SHAOptionsBase.USE_SHA_OPTION, true),
 122                 CommandLineOptionTest.prepareBooleanFlag(optionName, false));
 123     }
 124 }


  32  * support instructions required by the tested option.
  33  */
  34 public class GenericTestCaseForSupportedCPU extends
  35         SHAOptionsBase.TestCase {
  36     public GenericTestCaseForSupportedCPU(String optionName) {
  37         super(optionName,
  38                 new AndPredicate(
  39                     new OrPredicate(Platform::isSparc, Platform::isAArch64),
  40                     SHAOptionsBase.getPredicateForOption(optionName)));
  41     }
  42 
  43     @Override
  44     protected void verifyWarnings() throws Throwable {
  45 
  46         String shouldPassMessage = String.format("JVM should start with option"
  47                 + " '%s' without any warnings", optionName);
  48         // Verify that there are no warning when option is explicitly enabled.
  49         CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
  50                         SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
  51                 }, shouldPassMessage, shouldPassMessage, ExitCode.OK,
  52                 SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
  53                 CommandLineOptionTest.prepareBooleanFlag(optionName, true));
  54 
  55         // Verify that option could be disabled even if +UseSHA was passed to
  56         // JVM.
  57         CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
  58                         SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
  59                 }, shouldPassMessage, String.format("It should be able to "
  60                         + "disable option '%s' even if %s was passed to JVM",
  61                         optionName, CommandLineOptionTest.prepareBooleanFlag(
  62                             SHAOptionsBase.USE_SHA_OPTION, true)),
  63                 ExitCode.OK,
  64                 SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
  65                 CommandLineOptionTest.prepareBooleanFlag(
  66                         SHAOptionsBase.USE_SHA_OPTION, true),
  67                 CommandLineOptionTest.prepareBooleanFlag(optionName, false));
  68 
  69         if (!optionName.equals(SHAOptionsBase.USE_SHA_OPTION)) {
  70             // Verify that if -XX:-UseSHA is passed to the JVM, it is not possible
  71             // to enable the tested option and a warning is printed.
  72             CommandLineOptionTest.verifySameJVMStartup(
  73                     new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) },
  74                     null,
  75                     shouldPassMessage,
  76                     String.format("Enabling option '%s' should not be possible and should result in a warning if %s was passed to JVM",
  77                                   optionName,
  78                                   CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false)),
  79                     ExitCode.OK,
  80                     SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
  81                     CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false),
  82                     CommandLineOptionTest.prepareBooleanFlag(optionName, true));
  83         }
  84     }
  85 
  86     @Override
  87     protected void verifyOptionValues() throws Throwable {
  88         // Verify that "It should be able to disable option "
  89 
  90         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
  91                 String.format("Option '%s' should be enabled by default",
  92                         optionName),
  93                 SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS);
  94 
  95         // Verify that it is possible to explicitly enable the option.
  96         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
  97                 String.format("Option '%s' was set to have value 'true'",
  98                         optionName),
  99                 SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
 100                 CommandLineOptionTest.prepareBooleanFlag(optionName, true));
 101 
 102         // Verify that it is possible to explicitly disable the option.
 103         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
 104                 String.format("Option '%s' was set to have value 'false'",
 105                         optionName),
 106                 SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
 107                 CommandLineOptionTest.prepareBooleanFlag(optionName, false));
 108 
 109         // verify that option is disabled when -UseSHA was passed to JVM.
 110         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
 111                 String.format("Option '%s' should have value 'false' when %s"
 112                         + " flag set to JVM", optionName,
 113                         CommandLineOptionTest.prepareBooleanFlag(
 114                             SHAOptionsBase.USE_SHA_OPTION, false)),
 115                 SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
 116                 CommandLineOptionTest.prepareBooleanFlag(optionName, true),
 117                 CommandLineOptionTest.prepareBooleanFlag(
 118                         SHAOptionsBase.USE_SHA_OPTION, false));
 119 
 120         // Verify that it is possible to explicitly disable the tested option
 121         // even if +UseSHA was passed to JVM.
 122         CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
 123                 String.format("Option '%s' should have value 'false' if set so"
 124                         + " even if %s flag set to JVM", optionName,
 125                         CommandLineOptionTest.prepareBooleanFlag(
 126                             SHAOptionsBase.USE_SHA_OPTION, true)),
 127                 SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
 128                 CommandLineOptionTest.prepareBooleanFlag(
 129                         SHAOptionsBase.USE_SHA_OPTION, true),
 130                 CommandLineOptionTest.prepareBooleanFlag(optionName, false));
 131     }
 132 }
< prev index next >