author | tpivovarova |
Tue, 12 Jul 2016 18:24:48 +0300 | |
changeset 40059 | c2304140ed64 |
parent 39438 | 206a712f8f16 |
child 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
31230 | 1 |
/* |
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
40059 | 24 |
package compiler.intrinsics.sha.cli.testcases; |
25 |
||
26 |
import compiler.intrinsics.sha.cli.SHAOptionsBase; |
|
27 |
import compiler.testlibrary.sha.predicate.IntrinsicPredicates; |
|
31230 | 28 |
import jdk.test.lib.Asserts; |
29 |
import jdk.test.lib.ExitCode; |
|
30 |
import jdk.test.lib.Platform; |
|
31 |
import jdk.test.lib.cli.CommandLineOptionTest; |
|
32 |
import jdk.test.lib.cli.predicate.AndPredicate; |
|
40059 | 33 |
import jdk.test.lib.cli.predicate.NotPredicate; |
31230 | 34 |
import jdk.test.lib.cli.predicate.OrPredicate; |
35 |
||
36 |
/** |
|
37 |
* UseSHA specific test case targeted to SPARC and AArch64 CPUs which don't |
|
38 |
* support all sha* instructions./ |
|
39 |
*/ |
|
40 |
public class UseSHASpecificTestCaseForUnsupportedCPU |
|
41 |
extends SHAOptionsBase.TestCase { |
|
42 |
public UseSHASpecificTestCaseForUnsupportedCPU(String optionName) { |
|
43 |
super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate( |
|
44 |
new OrPredicate(Platform::isSparc, Platform::isAArch64), |
|
45 |
new NotPredicate( |
|
46 |
IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE))); |
|
47 |
||
48 |
Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION, |
|
49 |
"Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION |
|
50 |
+ " option only."); |
|
51 |
} |
|
52 |
||
53 |
@Override |
|
54 |
protected void verifyWarnings() throws Throwable { |
|
55 |
// Verify that attempt to use UseSHA option will cause a warning. |
|
56 |
String shouldPassMessage = String.format("JVM startup should pass with" |
|
57 |
+ " '%s' option on unsupported CPU, but there should be" |
|
58 |
+ "the message shown.", optionName); |
|
59 |
CommandLineOptionTest.verifySameJVMStartup(new String[] { |
|
60 |
SHAOptionsBase.getWarningForUnsupportedCPU(optionName) |
|
61 |
}, null, shouldPassMessage, shouldPassMessage, ExitCode.OK, |
|
62 |
CommandLineOptionTest.prepareBooleanFlag(optionName, true)); |
|
63 |
} |
|
64 |
||
65 |
@Override |
|
66 |
protected void verifyOptionValues() throws Throwable { |
|
67 |
// Verify that UseSHA option remains disabled even if all |
|
68 |
// UseSHA*Intrinsics were enabled. |
|
69 |
CommandLineOptionTest.verifyOptionValueForSameVM( |
|
70 |
SHAOptionsBase.USE_SHA_OPTION, "false", String.format( |
|
71 |
"%s option should be disabled on unsupported CPU" |
|
72 |
+ " even if all UseSHA*Intrinsics options were enabled.", |
|
73 |
SHAOptionsBase.USE_SHA_OPTION), |
|
38285
20b85a0ba796
8153655: Make intrinsics flags diagnostic and update intrinsics tests to enable diagnostic options
rraghavan
parents:
31230
diff
changeset
|
74 |
SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, |
31230 | 75 |
CommandLineOptionTest.prepareBooleanFlag( |
76 |
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true), |
|
77 |
CommandLineOptionTest.prepareBooleanFlag( |
|
78 |
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true), |
|
79 |
CommandLineOptionTest.prepareBooleanFlag( |
|
80 |
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true)); |
|
81 |
||
82 |
// Verify that UseSHA option remains disabled even if all |
|
83 |
// UseSHA*Intrinsics options were enabled and UseSHA was enabled as well. |
|
84 |
CommandLineOptionTest.verifyOptionValueForSameVM( |
|
85 |
SHAOptionsBase.USE_SHA_OPTION, "false", String.format( |
|
86 |
"%s option should be disabled on unsupported CPU" |
|
87 |
+ " even if all UseSHA*Intrinsics options were enabled" |
|
88 |
+ " and %s was enabled as well", |
|
89 |
SHAOptionsBase.USE_SHA_OPTION, |
|
90 |
SHAOptionsBase.USE_SHA_OPTION), |
|
38285
20b85a0ba796
8153655: Make intrinsics flags diagnostic and update intrinsics tests to enable diagnostic options
rraghavan
parents:
31230
diff
changeset
|
91 |
SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, |
31230 | 92 |
CommandLineOptionTest.prepareBooleanFlag( |
93 |
SHAOptionsBase.USE_SHA_OPTION, true), |
|
94 |
CommandLineOptionTest.prepareBooleanFlag( |
|
95 |
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true), |
|
96 |
CommandLineOptionTest.prepareBooleanFlag( |
|
97 |
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true), |
|
98 |
CommandLineOptionTest.prepareBooleanFlag( |
|
99 |
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true)); |
|
100 |
} |
|
101 |
} |