31 32 /** 33 * UseSHA specific test case targeted to SPARC CPUs which don't support all sha* 34 * instructions. 35 */ 36 public class UseSHASpecificTestCaseForUnsupportedSparcCPU 37 extends SHAOptionsBase.TestCase { 38 public UseSHASpecificTestCaseForUnsupportedSparcCPU(String optionName) { 39 super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc, 40 new NotPredicate( 41 IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE))); 42 43 Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION, 44 "Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION 45 + " option only."); 46 } 47 48 @Override 49 protected void verifyWarnings() throws Throwable { 50 // Verify that attempt to use UseSHA option will cause a warning. 51 CommandLineOptionTest.verifySameJVMStartup(new String[] { 52 SHAOptionsBase.getWarningForUnsupportedCPU(optionName) 53 }, null, ExitCode.OK, 54 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 55 } 56 57 @Override 58 protected void verifyOptionValues() throws Throwable { 59 // Verify that UseSHA option remains disabled even if all 60 // UseSHA*Intrincs options were enabled. 61 CommandLineOptionTest.verifyOptionValueForSameVM( 62 SHAOptionsBase.USE_SHA_OPTION, "false", 63 CommandLineOptionTest.prepareBooleanFlag( 64 SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true), 65 CommandLineOptionTest.prepareBooleanFlag( 66 SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true), 67 CommandLineOptionTest.prepareBooleanFlag( 68 SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true)); 69 70 // Verify that UseSHA option remains disabled even if all 71 // UseSHA*Intrincs options were enabled and UseSHA was enabled as well. 72 CommandLineOptionTest.verifyOptionValueForSameVM( 73 SHAOptionsBase.USE_SHA_OPTION, "false", 74 CommandLineOptionTest.prepareBooleanFlag( 75 SHAOptionsBase.USE_SHA_OPTION, true), 76 CommandLineOptionTest.prepareBooleanFlag( 77 SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true), 78 CommandLineOptionTest.prepareBooleanFlag( 79 SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true), 80 CommandLineOptionTest.prepareBooleanFlag( 81 SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true)); 82 } 83 } | 31 32 /** 33 * UseSHA specific test case targeted to SPARC CPUs which don't support all sha* 34 * instructions. 35 */ 36 public class UseSHASpecificTestCaseForUnsupportedSparcCPU 37 extends SHAOptionsBase.TestCase { 38 public UseSHASpecificTestCaseForUnsupportedSparcCPU(String optionName) { 39 super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc, 40 new NotPredicate( 41 IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE))); 42 43 Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION, 44 "Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION 45 + " option only."); 46 } 47 48 @Override 49 protected void verifyWarnings() throws Throwable { 50 // Verify that attempt to use UseSHA option will cause a warning. 51 String shouldPassMessage = String.format("JVM startup should pass with" 52 + " '%s' option on unsupported SparcCPU, but there should be" 53 + "the message shown.", optionName); 54 CommandLineOptionTest.verifySameJVMStartup(new String[] { 55 SHAOptionsBase.getWarningForUnsupportedCPU(optionName) 56 }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK, 57 CommandLineOptionTest.prepareBooleanFlag(optionName, true)); 58 } 59 60 @Override 61 protected void verifyOptionValues() throws Throwable { 62 // Verify that UseSHA option remains disabled even if all 63 // UseSHA*Intrinsics were enabled. 64 CommandLineOptionTest.verifyOptionValueForSameVM( 65 SHAOptionsBase.USE_SHA_OPTION, "false", String.format( 66 "%s option should be disabled on unsupported SparcCPU" 67 + " even if all UseSHA*Intrinsics options were enabled.", 68 SHAOptionsBase.USE_SHA_OPTION), 69 CommandLineOptionTest.prepareBooleanFlag( 70 SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true), 71 CommandLineOptionTest.prepareBooleanFlag( 72 SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true), 73 CommandLineOptionTest.prepareBooleanFlag( 74 SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true)); 75 76 // Verify that UseSHA option remains disabled even if all 77 // UseSHA*Intrinsics options were enabled and UseSHA was enabled as well. 78 CommandLineOptionTest.verifyOptionValueForSameVM( 79 SHAOptionsBase.USE_SHA_OPTION, "false", String.format( 80 "%s option should be disabled on unsupported SparcCPU" 81 + " even if all UseSHA*Intrinsics options were enabled" 82 + " and %s was enabled as well", 83 SHAOptionsBase.USE_SHA_OPTION, 84 SHAOptionsBase.USE_SHA_OPTION), 85 CommandLineOptionTest.prepareBooleanFlag( 86 SHAOptionsBase.USE_SHA_OPTION, true), 87 CommandLineOptionTest.prepareBooleanFlag( 88 SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true), 89 CommandLineOptionTest.prepareBooleanFlag( 90 SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true), 91 CommandLineOptionTest.prepareBooleanFlag( 92 SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true)); 93 } 94 } |