mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-25 22:04:51 +02:00
8081790: aarch64: SHA tests fail
Fix SHA tests in JTReg so they recognize aarch64 Reviewed-by: duke
This commit is contained in:
parent
c163b85cb2
commit
252b1be912
17 changed files with 157 additions and 47 deletions
|
@ -228,6 +228,9 @@ void VM_Version::get_processor_features() {
|
||||||
warning("SHA512 instruction (for SHA-384 and SHA-512) is not available on this CPU.");
|
warning("SHA512 instruction (for SHA-384 and SHA-512) is not available on this CPU.");
|
||||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||||
}
|
}
|
||||||
|
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||||
|
FLAG_SET_DEFAULT(UseSHA, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This machine allows unaligned memory accesses
|
// This machine allows unaligned memory accesses
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class SHAOptionsBase extends CommandLineOptionTest {
|
||||||
* instructions required by the option are not supported.
|
* instructions required by the option are not supported.
|
||||||
*/
|
*/
|
||||||
protected static String getWarningForUnsupportedCPU(String optionName) {
|
protected static String getWarningForUnsupportedCPU(String optionName) {
|
||||||
if (Platform.isSparc()) {
|
if (Platform.isSparc() || Platform.isAArch64()) {
|
||||||
switch (optionName) {
|
switch (optionName) {
|
||||||
case SHAOptionsBase.USE_SHA_OPTION:
|
case SHAOptionsBase.USE_SHA_OPTION:
|
||||||
return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
|
return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
*/
|
*/
|
||||||
public class TestUseSHA1IntrinsicsOptionOnSupportedCPU {
|
public class TestUseSHA1IntrinsicsOptionOnSupportedCPU {
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
|
new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,12 @@ public class TestUseSHA1IntrinsicsOptionOnUnsupportedCPU {
|
||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForUnsupportedSparcCPU(
|
new GenericTestCaseForUnsupportedSparcCPU(
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
||||||
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
|
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
|
||||||
new GenericTestCaseForUnsupportedX86CPU(
|
new GenericTestCaseForUnsupportedX86CPU(
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
||||||
|
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||||
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
||||||
|
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||||
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
|
||||||
new GenericTestCaseForOtherCPU(
|
new GenericTestCaseForOtherCPU(
|
||||||
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
*/
|
*/
|
||||||
public class TestUseSHA256IntrinsicsOptionOnSupportedCPU {
|
public class TestUseSHA256IntrinsicsOptionOnSupportedCPU {
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
|
new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,12 @@ public class TestUseSHA256IntrinsicsOptionOnUnsupportedCPU {
|
||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForUnsupportedSparcCPU(
|
new GenericTestCaseForUnsupportedSparcCPU(
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
||||||
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
|
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
|
||||||
new GenericTestCaseForUnsupportedX86CPU(
|
new GenericTestCaseForUnsupportedX86CPU(
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
||||||
|
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||||
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
||||||
|
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||||
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
|
||||||
new GenericTestCaseForOtherCPU(
|
new GenericTestCaseForOtherCPU(
|
||||||
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
*/
|
*/
|
||||||
public class TestUseSHA512IntrinsicsOptionOnSupportedCPU {
|
public class TestUseSHA512IntrinsicsOptionOnSupportedCPU {
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
|
new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,12 @@ public class TestUseSHA512IntrinsicsOptionOnUnsupportedCPU {
|
||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForUnsupportedSparcCPU(
|
new GenericTestCaseForUnsupportedSparcCPU(
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
||||||
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
|
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
|
||||||
new GenericTestCaseForUnsupportedX86CPU(
|
new GenericTestCaseForUnsupportedX86CPU(
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
||||||
|
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||||
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
||||||
|
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||||
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
|
||||||
new GenericTestCaseForOtherCPU(
|
new GenericTestCaseForOtherCPU(
|
||||||
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
|
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
public class TestUseSHAOptionOnSupportedCPU {
|
public class TestUseSHAOptionOnSupportedCPU {
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForSupportedSparcCPU(
|
new GenericTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
new UseSHASpecificTestCaseForSupportedSparcCPU(
|
new UseSHASpecificTestCaseForSupportedCPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION)).test();
|
SHAOptionsBase.USE_SHA_OPTION)).test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,12 @@ public class TestUseSHAOptionOnUnsupportedCPU {
|
||||||
new SHAOptionsBase(
|
new SHAOptionsBase(
|
||||||
new GenericTestCaseForUnsupportedSparcCPU(
|
new GenericTestCaseForUnsupportedSparcCPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
new UseSHASpecificTestCaseForUnsupportedSparcCPU(
|
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
|
||||||
new GenericTestCaseForUnsupportedX86CPU(
|
new GenericTestCaseForUnsupportedX86CPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
|
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||||
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
|
new UseSHASpecificTestCaseForUnsupportedCPU(
|
||||||
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
new GenericTestCaseForOtherCPU(
|
new GenericTestCaseForOtherCPU(
|
||||||
SHAOptionsBase.USE_SHA_OPTION)).test();
|
SHAOptionsBase.USE_SHA_OPTION)).test();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,16 +35,18 @@ public class GenericTestCaseForOtherCPU extends
|
||||||
SHAOptionsBase.TestCase {
|
SHAOptionsBase.TestCase {
|
||||||
public GenericTestCaseForOtherCPU(String optionName) {
|
public GenericTestCaseForOtherCPU(String optionName) {
|
||||||
// Execute the test case on any CPU except SPARC and X86
|
// Execute the test case on any CPU except SPARC and X86
|
||||||
super(optionName, new NotPredicate(new OrPredicate(Platform::isSparc,
|
super(optionName, new NotPredicate(
|
||||||
new OrPredicate(Platform::isX64, Platform::isX86))));
|
new OrPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
|
new OrPredicate(Platform::isX64, Platform::isX86))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void verifyWarnings() throws Throwable {
|
protected void verifyWarnings() throws Throwable {
|
||||||
String shouldPassMessage = String.format("JVM should start with "
|
String shouldPassMessage = String.format("JVM should start with "
|
||||||
+ "option '%s' without any warnings", optionName);
|
+ "option '%s' without any warnings", optionName);
|
||||||
// Verify that on non-x86 and non-SPARC CPU usage of SHA-related
|
// Verify that on non-x86, non-SPARC and non-AArch64 CPU usage of
|
||||||
// options will not cause any warnings.
|
// SHA-related options will not cause any warnings.
|
||||||
CommandLineOptionTest.verifySameJVMStartup(null,
|
CommandLineOptionTest.verifySameJVMStartup(null,
|
||||||
new String[] { ".*" + optionName + ".*" }, shouldPassMessage,
|
new String[] { ".*" + optionName + ".*" }, shouldPassMessage,
|
||||||
shouldPassMessage, ExitCode.OK,
|
shouldPassMessage, ExitCode.OK,
|
||||||
|
|
|
@ -25,16 +25,19 @@ import jdk.test.lib.ExitCode;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
import jdk.test.lib.cli.predicate.AndPredicate;
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.OrPredicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic test case for SHA-related options targeted to SPARC CPUs which
|
* Generic test case for SHA-related options targeted to CPUs which
|
||||||
* support instructions required by the tested option.
|
* support instructions required by the tested option.
|
||||||
*/
|
*/
|
||||||
public class GenericTestCaseForSupportedSparcCPU extends
|
public class GenericTestCaseForSupportedCPU extends
|
||||||
SHAOptionsBase.TestCase {
|
SHAOptionsBase.TestCase {
|
||||||
public GenericTestCaseForSupportedSparcCPU(String optionName) {
|
public GenericTestCaseForSupportedCPU(String optionName) {
|
||||||
super(optionName, new AndPredicate(Platform::isSparc,
|
super(optionName,
|
||||||
SHAOptionsBase.getPredicateForOption(optionName)));
|
new AndPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
|
SHAOptionsBase.getPredicateForOption(optionName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.ExitCode;
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.NotPredicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic test case for SHA-related options targeted to AArch64 CPUs
|
||||||
|
* which don't support instruction required by the tested option.
|
||||||
|
*/
|
||||||
|
public class GenericTestCaseForUnsupportedAArch64CPU extends
|
||||||
|
SHAOptionsBase.TestCase {
|
||||||
|
public GenericTestCaseForUnsupportedAArch64CPU(String optionName) {
|
||||||
|
super(optionName, new AndPredicate(Platform::isAArch64,
|
||||||
|
new NotPredicate(SHAOptionsBase.getPredicateForOption(
|
||||||
|
optionName))));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void verifyWarnings() throws Throwable {
|
||||||
|
String shouldPassMessage = String.format("JVM startup should pass with"
|
||||||
|
+ "option '-XX:-%s' without any warnings", optionName);
|
||||||
|
//Verify that option could be disabled without any warnings.
|
||||||
|
CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
|
||||||
|
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||||
|
}, shouldPassMessage, shouldPassMessage, ExitCode.OK,
|
||||||
|
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
|
||||||
|
|
||||||
|
shouldPassMessage = String.format("JVM should start with '-XX:+"
|
||||||
|
+ "%s' flag, but output should contain warning.", optionName);
|
||||||
|
// Verify that when the tested option is explicitly enabled, then
|
||||||
|
// a warning will occur in VM output.
|
||||||
|
CommandLineOptionTest.verifySameJVMStartup(new String[] {
|
||||||
|
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||||
|
}, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
|
||||||
|
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void verifyOptionValues() throws Throwable {
|
||||||
|
// Verify that option is disabled by default.
|
||||||
|
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
|
||||||
|
String.format("Option '%s' should be disabled by default",
|
||||||
|
optionName));
|
||||||
|
|
||||||
|
// Verify that option is disabled even if it was explicitly enabled
|
||||||
|
// using CLI options.
|
||||||
|
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
|
||||||
|
String.format("Option '%s' should be off on unsupported "
|
||||||
|
+ "AArch64CPU even if set to true directly", optionName),
|
||||||
|
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||||
|
|
||||||
|
// Verify that option is disabled when +UseSHA was passed to JVM.
|
||||||
|
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
|
||||||
|
String.format("Option '%s' should be off on unsupported "
|
||||||
|
+ "AArch64CPU even if %s flag set to JVM",
|
||||||
|
optionName, CommandLineOptionTest.prepareBooleanFlag(
|
||||||
|
SHAOptionsBase.USE_SHA_OPTION, true)),
|
||||||
|
CommandLineOptionTest.prepareBooleanFlag(
|
||||||
|
SHAOptionsBase.USE_SHA_OPTION, true));
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,24 +25,26 @@ import jdk.test.lib.ExitCode;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
import jdk.test.lib.cli.predicate.AndPredicate;
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.OrPredicate;
|
||||||
import jdk.test.lib.cli.predicate.NotPredicate;
|
import jdk.test.lib.cli.predicate.NotPredicate;
|
||||||
import sha.predicate.IntrinsicPredicates;
|
import sha.predicate.IntrinsicPredicates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case specific to UseSHA*Intrinsics options targeted to SPARC CPUs which
|
* Test case specific to UseSHA*Intrinsics options targeted to SPARC and AArch64
|
||||||
* don't support required instruction, but support other SHA-related
|
* CPUs which don't support required instruction, but support other SHA-related
|
||||||
* instructions.
|
* instructions.
|
||||||
*
|
*
|
||||||
* For example, CPU support sha1 instruction, but don't support sha256 or
|
* For example, CPU support sha1 instruction, but don't support sha256 or
|
||||||
* sha512.
|
* sha512.
|
||||||
*/
|
*/
|
||||||
public class UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
|
public class UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU
|
||||||
extends SHAOptionsBase.TestCase {
|
extends SHAOptionsBase.TestCase {
|
||||||
public UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
|
public UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||||
String optionName) {
|
String optionName) {
|
||||||
// execute test case on SPARC CPU that support any sha* instructions,
|
// execute test case on SPARC CPU that support any sha* instructions,
|
||||||
// but does not support sha* instruction required by the tested option.
|
// but does not support sha* instruction required by the tested option.
|
||||||
super(optionName, new AndPredicate(Platform::isSparc,
|
super(optionName, new AndPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
new AndPredicate(
|
new AndPredicate(
|
||||||
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE,
|
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE,
|
||||||
new NotPredicate(SHAOptionsBase.getPredicateForOption(
|
new NotPredicate(SHAOptionsBase.getPredicateForOption(
|
|
@ -26,16 +26,18 @@ import jdk.test.lib.ExitCode;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
import jdk.test.lib.cli.predicate.AndPredicate;
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.OrPredicate;
|
||||||
import sha.predicate.IntrinsicPredicates;
|
import sha.predicate.IntrinsicPredicates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UseSHA specific test case targeted to SPARC CPUs which support any sha*
|
* UseSHA specific test case targeted to SPARC and AArch64 CPUs which
|
||||||
* instruction.
|
* support any sha* instruction.
|
||||||
*/
|
*/
|
||||||
public class UseSHASpecificTestCaseForSupportedSparcCPU
|
public class UseSHASpecificTestCaseForSupportedCPU
|
||||||
extends SHAOptionsBase.TestCase {
|
extends SHAOptionsBase.TestCase {
|
||||||
public UseSHASpecificTestCaseForSupportedSparcCPU(String optionName) {
|
public UseSHASpecificTestCaseForSupportedCPU(String optionName) {
|
||||||
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc,
|
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE));
|
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE));
|
||||||
|
|
||||||
Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
|
Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
|
|
@ -26,17 +26,19 @@ import jdk.test.lib.ExitCode;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||||
import jdk.test.lib.cli.predicate.AndPredicate;
|
import jdk.test.lib.cli.predicate.AndPredicate;
|
||||||
|
import jdk.test.lib.cli.predicate.OrPredicate;
|
||||||
import jdk.test.lib.cli.predicate.NotPredicate;
|
import jdk.test.lib.cli.predicate.NotPredicate;
|
||||||
import sha.predicate.IntrinsicPredicates;
|
import sha.predicate.IntrinsicPredicates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UseSHA specific test case targeted to SPARC CPUs which don't support all sha*
|
* UseSHA specific test case targeted to SPARC and AArch64 CPUs which don't
|
||||||
* instructions.
|
* support all sha* instructions./
|
||||||
*/
|
*/
|
||||||
public class UseSHASpecificTestCaseForUnsupportedSparcCPU
|
public class UseSHASpecificTestCaseForUnsupportedCPU
|
||||||
extends SHAOptionsBase.TestCase {
|
extends SHAOptionsBase.TestCase {
|
||||||
public UseSHASpecificTestCaseForUnsupportedSparcCPU(String optionName) {
|
public UseSHASpecificTestCaseForUnsupportedCPU(String optionName) {
|
||||||
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc,
|
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(
|
||||||
|
new OrPredicate(Platform::isSparc, Platform::isAArch64),
|
||||||
new NotPredicate(
|
new NotPredicate(
|
||||||
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)));
|
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)));
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ public class UseSHASpecificTestCaseForUnsupportedSparcCPU
|
||||||
protected void verifyWarnings() throws Throwable {
|
protected void verifyWarnings() throws Throwable {
|
||||||
// Verify that attempt to use UseSHA option will cause a warning.
|
// Verify that attempt to use UseSHA option will cause a warning.
|
||||||
String shouldPassMessage = String.format("JVM startup should pass with"
|
String shouldPassMessage = String.format("JVM startup should pass with"
|
||||||
+ " '%s' option on unsupported SparcCPU, but there should be"
|
+ " '%s' option on unsupported CPU, but there should be"
|
||||||
+ "the message shown.", optionName);
|
+ "the message shown.", optionName);
|
||||||
CommandLineOptionTest.verifySameJVMStartup(new String[] {
|
CommandLineOptionTest.verifySameJVMStartup(new String[] {
|
||||||
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||||
|
@ -63,7 +65,7 @@ public class UseSHASpecificTestCaseForUnsupportedSparcCPU
|
||||||
// UseSHA*Intrinsics were enabled.
|
// UseSHA*Intrinsics were enabled.
|
||||||
CommandLineOptionTest.verifyOptionValueForSameVM(
|
CommandLineOptionTest.verifyOptionValueForSameVM(
|
||||||
SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
|
SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
|
||||||
"%s option should be disabled on unsupported SparcCPU"
|
"%s option should be disabled on unsupported CPU"
|
||||||
+ " even if all UseSHA*Intrinsics options were enabled.",
|
+ " even if all UseSHA*Intrinsics options were enabled.",
|
||||||
SHAOptionsBase.USE_SHA_OPTION),
|
SHAOptionsBase.USE_SHA_OPTION),
|
||||||
CommandLineOptionTest.prepareBooleanFlag(
|
CommandLineOptionTest.prepareBooleanFlag(
|
||||||
|
@ -77,7 +79,7 @@ public class UseSHASpecificTestCaseForUnsupportedSparcCPU
|
||||||
// UseSHA*Intrinsics options were enabled and UseSHA was enabled as well.
|
// UseSHA*Intrinsics options were enabled and UseSHA was enabled as well.
|
||||||
CommandLineOptionTest.verifyOptionValueForSameVM(
|
CommandLineOptionTest.verifyOptionValueForSameVM(
|
||||||
SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
|
SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
|
||||||
"%s option should be disabled on unsupported SparcCPU"
|
"%s option should be disabled on unsupported CPU"
|
||||||
+ " even if all UseSHA*Intrinsics options were enabled"
|
+ " even if all UseSHA*Intrinsics options were enabled"
|
||||||
+ " and %s was enabled as well",
|
+ " and %s was enabled as well",
|
||||||
SHAOptionsBase.USE_SHA_OPTION,
|
SHAOptionsBase.USE_SHA_OPTION,
|
|
@ -59,16 +59,19 @@ public class IntrinsicPredicates {
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE
|
public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE
|
||||||
= new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },
|
= new OrPredicate(
|
||||||
null);
|
new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },null),
|
||||||
|
new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" },null));
|
||||||
|
|
||||||
public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE
|
public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE
|
||||||
= new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },
|
= new OrPredicate(
|
||||||
null);
|
new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },null),
|
||||||
|
new CPUSpecificPredicate("aarch64.*", new String[] { "sha256" },null));
|
||||||
|
|
||||||
public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE
|
public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE
|
||||||
= new CPUSpecificPredicate("sparc.*", new String[] { "sha512" },
|
= new OrPredicate(
|
||||||
null);
|
new CPUSpecificPredicate("sparc.*", new String[] { "sha512" },null),
|
||||||
|
new CPUSpecificPredicate("aarch64.*", new String[] { "sha512" },null));
|
||||||
|
|
||||||
public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE
|
public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE
|
||||||
= new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE,
|
= new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue