15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /**
26 * @test
27 * @summary AppCDS tests for testing -Xbootclasspath/a
28 * @requires vm.cds & !vm.graal.enabled
29 * @library /test/lib /test/hotspot/jtreg/runtime/appcds
30 * @modules java.base/jdk.internal.misc
31 * java.management
32 * jdk.jartool/sun.tools.jar
33 * jdk.internal.jvmstat/sun.jvmstat.monitor
34 * @compile src/jdk/test/Main.java
35 * @compile src/com/sun/tools/javac/Main2.jasm
36 * @compile src/sun/nio/cs/ext/MyClass.java
37 * @compile src/sun/nio/cs/ext1/MyClass.java
38 * @run main BootAppendTests
39 */
40
41 import java.io.File;
42 import java.nio.file.Path;
43 import java.nio.file.Paths;
44 import jdk.test.lib.cds.CDSOptions;
45 import jdk.test.lib.cds.CDSTestUtils;
46 import jdk.test.lib.process.ProcessTools;
47 import jdk.test.lib.process.OutputAnalyzer;
48
49 public class BootAppendTests {
50 private static final String TEST_SRC = System.getProperty("test.src");
51 private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
52 private static final Path CLASSES_DIR = Paths.get("classes");
53
54 private static final String MAIN_CLASS = "jdk.test.Main";
55 private static final String APP_MODULE_CLASS = "com/sun/tools/javac/Main2";
56 private static final String BOOT_APPEND_MODULE_CLASS = "sun/nio/cs/ext/MyClass";
57 private static final String BOOT_APPEND_CLASS = "sun/nio/cs/ext1/MyClass";
58 private static final String[] ARCHIVE_CLASSES =
59 {APP_MODULE_CLASS, BOOT_APPEND_MODULE_CLASS, BOOT_APPEND_CLASS};
60
61 private static String appJar;
62 private static String bootAppendJar;
63 private static String testArchiveName;
64
65 public static void main(String... args) throws Exception {
66 dumpArchive();
67
68 System.out.println("TESTCASE: 1: testBootAppendModuleClassWithoutAppCDS");
69 testBootAppendModuleClassWithoutAppCDS();
70
71 System.out.println("TESTCASE: 2" );
72 testBootAppendModuleClassWithAppCDS();
73
74 System.out.println("TESTCASE: 3" );
75 testBootAppendExcludedModuleClassWithoutAppCDS();
222 appJar,
223 "-Xbootclasspath/a:" + bootAppendJar,
224 MAIN_CLASS,
225 "Test #8", APP_MODULE_CLASS, "false");
226 TestCommon.checkExec(output);
227 }
228
229
230 // Test #9: A class in excluded package defined in jimage app module
231 // - should be loaded from the -Xbootclasspath/a without AppCDS
232 public static void testBootAppendAppExcludeModuleClassWithoutAppCDS()
233 throws Exception {
234
235 TestCommon.run(
236 "-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar,
237 "-Xlog:class+load=info",
238 "--limit-modules", "java.base",
239 MAIN_CLASS, "Test #9", APP_MODULE_CLASS, "true", "BOOT")
240 .assertSilentlyDisabledCDS(out -> {
241 out.shouldHaveExitValue(0)
242 .shouldMatch(".class.load. com.sun.tools.javac.Main2 source:.*bootAppend.jar");
243 });
244 }
245
246 // Test #10: A shared class in excluded package defined in jimage app module
247 // - should be loaded from the -Xbootclasspath/a with AppCDS
248 public static void testBootAppendAppExcludeModuleClassAppCDS() throws Exception {
249 TestCommon.run(
250 "-cp", appJar, "-Xbootclasspath/a:" + bootAppendJar,
251 "-Xlog:class+load=info",
252 "--limit-modules", "java.base",
253 MAIN_CLASS, "Test #10", APP_MODULE_CLASS, "true", "BOOT")
254 .assertSilentlyDisabledCDS(out -> {
255 out.shouldHaveExitValue(0)
256 .shouldMatch(".class.load. com.sun.tools.javac.Main2 source:.*bootAppend.jar");
257 });
258 }
259 }
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /**
26 * @test
27 * @summary AppCDS tests for testing -Xbootclasspath/a
28 * @requires vm.cds & !vm.graal.enabled
29 * @library /test/lib /test/hotspot/jtreg/runtime/appcds
30 * @modules java.base/jdk.internal.misc
31 * java.management
32 * jdk.jartool/sun.tools.jar
33 * jdk.internal.jvmstat/sun.jvmstat.monitor
34 * @compile src/jdk/test/Main.java
35 * @compile src/com/sun/tools/javac/MyMain.jasm
36 * @compile src/sun/nio/cs/ext/MyClass.java
37 * @compile src/sun/nio/cs/ext1/MyClass.java
38 * @run main BootAppendTests
39 */
40
41 import java.io.File;
42 import java.nio.file.Path;
43 import java.nio.file.Paths;
44 import jdk.test.lib.cds.CDSOptions;
45 import jdk.test.lib.cds.CDSTestUtils;
46 import jdk.test.lib.process.ProcessTools;
47 import jdk.test.lib.process.OutputAnalyzer;
48
49 public class BootAppendTests {
50 private static final String TEST_SRC = System.getProperty("test.src");
51 private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
52 private static final Path CLASSES_DIR = Paths.get("classes");
53
54 private static final String MAIN_CLASS = "jdk.test.Main";
55 private static final String APP_MODULE_CLASS = "com/sun/tools/javac/MyMain";
56 private static final String BOOT_APPEND_MODULE_CLASS = "sun/nio/cs/ext/MyClass";
57 private static final String BOOT_APPEND_CLASS = "sun/nio/cs/ext1/MyClass";
58 private static final String[] ARCHIVE_CLASSES =
59 {APP_MODULE_CLASS, BOOT_APPEND_MODULE_CLASS, BOOT_APPEND_CLASS};
60
61 private static String appJar;
62 private static String bootAppendJar;
63 private static String testArchiveName;
64
65 public static void main(String... args) throws Exception {
66 dumpArchive();
67
68 System.out.println("TESTCASE: 1: testBootAppendModuleClassWithoutAppCDS");
69 testBootAppendModuleClassWithoutAppCDS();
70
71 System.out.println("TESTCASE: 2" );
72 testBootAppendModuleClassWithAppCDS();
73
74 System.out.println("TESTCASE: 3" );
75 testBootAppendExcludedModuleClassWithoutAppCDS();
222 appJar,
223 "-Xbootclasspath/a:" + bootAppendJar,
224 MAIN_CLASS,
225 "Test #8", APP_MODULE_CLASS, "false");
226 TestCommon.checkExec(output);
227 }
228
229
230 // Test #9: A class in excluded package defined in jimage app module
231 // - should be loaded from the -Xbootclasspath/a without AppCDS
232 public static void testBootAppendAppExcludeModuleClassWithoutAppCDS()
233 throws Exception {
234
235 TestCommon.run(
236 "-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar,
237 "-Xlog:class+load=info",
238 "--limit-modules", "java.base",
239 MAIN_CLASS, "Test #9", APP_MODULE_CLASS, "true", "BOOT")
240 .assertSilentlyDisabledCDS(out -> {
241 out.shouldHaveExitValue(0)
242 .shouldMatch(".class.load. com.sun.tools.javac.MyMain source:.*bootAppend.jar");
243 });
244 }
245
246 // Test #10: A shared class in excluded package defined in jimage app module
247 // - should be loaded from the -Xbootclasspath/a with AppCDS
248 public static void testBootAppendAppExcludeModuleClassAppCDS() throws Exception {
249 TestCommon.run(
250 "-cp", appJar, "-Xbootclasspath/a:" + bootAppendJar,
251 "-Xlog:class+load=info",
252 "--limit-modules", "java.base",
253 MAIN_CLASS, "Test #10", APP_MODULE_CLASS, "true", "BOOT")
254 .assertSilentlyDisabledCDS(out -> {
255 out.shouldHaveExitValue(0)
256 .shouldMatch(".class.load. com.sun.tools.javac.MyMain source:.*bootAppend.jar");
257 });
258 }
259 }
|