8281715: Move "base CDS archive not loaded" tests to SharedArchiveFileOption.java

Reviewed-by: ccheung, iklam
This commit is contained in:
Matias Saavedra Silva 2023-05-11 19:37:16 +00:00
parent 29b8242e07
commit a667213ec5
2 changed files with 24 additions and 27 deletions

View File

@ -218,32 +218,5 @@ public class ArchiveConsistency extends DynamicArchiveTestBase {
runTwo(nonExistBase, nonExistTop,
appJar, mainClass, isAuto ? 0 : 1,
"Specified shared archive not found (" + nonExistBase + ")");
// following two tests:
// -Xshare:auto -XX:SharedArchiveFile=top.jsa, but base does not exist.
if (!isUseSharedSpacesDisabled()) {
new File(baseArchiveName).delete();
startTest("11. -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=" + topArchiveName);
run(topArchiveName,
"-Xshare:auto",
"-XX:+AutoCreateSharedArchive",
"-cp",
appJar, mainClass)
.assertNormalExit(output -> {
output.shouldContain("warning: -XX:+AutoCreateSharedArchive is unsupported when base CDS archive is not loaded");
});
startTest("12. -XX:SharedArchiveFile=" + topArchiveName + " -XX:ArchiveClassesAtExit=" + getNewArchiveName("top3"));
run(topArchiveName,
"-Xshare:auto",
"-XX:ArchiveClassesAtExit=" + getNewArchiveName("top3"),
"-cp",
appJar, mainClass)
.assertNormalExit(output -> {
output.shouldContain("-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded");
});
}
}
}

View File

@ -228,6 +228,30 @@ public class SharedArchiveFileOption extends DynamicArchiveTestBase {
"-Xlog:cds",
"-cp", appJar, mainClass)
.assertAbnormalExit("Cannot use the following option when dumping the shared archive: --patch-module");
// following two tests:
// -Xshare:auto -XX:SharedArchiveFile=top.jsa, but base does not exist.
if (!isUseSharedSpacesDisabled()) {
new File(baseArchiveName).delete();
testcase("Archive not loaded -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=" + topArchiveName);
run(topArchiveName,
"-Xshare:auto",
"-XX:+AutoCreateSharedArchive",
"-cp",
appJar, mainClass)
.assertNormalExit(output -> {
output.shouldContain("warning: -XX:+AutoCreateSharedArchive is unsupported when base CDS archive is not loaded");
});
testcase("Archive not loaded -XX:SharedArchiveFile=" + topArchiveName + " -XX:ArchiveClassesAtExit=" + getNewArchiveName("top3"));
run(topArchiveName,
"-Xshare:auto",
"-XX:ArchiveClassesAtExit=" + getNewArchiveName("top3"),
"-cp",
appJar, mainClass)
.assertNormalExit(output -> {
output.shouldContain(ERROR);
});
}
}
{