8364352: Some tests fail when using a limited number of pregenerated .jsa CDS archives

Reviewed-by: dholmes, stuefe
This commit is contained in:
Matthias Baesken 2025-09-01 08:03:34 +00:00
parent 48f70d7ad8
commit 3ca44c8dea
5 changed files with 27 additions and 5 deletions

View File

@ -80,6 +80,7 @@ requires.properties= \
vm.rtm.compiler \
vm.cds \
vm.cds.default.archive.available \
vm.cds.nocoops.archive.available \
vm.cds.custom.loaders \
vm.cds.supports.aot.class.linking \
vm.cds.supports.aot.code.caching \

View File

@ -28,6 +28,7 @@
* @requires vm.bits == 64 & !vm.graal.enabled & vm.debug == true
* @requires vm.flagless
* @requires vm.cds
* @requires vm.cds.default.archive.available
* @requires (os.family != "windows") & (os.family != "aix")
* @library /test/lib
* @modules java.base/jdk.internal.misc

View File

@ -94,8 +94,8 @@ public class TestDefaultArchiveLoading {
"server", archiveName(archiveSuffix));
}
private static boolean isCOHArchiveAvailable(char coops, char coh,
String archiveSuffix) throws Exception {
private static boolean isArchiveAvailable(char coops, char coh,
String archiveSuffix) throws Exception {
Path archive= archivePath(archiveSuffix);
return Files.exists(archive);
}
@ -113,12 +113,16 @@ public class TestDefaultArchiveLoading {
case "nocoops_nocoh":
coh = coops = '-';
archiveSuffix = "_nocoops";
if (!isArchiveAvailable(coops, coh, archiveSuffix)) {
throw new SkippedException("Skipping test due to " +
archivePath(archiveSuffix).toString() + " not available");
}
break;
case "nocoops_coh":
coops = '-';
coh = '+';
archiveSuffix = "_nocoops_coh";
if (!isCOHArchiveAvailable(coops, coh, archiveSuffix)) {
if (!isArchiveAvailable(coops, coh, archiveSuffix)) {
throw new SkippedException("Skipping test due to " +
archivePath(archiveSuffix).toString() + " not available");
}
@ -127,11 +131,15 @@ public class TestDefaultArchiveLoading {
coops = '+';
coh = '-';
archiveSuffix = "";
if (!isArchiveAvailable(coops, coh, archiveSuffix)) {
throw new SkippedException("Skipping test due to " +
archivePath(archiveSuffix).toString() + " not available");
}
break;
case "coops_coh":
coh = coops = '+';
archiveSuffix = "_coh";
if (!isCOHArchiveAvailable(coops, coh, archiveSuffix)) {
if (!isArchiveAvailable(coops, coh, archiveSuffix)) {
throw new SkippedException("Skipping test due to " +
archivePath(archiveSuffix).toString() + " not available");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2025, 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
@ -55,6 +55,7 @@
/**
* @test id=custom-cl-zgc
* @requires vm.cds.custom.loaders
* @requires vm.cds.nocoops.archive.available
* @requires vm.gc.Z
* @summary Test dumptime_table entries are removed with zgc eager class unloading
* @bug 8274935

View File

@ -121,6 +121,7 @@ public class VMProps implements Callable<Map<String, String>> {
// vm.cds is true if the VM is compiled with cds support.
map.put("vm.cds", this::vmCDS);
map.put("vm.cds.default.archive.available", this::vmCDSDefaultArchiveAvailable);
map.put("vm.cds.nocoops.archive.available", this::vmCDSNocoopsArchiveAvailable);
map.put("vm.cds.custom.loaders", this::vmCDSForCustomLoaders);
map.put("vm.cds.supports.aot.class.linking", this::vmCDSSupportsAOTClassLinking);
map.put("vm.cds.supports.aot.code.caching", this::vmCDSSupportsAOTCodeCaching);
@ -440,6 +441,16 @@ public class VMProps implements Callable<Map<String, String>> {
return "" + ("true".equals(vmCDS()) && Files.exists(archive));
}
/**
* Check for CDS no compressed oops archive existence.
*
* @return true if CDS archive classes_nocoops.jsa exists in the JDK to be tested.
*/
protected String vmCDSNocoopsArchiveAvailable() {
Path archive = Paths.get(System.getProperty("java.home"), "lib", "server", "classes_nocoops.jsa");
return "" + ("true".equals(vmCDS()) && Files.exists(archive));
}
/**
* Check for CDS support for custom loaders.
*