annotate test/compiler/intrinsics/sha/cli/SHAOptionsBase.java @ 20427:fe6dafcd8ed0

8055904: Develop tests for new command-line options related to SHA intrinsics Reviewed-by: kvn, iignatyev
author fzhinkin
date Wed, 03 Sep 2014 15:29:57 +0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20427
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
1 /*
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
4 *
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
7 * published by the Free Software Foundation.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
8 *
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
13 * accompanied this code).
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
14 *
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
18 *
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
21 * questions.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
22 */
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
23
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
24 import com.oracle.java.testlibrary.Platform;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
25 import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
26 import sha.predicate.IntrinsicPredicates;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
27
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
28 import java.util.function.BooleanSupplier;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
29
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
30 /**
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
31 * Base class for all CLI tests on SHA-related options.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
32 *
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
33 * Instead of using huge complex tests for each option, each test is constructed
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
34 * from several test cases shared among different tests.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
35 */
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
36 public class SHAOptionsBase extends CommandLineOptionTest {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
37 protected static final String USE_SHA_OPTION = "UseSHA";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
38 protected static final String USE_SHA1_INTRINSICS_OPTION
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
39 = "UseSHA1Intrinsics";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
40 protected static final String USE_SHA256_INTRINSICS_OPTION
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
41 = "UseSHA256Intrinsics";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
42 protected static final String USE_SHA512_INTRINSICS_OPTION
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
43 = "UseSHA512Intrinsics";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
44
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
45 // Note that strings below will be passed to
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
46 // CommandLineOptionTest.verifySameJVMStartup and thus are regular
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
47 // expressions, not just a plain strings.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
48 protected static final String SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
49 = "SHA instructions are not available on this CPU";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
50 protected static final String SHA1_INSTRUCTION_IS_NOT_AVAILABLE
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
51 = "SHA1 instruction is not available on this CPU\\.";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
52 protected static final String SHA256_INSTRUCTION_IS_NOT_AVAILABLE
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
53 = "SHA256 instruction \\(for SHA-224 and SHA-256\\) "
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
54 + "is not available on this CPU\\.";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
55 protected static final String SHA512_INSTRUCTION_IS_NOT_AVAILABLE
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
56 = "SHA512 instruction \\(for SHA-384 and SHA-512\\) "
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
57 + "is not available on this CPU\\.";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
58 protected static final String SHA_INTRINSICS_ARE_NOT_AVAILABLE
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
59 = "SHA intrinsics are not available on this CPU";
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
60
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
61 private final TestCase[] testCases;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
62
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
63 /**
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
64 * Returns warning message that should occur in VM output if an option with
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
65 * the name {@code optionName} was turned on and CPU does not support
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
66 * required instructions.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
67 *
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
68 * @param optionName The name of the option for which warning message should
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
69 * be returned.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
70 * @return A warning message that will be printed out to VM output if CPU
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
71 * instructions required by the option are not supported.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
72 */
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
73 protected static String getWarningForUnsupportedCPU(String optionName) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
74 if (Platform.isSparc()) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
75 switch (optionName) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
76 case SHAOptionsBase.USE_SHA_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
77 return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
78 case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
79 return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
80 case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
81 return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
82 case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
83 return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
84 default:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
85 throw new Error("Unexpected option " + optionName);
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
86 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
87 } else if (Platform.isX64() || Platform.isX86()) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
88 switch (optionName) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
89 case SHAOptionsBase.USE_SHA_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
90 return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
91 case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
92 case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
93 case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
94 return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
95 default:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
96 throw new Error("Unexpected option " + optionName);
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
97 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
98 } else {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
99 throw new Error("Support for CPUs other then X86 or SPARC is not "
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
100 + "implemented.");
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
101 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
102 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
103
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
104 /**
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
105 * Returns the predicate indicating whether or not CPU instructions required
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
106 * by the option with name {@code optionName} are available.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
107 *
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
108 * @param optionName The name of the option for which a predicate should be
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
109 * returned.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
110 * @return The predicate on availability of CPU instructions required by the
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
111 * option.
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
112 */
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
113 protected static BooleanSupplier getPredicateForOption(String optionName) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
114 switch (optionName) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
115 case SHAOptionsBase.USE_SHA_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
116 return IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
117 case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
118 return IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
119 case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
120 return IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
121 case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
122 return IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
123 default:
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
124 throw new Error("Unexpected option " + optionName);
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
125 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
126 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
127
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
128 public SHAOptionsBase(TestCase... testCases) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
129 super(Boolean.TRUE::booleanValue);
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
130 this.testCases = testCases;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
131 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
132
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
133 @Override
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
134 protected void runTestCases() throws Throwable {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
135 for (TestCase testCase : testCases) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
136 testCase.test();
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
137 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
138 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
139
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
140 public static abstract class TestCase {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
141 protected final String optionName;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
142 private final BooleanSupplier predicate;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
143
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
144 protected TestCase(String optionName, BooleanSupplier predicate) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
145 this.optionName = optionName;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
146 this.predicate = predicate;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
147 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
148
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
149 protected final void test() throws Throwable {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
150 String testCaseName = this.getClass().getName();
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
151 if (!predicate.getAsBoolean()) {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
152 System.out.println("Skipping " + testCaseName
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
153 + " due to predicate failure.");
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
154 return;
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
155 } else {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
156 System.out.println("Running " + testCaseName);
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
157 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
158
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
159 verifyWarnings();
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
160 verifyOptionValues();
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
161 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
162
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
163 protected void verifyWarnings() throws Throwable {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
164 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
165
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
166 protected void verifyOptionValues() throws Throwable {
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
167 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
168 }
fe6dafcd8ed0 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
169 }