hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.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;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 39438
diff changeset
    33
import jdk.test.lib.cli.predicate.NotPredicate;
31230
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    34
import jdk.test.lib.cli.predicate.OrPredicate;
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    35
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    36
/**
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    37
 * UseSHA specific test case targeted to SPARC and AArch64 CPUs which don't
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    38
 * support all sha* instructions./
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    39
 */
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    40
public class UseSHASpecificTestCaseForUnsupportedCPU
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    41
        extends SHAOptionsBase.TestCase {
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    42
    public UseSHASpecificTestCaseForUnsupportedCPU(String optionName) {
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    43
        super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    44
                new OrPredicate(Platform::isSparc, Platform::isAArch64),
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    45
                new NotPredicate(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    46
                        IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)));
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    47
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    48
        Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    49
                "Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    50
                        + " option only.");
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    51
    }
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    52
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    53
    @Override
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    54
    protected void verifyWarnings() throws Throwable {
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    55
        // Verify that attempt to use UseSHA option will cause a warning.
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    56
        String shouldPassMessage = String.format("JVM startup should pass with"
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    57
                + " '%s' option on unsupported CPU, but there should be"
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    58
                + "the message shown.", optionName);
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    59
        CommandLineOptionTest.verifySameJVMStartup(new String[] {
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    60
                        SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    61
                }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    62
                CommandLineOptionTest.prepareBooleanFlag(optionName, true));
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    63
    }
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    64
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    65
    @Override
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    66
    protected void verifyOptionValues() throws Throwable {
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    67
        // Verify that UseSHA option remains disabled even if all
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    68
        // UseSHA*Intrinsics were enabled.
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    69
        CommandLineOptionTest.verifyOptionValueForSameVM(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    70
                SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    71
                    "%s option should be disabled on unsupported CPU"
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    72
                        + " even if all UseSHA*Intrinsics options were enabled.",
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    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
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    75
                CommandLineOptionTest.prepareBooleanFlag(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    76
                        SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true),
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    77
                CommandLineOptionTest.prepareBooleanFlag(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    78
                        SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    79
                CommandLineOptionTest.prepareBooleanFlag(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    80
                        SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    81
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    82
        // Verify that UseSHA option remains disabled even if all
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    83
        // UseSHA*Intrinsics options were enabled and UseSHA was enabled as well.
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    84
        CommandLineOptionTest.verifyOptionValueForSameVM(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    85
                SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    86
                    "%s option should be disabled on unsupported CPU"
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    87
                        + " even if all UseSHA*Intrinsics options were enabled"
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    88
                        + " and %s was enabled as well",
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    89
                    SHAOptionsBase.USE_SHA_OPTION,
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    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
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    92
                CommandLineOptionTest.prepareBooleanFlag(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    93
                        SHAOptionsBase.USE_SHA_OPTION, true),
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    94
                CommandLineOptionTest.prepareBooleanFlag(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    95
                        SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true),
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    96
                CommandLineOptionTest.prepareBooleanFlag(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    97
                        SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    98
                CommandLineOptionTest.prepareBooleanFlag(
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
    99
                        SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
   100
    }
413576d00672 8081790: aarch64: SHA tests fail
enevill
parents:
diff changeset
   101
}