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