Skip to content
Permalink
Browse files
8242463: ProcessTools.createNativeTestProcessBuilder() in testlib nee…
…ds jdk/bin on PATH on Windows

Reviewed-by: iignatyev, mseledtsov, tbell
  • Loading branch information
erikj79 committed Apr 14, 2020
1 parent aadc7c7 commit 416f4ed7ae85a9e542fda5195c28906e2b311168
Showing 2 changed files with 16 additions and 9 deletions.
@@ -325,21 +325,24 @@ public static String sharedLibraryPathVariableName() {
}

/**
* Returns absolute path to directory containing JVM shared library.
* Returns absolute path to directory containing shared libraries in the tested JDK.
*/
public static Path jvmLibDir() {
public static Path libDir() {
Path dir = Paths.get(testJdk);
if (Platform.isWindows()) {
return dir.resolve("bin")
.resolve(variant())
.toAbsolutePath();
return dir.resolve("bin").toAbsolutePath();
} else {
return dir.resolve("lib")
.resolve(variant())
.toAbsolutePath();
return dir.resolve("lib").toAbsolutePath();
}
}

/**
* Returns absolute path to directory containing JVM shared library.
*/
public static Path jvmLibDir() {
return libDir().resolve(variant());
}

private static String variant() {
if (Platform.isServer()) {
return "server";
@@ -540,8 +540,12 @@ public static ProcessBuilder addJvmLib(ProcessBuilder pb) throws Exception {
String currentLibPath = pb.environment().get(libPathVar);

String newLibPath = jvmLibDir;
if (Platform.isWindows()) {
String libDir = Platform.libDir().toString();
newLibPath = newLibPath + File.pathSeparator + libDir;
}
if ( (currentLibPath != null) && !currentLibPath.isEmpty() ) {
newLibPath = currentLibPath + File.pathSeparator + jvmLibDir;
newLibPath = newLibPath + File.pathSeparator + currentLibPath;
}

pb.environment().put(libPathVar, newLibPath);

0 comments on commit 416f4ed

Please sign in to comment.