< prev index next >
test/hotspot/jtreg/gtest/GTestWrapper.java
Print this page
rev 49499 : Set LD_LIBRARY_PATH or LIBPATH to find the right libjvm.
@@ -28,10 +28,11 @@
* @run main/native GTestWrapper
*/
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.stream.Stream;
import java.util.stream.Collectors;
import java.nio.file.Paths;
import java.nio.file.Path;
@@ -57,16 +58,31 @@
.resolve(jvmVariantDir);
}
if (!path.toFile().exists()) {
throw new Error("TESTBUG: the library has not been found in " + nativePath);
}
- path = path.resolve("gtestLauncher" + (Platform.isWindows() ? ".exe" : ""));
- ProcessTools.executeCommand(new String[] {
- path.toString(),
+
+ Path execPath = path.resolve("gtestLauncher" + (Platform.isWindows() ? ".exe" : ""));
+ ProcessBuilder pb = new ProcessBuilder();
+ Map<String, String> env = pb.environment();
+
+ String ldLibraryPath = System.getenv("LD_LIBRARY_PATH");
+ if (ldLibraryPath != null) {
+ env.put("LD_LIBRARY_PATH", path + ":" + ldLibraryPath);
+ }
+
+ String libPath = System.getenv("LIBPATH");
+ if (libPath != null) {
+ env.put("LIBPATH", path + ":" + libPath);
+ }
+
+ pb.command(new String[] {
+ execPath.toString(),
"-jdk",
System.getProperty("test.jdk")
- }).shouldHaveExitValue(0);
+ });
+ ProcessTools.executeCommand( pb ).shouldHaveExitValue(0);
}
private static String getJVMVariantSubDir() {
if (Platform.isServer()) {
return "server";
< prev index next >