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

The following examples show how to use jdk.test.lib.Platform#isAix() . 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: DynLibsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void run(CommandExecutor executor) {
    OutputAnalyzer output = executor.execute("VM.dynlibs");

    String osDependentBaseString = null;
    if (Platform.isAix()) {
        osDependentBaseString = "lib%s.so";
    } else if (Platform.isLinux()) {
        osDependentBaseString = "lib%s.so";
    } else if (Platform.isOSX()) {
        osDependentBaseString = "lib%s.dylib";
    } else if (Platform.isSolaris()) {
        osDependentBaseString = "lib%s.so";
    } else if (Platform.isWindows()) {
        osDependentBaseString = "%s.dll";
    }

    if (osDependentBaseString == null) {
        Assert.fail("Unsupported OS");
    }

    output.shouldContain(String.format(osDependentBaseString, "jvm"));
    output.shouldContain(String.format(osDependentBaseString, "java"));
    output.shouldContain(String.format(osDependentBaseString, "management"));
}
 
Example 2
Source File: SupportedOS.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean getAsBoolean() {
    if (Platform.isAix()) {
        // Actually, this works since AIX 7.1.3.30, but os.version property
        // is set to 7.1.
        return (Platform.getOsVersionMajor()  > 7) ||
               (Platform.getOsVersionMajor() == 7 && Platform.getOsVersionMinor() > 1);

    } else if (Platform.isLinux()) {
        if (Platform.isPPC()) {
            return (Platform.getOsVersionMajor()  > 4) ||
                   (Platform.getOsVersionMajor() == 4 && Platform.getOsVersionMinor() > 1);
        }
    }
    return true;
}
 
Example 3
Source File: OsCpuLoggingTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void analyzeOutputForOsLog(OutputAnalyzer output) throws Exception {
    // Aix has it's own logging
    if (!Platform.isAix()) {
        output.shouldContain("SafePoint Polling address");
    }
    output.shouldHaveExitValue(0);
}
 
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: CheckForProperDetailStackTrace.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) throws Exception {
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
        "-XX:+UnlockDiagnosticVMOptions",
        "-XX:NativeMemoryTracking=detail",
        "-XX:+PrintNMTStatistics",
        "-version");
    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    output.shouldHaveExitValue(0);

    // We should never see either of these frames because they are supposed to be skipped. */
    output.shouldNotContain("NativeCallStack::NativeCallStack");
    output.shouldNotContain("os::get_native_stack");

    // AllocateHeap shouldn't be in the output because it is supposed to always be inlined.
    // We check for that here, but allow it for Aix, Solaris and Windows slowdebug builds
    // because the compiler ends up not inlining AllocateHeap.
    Boolean okToHaveAllocateHeap =
        Platform.isSlowDebugBuild() &&
        (Platform.isAix() || Platform.isSolaris() || Platform.isWindows());
    if (!okToHaveAllocateHeap) {
        output.shouldNotContain("AllocateHeap");
    }

    // See if we have any stack trace symbols in the output
    boolean hasSymbols =
        output.getStdout().contains(expectedSymbol) || output.getStderr().contains(expectedSymbol);
    if (!hasSymbols) {
        // It's ok for ARM not to have symbols, because it does not support NMT detail
        // when targeting thumb2. It's also ok for Windows not to have symbols, because
        // they are only available if the symbols file is included with the build.
        if (Platform.isWindows() || Platform.isARM()) {
            return; // we are done
        }
        output.reportDiagnosticSummary();
        throw new RuntimeException("Expected symbol missing missing from output: " + expectedSymbol);
    }

    /* Make sure the expected NMT detail stack trace is found. */
    String expectedStackTrace =
        (okToHaveAllocateHeap ? stackTraceAllocateHeap : stackTraceDefault);
    if (!stackTraceMatches(expectedStackTrace, output)) {
        output.reportDiagnosticSummary();
        throw new RuntimeException("Expected stack trace missing missing from output: " + expectedStackTrace);
    }
}