32 * which don't support instruction required by the tested option. 33 */ 34 public class GenericTestCaseForUnsupportedAArch64CPU extends 35 SHAOptionsBase.TestCase { 36 public GenericTestCaseForUnsupportedAArch64CPU(String optionName) { 37 super(optionName, new AndPredicate(Platform::isAArch64, 38 new NotPredicate(SHAOptionsBase.getPredicateForOption( 39 optionName)))); 40 } 41 42 @Override 43 protected void verifyWarnings() throws Throwable { 44 String shouldPassMessage = String.format("JVM startup should pass with" 45 + "option '-XX:-%s' without any warnings", optionName); 46 //Verify that option could be disabled without any warnings. 47 CommandLineOptionTest.verifySameJVMStartup(null, new String[] { 48 SHAOptionsBase.getWarningForUnsupportedCPU(optionName) 49 }, shouldPassMessage, shouldPassMessage, ExitCode.OK, 50 CommandLineOptionTest.prepareBooleanFlag(optionName, false)); 51 52 shouldPassMessage = String.format("JVM should start with '-XX:+" 53 + "%s' flag, but output should contain warning.", optionName); 54 // Verify that when the tested option is explicitly enabled, then 55 // a warning will occur in VM output. 56 CommandLineOptionTest.verifySameJVMStartup(new String[] { 57 SHAOptionsBase.getWarningForUnsupportedCPU(optionName) 58 }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK, 59 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 60 } 61 62 @Override 63 protected void verifyOptionValues() throws Throwable { 64 // Verify that option is disabled by default. 65 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 66 String.format("Option '%s' should be disabled by default", 67 optionName)); 68 69 // Verify that option is disabled even if it was explicitly enabled 70 // using CLI options. 71 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 72 String.format("Option '%s' should be off on unsupported " 73 + "AArch64CPU even if set to true directly", optionName), 74 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 75 76 // Verify that option is disabled when +UseSHA was passed to JVM. 77 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 78 String.format("Option '%s' should be off on unsupported " 79 + "AArch64CPU even if %s flag set to JVM", | 32 * which don't support instruction required by the tested option. 33 */ 34 public class GenericTestCaseForUnsupportedAArch64CPU extends 35 SHAOptionsBase.TestCase { 36 public GenericTestCaseForUnsupportedAArch64CPU(String optionName) { 37 super(optionName, new AndPredicate(Platform::isAArch64, 38 new NotPredicate(SHAOptionsBase.getPredicateForOption( 39 optionName)))); 40 } 41 42 @Override 43 protected void verifyWarnings() throws Throwable { 44 String shouldPassMessage = String.format("JVM startup should pass with" 45 + "option '-XX:-%s' without any warnings", optionName); 46 //Verify that option could be disabled without any warnings. 47 CommandLineOptionTest.verifySameJVMStartup(null, new String[] { 48 SHAOptionsBase.getWarningForUnsupportedCPU(optionName) 49 }, shouldPassMessage, shouldPassMessage, ExitCode.OK, 50 CommandLineOptionTest.prepareBooleanFlag(optionName, false)); 51 52 shouldPassMessage = String.format("If JVM is started with '-XX:-" 53 + "%s' '-XX:+%s', output should contain warning.", 54 SHAOptionsBase.USE_SHA_OPTION, optionName); 55 56 // Verify that when the tested option is enabled, then 57 // a warning will occur in VM output if UseSHA is disabled. 58 if (!optionName.equals(SHAOptionsBase.USE_SHA_OPTION)) { 59 CommandLineOptionTest.verifySameJVMStartup( 60 new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) }, 61 null, 62 shouldPassMessage, 63 shouldPassMessage, 64 ExitCode.OK, 65 CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false), 66 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 67 } 68 } 69 70 @Override 71 protected void verifyOptionValues() throws Throwable { 72 // Verify that option is disabled by default. 73 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 74 String.format("Option '%s' should be disabled by default", 75 optionName)); 76 77 // Verify that option is disabled even if it was explicitly enabled 78 // using CLI options. 79 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 80 String.format("Option '%s' should be off on unsupported " 81 + "AArch64CPU even if set to true directly", optionName), 82 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 83 84 // Verify that option is disabled when +UseSHA was passed to JVM. 85 CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", 86 String.format("Option '%s' should be off on unsupported " 87 + "AArch64CPU even if %s flag set to JVM", |