8272345: macos doesn't check os::set_boot_path() result

Reviewed-by: dholmes
This commit is contained in:
Igor Ignatyev 2021-08-12 03:45:44 +00:00
parent 44f137ff9c
commit bd27bb9cbe
2 changed files with 8 additions and 7 deletions

View File

@ -452,7 +452,9 @@ void os::init_system_properties_values() {
}
}
Arguments::set_java_home(buf);
set_boot_path('/', ':');
if (!set_boot_path('/', ':')) {
vm_exit_during_initialization("Failed setting boot class path.", NULL);
}
}
// Where to look for native libraries.

View File

@ -25,17 +25,15 @@
/*
* @test
* @summary Test that CDS still works when the JDK is moved to a new directory
* @bug 8272345
* @requires vm.cds
* @requires os.family == "linux"
* @comment This test doesn't work on Windows because it depends on symlinks
* @requires os.family != "windows"
* @library /test/lib
* @compile test-classes/Hello.java
* @run driver MoveJDKTest
*/
// This test works only on Linux because it depends on symlinks and the name of the hotspot DLL (libjvm.so).
// It probably doesn't work on Windows.
// TODO: change libjvm.so to libjvm.dylib on MacOS, before adding "@requires os.family == mac"
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
@ -134,6 +132,7 @@ public class MoveJDKTest {
throw new RuntimeException("Cannot create directory: " + dst);
}
}
final String jvmLib = System.mapLibraryName("jvm");
for (String child : src.list()) {
if (child.equals(".") || child.equals("..")) {
continue;
@ -145,7 +144,7 @@ public class MoveJDKTest {
throw new RuntimeException("Already exists: " + child_dst);
}
if (child_src.isFile()) {
if (child.equals("libjvm.so") || child.equals("java")) {
if (child.equals(jvmLib) || child.equals("java")) {
Files.copy(child_src.toPath(), /* copy data to -> */ child_dst.toPath());
} else {
Files.createSymbolicLink(child_dst.toPath(), /* link to -> */ child_src.toPath());