Java Code Examples for jdk.test.lib.Platform#isX86()

The following examples show how to use jdk.test.lib.Platform#isX86() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAESIntrinsicsOnSupportedConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test checks following situation: <br/>
 * UseAES flag is set to true, UseSSE flag is set to 2,
 * Platform should support UseSSE (x86 or x64) <br/>
 * TestAESMain is executed <br/>
 * Expected result: UseAESIntrinsics flag is set to false <br/>
 * Output shouldn't contain intrinsics usage <br/>
 *
 * @throws Throwable
 */
private void testUseAESUseSSE2() throws Throwable {
    if (Platform.isX86() || Platform.isX64()) {
        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
                prepareArguments(prepareBooleanFlag(AESIntrinsicsBase
                                .USE_AES_INTRINSICS, true),
                        prepareNumericFlag(AESIntrinsicsBase.USE_SSE, 2)));
        final String errorMessage = "Case testUseAESUseSSE2 failed";
        verifyOutput(null, new String[]{AESIntrinsicsBase.CIPHER_INTRINSIC,
                        AESIntrinsicsBase.AES_INTRINSIC},
                errorMessage, outputAnalyzer);
        verifyOptionValue(AESIntrinsicsBase.USE_AES, "true", errorMessage,
                outputAnalyzer);
        verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "false",
                errorMessage, outputAnalyzer);
        verifyOptionValue(AESIntrinsicsBase.USE_SSE, "2", errorMessage,
                outputAnalyzer);
    }
}
 
Example 2
Source File: TestAESIntrinsicsOnSupportedConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test checks following situation: <br/>
 * UseAES flag is set to false, UseSSE flag is set to 2,
 * Platform should support UseSSE (x86 or x64) <br/>
 * TestAESMain is executed <br/>
 * Expected result: UseAESIntrinsics flag is set to false <br/>
 * Output shouldn't contain intrinsics usage <br/>
 *
 * @throws Throwable
 */
private void testNoUseAESUseSSE2() throws Throwable {
    if (Platform.isX86() || Platform.isX64()) {
        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
                prepareArguments(prepareBooleanFlag(AESIntrinsicsBase
                                .USE_AES, false),
                        prepareNumericFlag(AESIntrinsicsBase.USE_SSE, 2)));
        final String errorMessage = "Case testNoUseAESUseSSE2 failed";
        verifyOutput(null, new String[]{AESIntrinsicsBase.CIPHER_INTRINSIC,
                        AESIntrinsicsBase.AES_INTRINSIC},
                errorMessage, outputAnalyzer);
        verifyOptionValue(AESIntrinsicsBase.USE_AES, "false", errorMessage,
                outputAnalyzer);
        verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "false",
                errorMessage, outputAnalyzer);
        verifyOptionValue(AESIntrinsicsBase.USE_SSE, "2", errorMessage,
                outputAnalyzer);
    }
}
 
Example 3
Source File: SHAOptionsBase.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns warning message that should occur in VM output if an option with
 * the name {@code optionName} was turned on and CPU does not support
 * required instructions.
 *
 * @param optionName The name of the option for which warning message should
 *                   be returned.
 * @return A warning message that will be printed out to VM output if CPU
 *         instructions required by the option are not supported.
 */
public static String getWarningForUnsupportedCPU(String optionName) {
    if (Platform.isAArch64() || Platform.isS390x() || Platform.isSparc() ||
        Platform.isX64() || Platform.isX86()) {
        switch (optionName) {
        case SHAOptionsBase.USE_SHA_OPTION:
            return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
        case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
            return SHAOptionsBase.SHA1_INTRINSICS_ARE_NOT_AVAILABLE;
        case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
            return SHAOptionsBase.SHA256_INTRINSICS_ARE_NOT_AVAILABLE;
        case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
            return SHAOptionsBase.SHA512_INTRINSICS_ARE_NOT_AVAILABLE;
        default:
            throw new Error("Unexpected option " + optionName);
        }
    } else {
        throw new Error("Support for CPUs different fromn AARCH64, S390x, SPARC, and X86 "
                        + "is not implemented");
    }
}
 
Example 4
Source File: ReservedStackTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
@jdk.internal.vm.annotation.ReservedStackAccess
public void run() {
    counter = 0;
    decounter = deframe;
    test.initialize();
    recursiveCall();
    System.out.println("Framework got StackOverflowError at frame = " + counter);
    System.out.println("Test started execution at frame = " + (counter - deframe));
    String result = test.getResult();
    // The feature is not fully implemented on all platforms,
    // corruptions are still possible.
    boolean supportedPlatform =
        Platform.isAix() ||
        (Platform.isLinux() &&
          (Platform.isPPC() || Platform.isS390x() || Platform.isX64() ||
           Platform.isX86() || Platform.isAArch64())) ||
        Platform.isOSX() ||
        Platform.isSolaris();
    if (supportedPlatform && !result.contains("PASSED")) {
        System.out.println(result);
        throw new Error(result);
    } else {
        // Either the test passed or this platform is not supported.
        // On not supported platforms, we only expect the VM to
        // not crash during the test. This is especially important
        // on Windows where the detection of SOE in annotated
        // sections is implemented but the reserved zone mechanism
        // to avoid the corruption cannot be implemented yet
        // because of JDK-8067946
        System.out.println("PASSED");
    }
}
 
Example 5
Source File: RTMGenericCommandLineOptionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void runTestCases() throws Throwable {
    if (Platform.isX86() || Platform.isX64() || Platform.isPPC()) {
        if (Platform.isServer()) {
            runX86SupportedVMTestCases();
        } else {
            runX86UnsupportedVMTestCases();
        }
    } else {
        runNonX86TestCases();
    }
}
 
Example 6
Source File: BmiIntrinsicBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void test() throws Exception {
    BmiTestCase bmiTestCase = (BmiTestCase) testCase;

    if (!(Platform.isX86() || Platform.isX64())) {
        System.out.println("Unsupported platform, test SKIPPED");
        return;
    }

    if (!Platform.isServer()) {
        throw new Error("TESTBUG: Not server VM");
    }

    if (Platform.isInt()) {
        throw new Error("TESTBUG: test can not be run in interpreter");
    }

    if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) {
        System.out.println("Unsupported hardware, no required CPU flag " + bmiTestCase.getCpuFlag() + " , test SKIPPED");
        return;
    }

    if (!Boolean.valueOf(getVMOption(bmiTestCase.getVMFlag()))) {
        System.out.println("VM flag " + bmiTestCase.getVMFlag() + " disabled, test SKIPPED");
        return;
    }

    System.out.println(testCase.name());

    if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX || Platform.isEmulatedClient()) {
        System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
        return;
    }
    deoptimize();
    compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
}
 
Example 7
Source File: BmiIntrinsicBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public boolean verifyPositive(byte[] nativeCode) {
    final int cnt = countCpuInstructions(nativeCode);
    if (Platform.isX86()) {
        return cnt >= (isLongOperation ? 2 : 1);
    } else {
        return Platform.isX64() && cnt >= 1;
    }
}
 
Example 8
Source File: BMIUnsupportedCPUTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void runTestCases() throws Throwable {
    if (Platform.isX86() || Platform.isX64()) {
        unsupportedX86CPUTestCases();
    } else {
        unsupportedNonX86CPUTestCases();
    }
}