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

The following examples show how to use jdk.test.lib.Platform#isSolaris() . 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: TestNativeLibrariesEvent.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static List<String> getExpectedLibs() throws Throwable {
    String libTemplate = null;
    if (Platform.isSolaris()) {
        libTemplate = "lib%s.so";
    } else if (Platform.isWindows()) {
        libTemplate = "%s.dll";
    } else if (Platform.isOSX()) {
        libTemplate = "lib%s.dylib";
    } else if (Platform.isLinux()) {
        libTemplate = "lib%s.so";
    }
    if (libTemplate == null) {
        throw new Exception("Unsupported OS");
    }

    List<String> libs = new ArrayList<String>();
    String[] names = { "jvm", "java", "zip" };
    for (String name : names) {
        libs.add(String.format(libTemplate, name));
    }
    return libs;
}
 
Example 2
Source File: TestNativeLibrariesEvent.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static List<String> getExpectedLibs() throws Throwable {
    String libTemplate = null;
    if (Platform.isSolaris()) {
        libTemplate = "lib%s.so";
    } else if (Platform.isWindows()) {
        libTemplate = "%s.dll";
    } else if (Platform.isOSX()) {
        libTemplate = "lib%s.dylib";
    } else if (Platform.isLinux()) {
        libTemplate = "lib%s.so";
    }
    if (libTemplate == null) {
        throw new Exception("Unsupported OS");
    }

    List<String> libs = new ArrayList<String>();
    String[] names = { "jvm", "java", "zip" };
    for (String name : names) {
        libs.add(String.format(libTemplate, name));
    }
    return libs;
}
 
Example 3
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 4
Source File: CompressedClassPointers.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (!Platform.is64bit()) {
        // Can't test this on 32 bit, just pass
        System.out.println("Skipping test on 32bit");
        return;
    }
    // Solaris 10 can't mmap compressed oops space without a base
    if (Platform.isSolaris()) {
         String name = System.getProperty("os.version");
         if (name.equals("5.10")) {
             System.out.println("Skipping test on Solaris 10");
             return;
         }
    }
    smallHeapTest();
    smallHeapTestWith3G();
    largeHeapTest();
    largePagesTest();
    heapBaseMinAddressTest();
    sharingTest();
}
 
Example 5
Source File: TestShutdownEvent.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean isApplicable() {
    if (Platform.isWindows()) {
        return false;
    }
    if (signalName.equals("HUP") && Platform.isSolaris()) {
        return false;
    }
    return true;
}
 
Example 6
Source File: TestShutdownEvent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean isApplicable() {
    if (Platform.isWindows()) {
        return false;
    }
    if (signalName.equals("HUP") && Platform.isSolaris()) {
        return false;
    }
    return true;
}
 
Example 7
Source File: TestLargePageSizeInBytes.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (!Platform.isSolaris()) {
        // We only use the syscall mencntl on Solaris
        return;
    }

    testLargePageSizeInBytes(4 * M);
    testLargePageSizeInBytes(256 * M);
    testLargePageSizeInBytes(512 * M);
    testLargePageSizeInBytes(2 * G);
}
 
Example 8
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 9
Source File: ProcessTools.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
 *
 * @return String[] with platform specific arguments, empty if there are
 *         none
 */
public static String[] getPlatformSpecificVMArgs() {

if (Platform.is64bit() && Platform.isSolaris()) {
        return new String[] { "-d64" };
    }

    return new String[] {};
}
 
Example 10
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);
    }
}