< prev index next >

test/lib/jdk/test/lib/Platform.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 24,33 **** --- 24,35 ---- package jdk.test.lib; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; + import java.nio.file.Path; + import java.nio.file.Paths; import java.util.regex.Pattern; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction;
*** 43,52 **** --- 45,55 ---- private static final String vmVersion = privilegedGetProperty("java.vm.version"); private static final String jdkDebug = privilegedGetProperty("jdk.debug"); private static final String osArch = privilegedGetProperty("os.arch"); private static final String userName = privilegedGetProperty("user.name"); private static final String compiler = privilegedGetProperty("sun.management.compiler"); + private static final String testJdk = privilegedGetProperty("test.jdk"); private static String privilegedGetProperty(String key) { return AccessController.doPrivileged(( PrivilegedAction<String>) () -> System.getProperty(key)); }
*** 332,341 **** --- 335,373 ---- } else { return "LD_LIBRARY_PATH"; } } + /** + * Returns absolute path to directory containing JVM shared library. + */ + public static Path jvmLibDir() { + Path dir = Paths.get(testJdk); + if (Platform.isWindows()) { + return dir.resolve("bin") + .resolve(variant()) + .toAbsolutePath(); + } else { + return dir.resolve("lib") + .resolve(variant()) + .toAbsolutePath(); + } + } + + private static String variant() { + if (Platform.isServer()) { + return "server"; + } else if (Platform.isClient()) { + return "client"; + } else if (Platform.isMinimal()) { + return "minimal"; + } else { + throw new Error("TESTBUG: unsupported vm variant"); + } + } + + public static boolean isDefaultCDSArchiveSupported() { return (is64bit() && isServer() && (isLinux() || isOSX() ||
< prev index next >