59 "-XX:" + (j == 0 ? "-" : "+") + "AOTReplayTraining")
60 .classpath("app.jar")
61 .appCommandLine("JavacBenchApp", "10")
62 .runAOTWorkflow();
63 }
64 }
65 }
66 static void trainAndRun(String testName, String trainingFlags, String productionFlags, String errorPattern) throws Exception {
67 printTestCase("Flags mismatch " + testName);
68
69 String appJar = ClassFileInstaller.getJarPath("hello.jar");
70 String aotConfigFile = "hello.aotconfig";
71 String aotCacheFile = "hello.aot";
72 String helloClass = "Hello";
73
74 ProcessBuilder pb;
75 OutputAnalyzer out;
76
77 // first make sure we have a valid aotConfigFile with default value of TypeProfileLevel
78 pb = ProcessTools.createLimitedTestJavaProcessBuilder(
79 "-XX:AOTMode=record",
80 "-XX:AOTConfiguration=" + aotConfigFile,
81 "-XX:+UnlockExperimentalVMOptions",
82 trainingFlags,
83 "-cp", appJar, helloClass);
84
85 out = CDSTestUtils.executeAndLog(pb, "train");
86 out.shouldHaveExitValue(0);
87
88 pb = ProcessTools.createLimitedTestJavaProcessBuilder(
89 "-XX:AOTMode=create",
90 "-XX:AOTConfiguration=" + aotConfigFile,
91 "-XX:AOTCache=" + aotCacheFile,
92 "-XX:+UnlockExperimentalVMOptions",
93 trainingFlags,
94 "-cp", appJar);
95
96 out = CDSTestUtils.executeAndLog(pb, "assemble");
97 out.shouldHaveExitValue(0);
98
99 pb = ProcessTools.createLimitedTestJavaProcessBuilder(
100 "-XX:AOTCache=" + aotCacheFile,
101 "-XX:+UnlockExperimentalVMOptions",
102 trainingFlags,
103 "-cp", appJar, helloClass);
104
105 out = CDSTestUtils.executeAndLog(pb, "production_success");
106 out.shouldNotMatch(errorPattern);
107 out.shouldHaveExitValue(0);
108
109 pb = ProcessTools.createLimitedTestJavaProcessBuilder(
110 "-XX:AOTCache=" + aotCacheFile,
111 "-XX:+UnlockExperimentalVMOptions",
112 productionFlags,
113 "-cp", appJar, helloClass);
114
115 out = CDSTestUtils.executeAndLog(pb, "production_failure");
116 out.shouldMatch(errorPattern);
117 out.shouldHaveExitValue(0);
118 }
119
120 public static void testFlagsMismatch() throws Exception {
121 String errorPattern = ".*Profile.* setting .* does not equal the current .*Profile.* setting.*";
122 trainAndRun("TypeProfileLevel", "-XX:TypeProfileLevel=222", "-XX:TypeProfileLevel=111", errorPattern);
123 trainAndRun("TypeProfileArgsLimit", "-XX:TypeProfileArgsLimit=2", "-XX:TypeProfileArgsLimit=3", errorPattern);
124 trainAndRun("TypeProfileParamsLimit", "-XX:TypeProfileParmsLimit=2", "-XX:TypeProfileParmsLimit=3", errorPattern);
125 trainAndRun("TypeProfileWidth", "-XX:TypeProfileWidth=2", "-XX:TypeProfileWidth=3", errorPattern);
126 if (Platform.isDebugBuild()) {
127 trainAndRun("ProfileTraps", "-XX:+ProfileTraps", "-XX:-ProfileTraps", errorPattern);
128 trainAndRun("TypeProfileCasts", "-XX:+TypeProfileCasts", "-XX:-TypeProfileCasts", errorPattern);
129 }
130 errorPattern = "SpecTrapLimitExtraEntries setting .* does not equal the current SpecTrapLimitExtraEntries setting";
131 trainAndRun("SpecTrapLimitExtraEntries", "-XX:SpecTrapLimitExtraEntries=2", "-XX:SpecTrapLimitExtraEntries=3", errorPattern);
132 }
133
134 static int testNum = 0;
135 static void printTestCase(String s) {
136 System.out.println("vvvvvvv TEST CASE " + testNum + ": " + s + " starts here vvvvvvv");
137 testNum++;
|
59 "-XX:" + (j == 0 ? "-" : "+") + "AOTReplayTraining")
60 .classpath("app.jar")
61 .appCommandLine("JavacBenchApp", "10")
62 .runAOTWorkflow();
63 }
64 }
65 }
66 static void trainAndRun(String testName, String trainingFlags, String productionFlags, String errorPattern) throws Exception {
67 printTestCase("Flags mismatch " + testName);
68
69 String appJar = ClassFileInstaller.getJarPath("hello.jar");
70 String aotConfigFile = "hello.aotconfig";
71 String aotCacheFile = "hello.aot";
72 String helloClass = "Hello";
73
74 ProcessBuilder pb;
75 OutputAnalyzer out;
76
77 // first make sure we have a valid aotConfigFile with default value of TypeProfileLevel
78 pb = ProcessTools.createLimitedTestJavaProcessBuilder(
79 "-Xlog:aot",
80 "-XX:AOTMode=record",
81 "-XX:AOTConfiguration=" + aotConfigFile,
82 "-XX:+UnlockExperimentalVMOptions",
83 trainingFlags,
84 "-cp", appJar, helloClass);
85
86 out = CDSTestUtils.executeAndLog(pb, "train");
87 out.shouldHaveExitValue(0);
88
89 pb = ProcessTools.createLimitedTestJavaProcessBuilder(
90 "-Xlog:aot",
91 "-XX:AOTMode=create",
92 "-XX:AOTConfiguration=" + aotConfigFile,
93 "-XX:AOTCache=" + aotCacheFile,
94 "-XX:+UnlockExperimentalVMOptions",
95 trainingFlags,
96 "-cp", appJar);
97
98 out = CDSTestUtils.executeAndLog(pb, "assemble");
99 out.shouldHaveExitValue(0);
100
101 pb = ProcessTools.createLimitedTestJavaProcessBuilder(
102 "-Xlog:aot",
103 "-XX:AOTCache=" + aotCacheFile,
104 "-XX:+UnlockExperimentalVMOptions",
105 trainingFlags,
106 "-cp", appJar, helloClass);
107
108 out = CDSTestUtils.executeAndLog(pb, "production_success");
109 out.shouldNotMatch(errorPattern);
110 out.shouldHaveExitValue(0);
111
112 pb = ProcessTools.createLimitedTestJavaProcessBuilder(
113 "-Xlog:aot",
114 "-XX:AOTCache=" + aotCacheFile,
115 "-XX:+UnlockExperimentalVMOptions",
116 productionFlags,
117 "-cp", appJar, helloClass);
118
119 out = CDSTestUtils.executeAndLog(pb, "production_failure");
120 out.shouldMatch(errorPattern);
121 out.shouldHaveExitValue(1); // RequireSharedSpaces is on in premain
122 }
123
124 public static void testFlagsMismatch() throws Exception {
125 String errorPattern = ".*Profile.* setting .* does not equal the current .*Profile.* setting.*";
126 trainAndRun("TypeProfileLevel", "-XX:TypeProfileLevel=222", "-XX:TypeProfileLevel=111", errorPattern);
127 trainAndRun("TypeProfileArgsLimit", "-XX:TypeProfileArgsLimit=2", "-XX:TypeProfileArgsLimit=3", errorPattern);
128 trainAndRun("TypeProfileParamsLimit", "-XX:TypeProfileParmsLimit=2", "-XX:TypeProfileParmsLimit=3", errorPattern);
129 trainAndRun("TypeProfileWidth", "-XX:TypeProfileWidth=2", "-XX:TypeProfileWidth=3", errorPattern);
130 if (Platform.isDebugBuild()) {
131 trainAndRun("ProfileTraps", "-XX:+ProfileTraps", "-XX:-ProfileTraps", errorPattern);
132 trainAndRun("TypeProfileCasts", "-XX:+TypeProfileCasts", "-XX:-TypeProfileCasts", errorPattern);
133 }
134 errorPattern = "SpecTrapLimitExtraEntries setting .* does not equal the current SpecTrapLimitExtraEntries setting";
135 trainAndRun("SpecTrapLimitExtraEntries", "-XX:SpecTrapLimitExtraEntries=2", "-XX:SpecTrapLimitExtraEntries=3", errorPattern);
136 }
137
138 static int testNum = 0;
139 static void printTestCase(String s) {
140 System.out.println("vvvvvvv TEST CASE " + testNum + ": " + s + " starts here vvvvvvv");
141 testNum++;
|