8357632: CDS test failures on static JDK

Reviewed-by: ccheung, dholmes
This commit is contained in:
Jiangli Zhou 2025-06-09 16:08:18 +00:00
parent eb8ee8bdc7
commit cae1fd3385
3 changed files with 18 additions and 14 deletions

View File

@ -110,12 +110,24 @@ const char* CDSConfig::default_archive_path() {
// before CDSConfig::ergo_initialize() is called.
assert(_cds_ergo_initialize_started, "sanity");
if (_default_archive_path == nullptr) {
stringStream tmp;
if (is_vm_statically_linked()) {
// It's easier to form the path using JAVA_HOME as os::jvm_path
// gives the path to the launcher executable on static JDK.
const char* subdir = WINDOWS_ONLY("bin") NOT_WINDOWS("lib");
tmp.print("%s%s%s%s%s%sclasses",
Arguments::get_java_home(), os::file_separator(),
subdir, os::file_separator(),
Abstract_VM_Version::vm_variant(), os::file_separator());
} else {
// Assume .jsa is in the same directory where libjvm resides on
// non-static JDK.
char jvm_path[JVM_MAXPATHLEN];
os::jvm_path(jvm_path, sizeof(jvm_path));
char *end = strrchr(jvm_path, *os::file_separator());
if (end != nullptr) *end = '\0';
stringStream tmp;
tmp.print("%s%sclasses", jvm_path, os::file_separator());
}
#ifdef _LP64
if (!UseCompressedOops) {
tmp.print_raw("_nocoops");

View File

@ -42,12 +42,3 @@ gtest/MetaspaceGtests.java#no-ccs 8356201 generic-all
gtest/NMTGtests.java#nmt-detail 8356201 generic-all
gtest/NMTGtests.java#nmt-off 8356201 generic-all
gtest/NMTGtests.java#nmt-summary 8356201 generic-all
# Need CDS archive
runtime/cds/NonJVMVariantLocation.java 8357632 generic-all
runtime/cds/TestCDSVMCrash.java 8357632 generic-all
runtime/cds/TestDefaultArchiveLoading.java#coops_coh 8357632 generic-all
runtime/cds/TestDefaultArchiveLoading.java#coops_nocoh 8357632 generic-all
runtime/cds/TestDefaultArchiveLoading.java#nocoops_coh 8357632 generic-all
runtime/cds/TestDefaultArchiveLoading.java#nocoops_nocoh 8357632 generic-all
serviceability/jvmti/RedefineClasses/RedefineSharedClass.java 8357632 generic-all

View File

@ -26,6 +26,7 @@
* @test
* @summary Test that CDS archive can be loaded if the archive is in a non-JVM variant directory.
* @bug 8353504
* @requires !jdk.static
* @requires vm.cds
* @requires vm.flagless
* @requires vm.flavor == "server"