< prev index next > test/hotspot/jtreg/runtime/cds/appcds/aotFlags/AOTFlags.java
Print this page
positiveTests();
negativeTests();
}
static void positiveTests() throws Exception {
+ String hasTrainingDataPattern = "MethodTrainingData *= *[1-9]";
+ String noTrainingDataPattern = "MethodTrainingData *= *0";
+ String hasAOTCodePattern = "Shared file region .ac. .: *[1-9]";
+ String noAOTCodePattern = "Shared file region .ac. .: *0";
+ String hasMappedAOTCodePattern = "Mapped [0-9]+ bytes at address 0x[0-9a-f]+ from AOT Code Cache";
+
//----------------------------------------------------------------------
printTestCase("Training Run");
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTMode=record",
"-XX:AOTConfiguration=" + aotConfigFile,
"-cp", appJar, helloClass);
OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "train");
out.shouldContain("Hello World");
out.shouldContain("AOTConfiguration recorded: " + aotConfigFile);
+ out.shouldMatch(hasTrainingDataPattern);
+ out.shouldMatch(noAOTCodePattern);
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("Assembly Phase (AOTClassLinking unspecified -> should be enabled by default)");
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-Xlog:aot",
"-cp", appJar);
out = CDSTestUtils.executeAndLog(pb, "asm");
out.shouldContain("AOTCache creation is complete");
out.shouldMatch("hello[.]aot");
+ out.shouldMatch(hasTrainingDataPattern);
+ out.shouldMatch(hasAOTCodePattern);
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("Production Run with AOTCache");
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTCache=" + aotCacheFile,
"-Xlog:aot",
+ "-Xlog:aot+codecache*",
"-cp", appJar, helloClass);
out = CDSTestUtils.executeAndLog(pb, "prod");
out.shouldContain("Using AOT-linked classes: true (static archive: has aot-linked classes)");
out.shouldContain("Opened AOT cache hello.aot.");
out.shouldContain("Hello World");
+ out.shouldMatch(hasMappedAOTCodePattern);
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("AOTMode=off");
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTMode=create",
"-XX:-AOTClassLinking",
"-XX:AOTConfiguration=" + aotConfigFile,
"-XX:AOTCache=" + aotCacheFile,
! "-Xlog:aot",
"-cp", appJar);
out = CDSTestUtils.executeAndLog(pb, "asm");
out.shouldContain("AOTCache creation is complete");
out.shouldMatch("hello[.]aot");
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("Production Run with AOTCache, which was created with -XX:-AOTClassLinking");
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTCache=" + aotCacheFile,
"-Xlog:aot",
"-cp", appJar, helloClass);
out = CDSTestUtils.executeAndLog(pb, "prod");
out.shouldContain("Using AOT-linked classes: false (static archive: no aot-linked classes)");
out.shouldContain("Opened AOT cache hello.aot.");
out.shouldContain("Hello World");
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("Training run with -XX:-AOTClassLinking, but assembly run with -XX:+AOTClassLinking");
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTMode=create",
"-XX:-AOTClassLinking",
"-XX:AOTConfiguration=" + aotConfigFile,
"-XX:AOTCache=" + aotCacheFile,
! "-Xlog:aot=debug",
"-cp", appJar);
out = CDSTestUtils.executeAndLog(pb, "asm");
out.shouldContain("AOTCache creation is complete");
out.shouldMatch("hello[.]aot");
+ out.shouldMatch(noTrainingDataPattern);
+ out.shouldMatch(noAOTCodePattern);
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("Production Run with AOTCache, which was created with -XX:-AOTClassLinking");
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTCache=" + aotCacheFile,
"-Xlog:aot",
+ "-Xlog:aot+codecache*",
"-cp", appJar, helloClass);
out = CDSTestUtils.executeAndLog(pb, "prod");
out.shouldContain("Using AOT-linked classes: false (static archive: no aot-linked classes)");
out.shouldContain("Opened AOT cache hello.aot.");
out.shouldContain("Hello World");
+ out.shouldNotMatch(hasMappedAOTCodePattern);
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("Training run with -XX:-AOTClassLinking, but assembly run with -XX:+AOTClassLinking");
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTConfiguration=" + aotConfigFile,
"-XX:AOTCache=" + aotCacheFile,
"-Xlog:aot=debug",
"-cp", appJar);
out = CDSTestUtils.executeAndLog(pb, "asm");
! out.shouldContain("Writing AOTCache file:");
! out.shouldMatch("aot.*hello[.]aot");
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("One step training run (JEP-514");
"-XX:AOTConfiguration=" + aotConfigFile,
"-XX:AOTCache=" + aotCacheFile,
"-Xlog:aot=debug",
"-cp", appJar);
out = CDSTestUtils.executeAndLog(pb, "asm");
! out.shouldContain("AOTCache creation is complete");
! out.shouldMatch("hello[.]aot");
out.shouldHaveExitValue(0);
//----------------------------------------------------------------------
printTestCase("One step training run (JEP-514");
out.shouldContain("Hello World");
out.shouldContain("AOTConfiguration recorded: " + aotConfigFile);
out.shouldContain("AOTCache creation is complete: hello.aot");
out.shouldHaveExitValue(0);
- // Set AOTCacheOutput/AOTConfiguration/AOTMode=auto; Ergo changes: AOTMode=record
- pb = ProcessTools.createLimitedTestJavaProcessBuilder(
- "-XX:AOTMode=auto",
- "-XX:AOTCacheOutput=" + aotCacheFile,
- "-XX:AOTConfiguration=" + aotConfigFile,
- "-Xlog:aot=debug",
- "-cp", appJar, helloClass);
- out = CDSTestUtils.executeAndLog(pb, "ontstep-train");
- out.shouldContain("Hello World");
- out.shouldContain("AOTConfiguration recorded: " + aotConfigFile);
- out.shouldContain("AOTCache creation is complete: hello.aot");
- out.shouldHaveExitValue(0);
-
// Set AOTCacheOutput only; Ergo for: AOTMode=record, AOTConfiguration=<temp>
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTCacheOutput=" + aotCacheFile,
"-Xlog:aot=debug",
"-cp", appJar, helloClass);
out.shouldContain("Hello World");
out.shouldContain("Temporary AOTConfiguration recorded: " + aotCacheFile + ".config");
out.shouldContain("AOTCache creation is complete: hello.aot");
out.shouldHaveExitValue(0);
- // Set AOTCacheOutput/AOTMode=auto only; Ergo for: AOTMode=record, AOTConfiguration=<temp>
- pb = ProcessTools.createLimitedTestJavaProcessBuilder(
- "-XX:AOTMode=auto",
- "-XX:AOTCacheOutput=" + aotCacheFile,
- "-Xlog:aot=debug",
- "-cp", appJar, helloClass);
- out = CDSTestUtils.executeAndLog(pb, "ontstep-train");
- out.shouldContain("Hello World");
- out.shouldContain("Temporary AOTConfiguration recorded: " + aotCacheFile + ".config");
- out.shouldContain("AOTCache creation is complete: hello.aot");
- out.shouldHaveExitValue(0);
-
// Quoating of space characters in child JVM process
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:AOTCacheOutput=" + aotCacheFile,
"-Dmy.prop=My string -Xshare:off here", // -Xshare:off should not be treated as a single VM opt for the child JVM
"-Xlog:aot=debug",
< prev index next >