hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java
author goetz
Mon, 31 Oct 2016 11:36:45 +0100
changeset 42543 9e7ac7aff2d1
parent 40059 c2304140ed64
permissions -rw-r--r--
8166837: [TESTBUG] Fix tests on Linux/s390x Reviewed-by: kvn, simonis
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
     1
/*
42543
9e7ac7aff2d1 8166837: [TESTBUG] Fix tests on Linux/s390x
goetz
parents: 40059
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
26439
0fa6c2cb6007 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.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
     4
 *
0fa6c2cb6007 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
0fa6c2cb6007 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
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
     8
 *
0fa6c2cb6007 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
0fa6c2cb6007 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
0fa6c2cb6007 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
0fa6c2cb6007 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
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    13
 * accompanied this code).
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    14
 *
0fa6c2cb6007 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
0fa6c2cb6007 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,
0fa6c2cb6007 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.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    18
 *
0fa6c2cb6007 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
0fa6c2cb6007 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
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    21
 * questions.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    22
 */
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    23
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    24
package compiler.intrinsics.sha.cli;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    25
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    26
import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 26439
diff changeset
    27
import jdk.test.lib.Platform;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 26439
diff changeset
    28
import jdk.test.lib.cli.CommandLineOptionTest;
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    29
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    30
import java.util.function.BooleanSupplier;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    31
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    32
/**
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    33
 * Base class for all CLI tests on SHA-related options.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    34
 *
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    35
 * Instead of using huge complex tests for each option, each test is constructed
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    36
 * from several test cases shared among different tests.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    37
 */
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    38
public class SHAOptionsBase extends CommandLineOptionTest {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    39
    public static final String USE_SHA_OPTION = "UseSHA";
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    40
    public static final String USE_SHA1_INTRINSICS_OPTION
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    41
            = "UseSHA1Intrinsics";
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    42
    public static final String USE_SHA256_INTRINSICS_OPTION
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    43
            = "UseSHA256Intrinsics";
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    44
    public static final String USE_SHA512_INTRINSICS_OPTION
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    45
            = "UseSHA512Intrinsics";
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    46
38285
20b85a0ba796 8153655: Make intrinsics flags diagnostic and update intrinsics tests to enable diagnostic options
rraghavan
parents: 31588
diff changeset
    47
    // Intrinsics flags are of diagnostic type
20b85a0ba796 8153655: Make intrinsics flags diagnostic and update intrinsics tests to enable diagnostic options
rraghavan
parents: 31588
diff changeset
    48
    // and must be preceded by UnlockDiagnosticVMOptions.
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    49
    public static final String UNLOCK_DIAGNOSTIC_VM_OPTIONS
38285
20b85a0ba796 8153655: Make intrinsics flags diagnostic and update intrinsics tests to enable diagnostic options
rraghavan
parents: 31588
diff changeset
    50
            = "-XX:+UnlockDiagnosticVMOptions";
20b85a0ba796 8153655: Make intrinsics flags diagnostic and update intrinsics tests to enable diagnostic options
rraghavan
parents: 31588
diff changeset
    51
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    52
    // Note that strings below will be passed to
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    53
    // CommandLineOptionTest.verifySameJVMStartup and thus are regular
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    54
    // expressions, not just a plain strings.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    55
    protected static final String SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    56
            = "SHA instructions are not available on this CPU";
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    57
    protected static final String SHA1_INTRINSICS_ARE_NOT_AVAILABLE
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    58
            = "Intrinsics for SHA-1 crypto hash functions not available on this CPU.";
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    59
    protected static final String SHA256_INTRINSICS_ARE_NOT_AVAILABLE
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    60
            = "Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.";
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    61
    protected static final String SHA512_INTRINSICS_ARE_NOT_AVAILABLE
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    62
            = "Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.";
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    63
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    64
    private final TestCase[] testCases;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    65
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    66
    /**
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    67
     * Returns warning message that should occur in VM output if an option with
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    68
     * the name {@code optionName} was turned on and CPU does not support
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    69
     * required instructions.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    70
     *
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    71
     * @param optionName The name of the option for which warning message should
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    72
     *                   be returned.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    73
     * @return A warning message that will be printed out to VM output if CPU
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    74
     *         instructions required by the option are not supported.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    75
     */
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    76
    public static String getWarningForUnsupportedCPU(String optionName) {
42543
9e7ac7aff2d1 8166837: [TESTBUG] Fix tests on Linux/s390x
goetz
parents: 40059
diff changeset
    77
        if (Platform.isAArch64() || Platform.isS390x() || Platform.isSparc() ||
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    78
            Platform.isX64() || Platform.isX86()) {
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    79
            switch (optionName) {
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    80
            case SHAOptionsBase.USE_SHA_OPTION:
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    81
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    82
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    83
                return SHAOptionsBase.SHA1_INTRINSICS_ARE_NOT_AVAILABLE;
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    84
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    85
                return SHAOptionsBase.SHA256_INTRINSICS_ARE_NOT_AVAILABLE;
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    86
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    87
                return SHAOptionsBase.SHA512_INTRINSICS_ARE_NOT_AVAILABLE;
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    88
            default:
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    89
                throw new Error("Unexpected option " + optionName);
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    90
            }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    91
        } else {
42543
9e7ac7aff2d1 8166837: [TESTBUG] Fix tests on Linux/s390x
goetz
parents: 40059
diff changeset
    92
            throw new Error("Support for CPUs different fromn AARCH64, S390x, SPARC, and X86 "
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31230
diff changeset
    93
                            + "is not implemented");
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    94
        }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    95
    }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    96
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    97
    /**
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    98
     * Returns the predicate indicating whether or not CPU instructions required
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
    99
     * by the option with name {@code optionName} are available.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   100
     *
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   101
     * @param optionName The name of the option for which a predicate should be
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   102
     *                   returned.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   103
     * @return The predicate on availability of CPU instructions required by the
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   104
     *         option.
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   105
     */
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
   106
    public static BooleanSupplier getPredicateForOption(String optionName) {
26439
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   107
        switch (optionName) {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   108
            case SHAOptionsBase.USE_SHA_OPTION:
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   109
                return IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   110
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   111
                return IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   112
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   113
                return IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   114
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   115
                return IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   116
            default:
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   117
                throw new Error("Unexpected option " + optionName);
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   118
        }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   119
    }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   120
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   121
    public SHAOptionsBase(TestCase... testCases) {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   122
        super(Boolean.TRUE::booleanValue);
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   123
        this.testCases = testCases;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   124
    }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   125
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   126
    @Override
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   127
    protected void runTestCases() throws Throwable {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   128
        for (TestCase testCase : testCases) {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   129
            testCase.test();
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   130
        }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   131
    }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   132
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   133
    public static abstract class TestCase {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   134
        protected final String optionName;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   135
        private final BooleanSupplier predicate;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   136
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   137
        protected TestCase(String optionName, BooleanSupplier predicate) {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   138
            this.optionName = optionName;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   139
            this.predicate = predicate;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   140
        }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   141
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   142
        protected final void test() throws Throwable {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   143
            String testCaseName = this.getClass().getName();
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   144
            if (!predicate.getAsBoolean()) {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   145
                System.out.println("Skipping " + testCaseName
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   146
                        + " due to predicate failure.");
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   147
                return;
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   148
            } else {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   149
                System.out.println("Running " + testCaseName);
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   150
            }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   151
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   152
            verifyWarnings();
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   153
            verifyOptionValues();
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   154
        }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   155
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   156
        protected void verifyWarnings() throws Throwable {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   157
        }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   158
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   159
        protected void verifyOptionValues() throws Throwable {
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   160
        }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   161
    }
0fa6c2cb6007 8055904: Develop tests for new command-line options related to SHA intrinsics
fzhinkin
parents:
diff changeset
   162
}