8344822: CDS BulkLoaderTest.java#dynamic fails with COH
Reviewed-by: dholmes, ccheung
This commit is contained in:
parent
f51363e027
commit
8485cb1ca1
@ -41,9 +41,10 @@
|
|||||||
* @requires vm.cds.supports.aot.class.linking
|
* @requires vm.cds.supports.aot.class.linking
|
||||||
* @library /test/jdk/lib/testlibrary /test/lib
|
* @library /test/jdk/lib/testlibrary /test/lib
|
||||||
* @build InitiatingLoaderTester
|
* @build InitiatingLoaderTester
|
||||||
* @build BulkLoaderTest
|
* @build jdk.test.whitebox.WhiteBox BulkLoaderTest
|
||||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller -jar BulkLoaderTestApp.jar BulkLoaderTestApp MyUtil InitiatingLoaderTester
|
* @run driver jdk.test.lib.helpers.ClassFileInstaller -jar BulkLoaderTestApp.jar BulkLoaderTestApp MyUtil InitiatingLoaderTester
|
||||||
* @run driver BulkLoaderTest DYNAMIC
|
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||||
|
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. BulkLoaderTest DYNAMIC
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -80,7 +81,6 @@ public class BulkLoaderTest {
|
|||||||
// Run without archived FMG -- fail to load
|
// Run without archived FMG -- fail to load
|
||||||
{
|
{
|
||||||
String extraVmArgs[] = {
|
String extraVmArgs[] = {
|
||||||
"-Xshare:on",
|
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
"-Djdk.module.showModuleResolution=true"
|
"-Djdk.module.showModuleResolution=true"
|
||||||
};
|
};
|
||||||
|
@ -35,7 +35,9 @@
|
|||||||
* @summary Run JavacBenchApp with the classic dynamic archive workflow
|
* @summary Run JavacBenchApp with the classic dynamic archive workflow
|
||||||
* @requires vm.cds
|
* @requires vm.cds
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run driver JavacBench DYNAMIC
|
* @build jdk.test.whitebox.WhiteBox
|
||||||
|
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||||
|
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. JavacBench DYNAMIC
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jdk.test.lib.cds.CDSAppTester;
|
import jdk.test.lib.cds.CDSAppTester;
|
||||||
|
@ -28,6 +28,7 @@ import jdk.test.lib.cds.CDSTestUtils;
|
|||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.StringArrayUtils;
|
import jdk.test.lib.StringArrayUtils;
|
||||||
|
import jdk.test.whitebox.WhiteBox;
|
||||||
import jtreg.SkippedException;
|
import jtreg.SkippedException;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -43,6 +44,7 @@ abstract public class CDSAppTester {
|
|||||||
private final String staticArchiveFileLog;
|
private final String staticArchiveFileLog;
|
||||||
private final String dynamicArchiveFile;
|
private final String dynamicArchiveFile;
|
||||||
private final String dynamicArchiveFileLog;
|
private final String dynamicArchiveFileLog;
|
||||||
|
private final String tempBaseArchiveFile;
|
||||||
private int numProductionRuns = 0;
|
private int numProductionRuns = 0;
|
||||||
|
|
||||||
public CDSAppTester(String name) {
|
public CDSAppTester(String name) {
|
||||||
@ -58,6 +60,7 @@ abstract public class CDSAppTester {
|
|||||||
staticArchiveFileLog = staticArchiveFile + ".log";
|
staticArchiveFileLog = staticArchiveFile + ".log";
|
||||||
dynamicArchiveFile = name() + ".dynamic.jsa";
|
dynamicArchiveFile = name() + ".dynamic.jsa";
|
||||||
dynamicArchiveFileLog = dynamicArchiveFile + ".log";
|
dynamicArchiveFileLog = dynamicArchiveFile + ".log";
|
||||||
|
tempBaseArchiveFile = name() + ".temp-base.jsa";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String productionRunLog() {
|
private String productionRunLog() {
|
||||||
@ -189,9 +192,37 @@ abstract public class CDSAppTester {
|
|||||||
return executeAndCheck(cmdLine, runMode, staticArchiveFile, staticArchiveFileLog);
|
return executeAndCheck(cmdLine, runMode, staticArchiveFile, staticArchiveFileLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Creating a dynamic CDS archive (with -XX:ArchiveClassesAtExit=<foo>.jsa) requires that the current
|
||||||
|
// JVM process is using a static archive (which is usually the default CDS archive included in the JDK).
|
||||||
|
// However, if the JDK doesn't include a default CDS archive that's compatible with the set of
|
||||||
|
// VM options used by this test, we need to create a temporary static archive to be used with -XX:ArchiveClassesAtExit.
|
||||||
|
private String getBaseArchiveForDynamicArchive() throws Exception {
|
||||||
|
WhiteBox wb = WhiteBox.getWhiteBox();
|
||||||
|
if (wb.isSharingEnabled()) {
|
||||||
|
// This current JVM is able to use a default CDS archive included by the JDK, so
|
||||||
|
// if we launch a JVM child process (with the same set of options as the current JVM),
|
||||||
|
// that process is also able to use the same default CDS archive for creating
|
||||||
|
// a dynamic archive.
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
// This current JVM is unable to use a default CDS archive, so let's create a temporary
|
||||||
|
// static archive to be used with -XX:ArchiveClassesAtExit.
|
||||||
|
File f = new File(tempBaseArchiveFile);
|
||||||
|
if (!f.exists()) {
|
||||||
|
CDSOptions opts = new CDSOptions();
|
||||||
|
opts.setArchiveName(tempBaseArchiveFile);
|
||||||
|
opts.addSuffix("-Djava.class.path=");
|
||||||
|
OutputAnalyzer out = CDSTestUtils.createArchive(opts);
|
||||||
|
CDSTestUtils.checkBaseDump(out);
|
||||||
|
}
|
||||||
|
return tempBaseArchiveFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private OutputAnalyzer dumpDynamicArchive() throws Exception {
|
private OutputAnalyzer dumpDynamicArchive() throws Exception {
|
||||||
RunMode runMode = RunMode.DUMP_DYNAMIC;
|
RunMode runMode = RunMode.DUMP_DYNAMIC;
|
||||||
String[] cmdLine = new String[0];
|
String[] cmdLine = new String[0];
|
||||||
|
String baseArchive = getBaseArchiveForDynamicArchive();
|
||||||
if (isDynamicWorkflow()) {
|
if (isDynamicWorkflow()) {
|
||||||
// "classic" dynamic archive
|
// "classic" dynamic archive
|
||||||
cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
||||||
@ -204,6 +235,9 @@ abstract public class CDSAppTester {
|
|||||||
"cds+resolve=debug",
|
"cds+resolve=debug",
|
||||||
"class+load=debug"));
|
"class+load=debug"));
|
||||||
}
|
}
|
||||||
|
if (baseArchive != null) {
|
||||||
|
cmdLine = StringArrayUtils.concat(cmdLine, "-XX:SharedArchiveFile=" + baseArchive);
|
||||||
|
}
|
||||||
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
|
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
|
||||||
return executeAndCheck(cmdLine, runMode, dynamicArchiveFile, dynamicArchiveFileLog);
|
return executeAndCheck(cmdLine, runMode, dynamicArchiveFile, dynamicArchiveFileLog);
|
||||||
}
|
}
|
||||||
@ -227,9 +261,9 @@ abstract public class CDSAppTester {
|
|||||||
logToFile(productionRunLog(), "cds"));
|
logToFile(productionRunLog(), "cds"));
|
||||||
|
|
||||||
if (isStaticWorkflow()) {
|
if (isStaticWorkflow()) {
|
||||||
cmdLine = StringArrayUtils.concat(cmdLine, "-XX:SharedArchiveFile=" + staticArchiveFile);
|
cmdLine = StringArrayUtils.concat(cmdLine, "-Xshare:on", "-XX:SharedArchiveFile=" + staticArchiveFile);
|
||||||
} else if (isDynamicWorkflow()) {
|
} else if (isDynamicWorkflow()) {
|
||||||
cmdLine = StringArrayUtils.concat(cmdLine, "-XX:SharedArchiveFile=" + dynamicArchiveFile);
|
cmdLine = StringArrayUtils.concat(cmdLine, "-Xshare:on", "-XX:SharedArchiveFile=" + dynamicArchiveFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extraVmArgs != null) {
|
if (extraVmArgs != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user