42
43 import jdk.test.lib.process.OutputAnalyzer;
44 import jdk.test.lib.helpers.ClassFileInstaller;
45 import sun.hotspot.WhiteBox;
46
47 public class PrintSharedArchiveAndExit {
48 public static void main(String[] args) throws Exception {
49 run();
50 }
51 public static void run(String... extra_runtime_args) throws Exception {
52 String wbJar = ClassFileInstaller.getJarPath("WhiteBox.jar");
53 String use_whitebox_jar = "-Xbootclasspath/a:" + wbJar;
54
55 String appJar = ClassFileInstaller.getJarPath("hello.jar");
56 String customJarPath = ClassFileInstaller.getJarPath("hello_custom.jar");
57
58 // Dump the archive
59 String classlist[] = new String[] {
60 "HelloUnload",
61 "java/lang/Object id: 1",
62 "CustomLoadee id: 2 super: 1 source: " + customJarPath
63 };
64
65 OutputAnalyzer output;
66 TestCommon.testDump(appJar, classlist,
67 // command-line arguments ...
68 use_whitebox_jar);
69
70 output = TestCommon.exec(appJar,
71 TestCommon.concat(extra_runtime_args,
72 // command-line arguments ...
73 use_whitebox_jar,
74 "-XX:+UnlockDiagnosticVMOptions",
75 "-XX:+WhiteBoxAPI",
76 "-XX:+PrintSharedArchiveAndExit",
77 "HelloUnload", customJarPath, "true", "true"));
78 output.shouldMatch(".* archive version \\d+")
79 .shouldContain("java.lang.Object boot_loader")
80 .shouldContain("HelloUnload app_loader")
81 .shouldContain("CustomLoadee unregistered_loader")
82 .shouldContain("Shared Builtin Dictionary")
|
42
43 import jdk.test.lib.process.OutputAnalyzer;
44 import jdk.test.lib.helpers.ClassFileInstaller;
45 import sun.hotspot.WhiteBox;
46
47 public class PrintSharedArchiveAndExit {
48 public static void main(String[] args) throws Exception {
49 run();
50 }
51 public static void run(String... extra_runtime_args) throws Exception {
52 String wbJar = ClassFileInstaller.getJarPath("WhiteBox.jar");
53 String use_whitebox_jar = "-Xbootclasspath/a:" + wbJar;
54
55 String appJar = ClassFileInstaller.getJarPath("hello.jar");
56 String customJarPath = ClassFileInstaller.getJarPath("hello_custom.jar");
57
58 // Dump the archive
59 String classlist[] = new String[] {
60 "HelloUnload",
61 "java/lang/Object id: 1",
62 "java/lang/IdentityObject id: 2",
63 "CustomLoadee id: 3 super: 1 interfaces: 2 source: " + customJarPath
64 };
65
66 OutputAnalyzer output;
67 TestCommon.testDump(appJar, classlist,
68 // command-line arguments ...
69 use_whitebox_jar);
70
71 output = TestCommon.exec(appJar,
72 TestCommon.concat(extra_runtime_args,
73 // command-line arguments ...
74 use_whitebox_jar,
75 "-XX:+UnlockDiagnosticVMOptions",
76 "-XX:+WhiteBoxAPI",
77 "-XX:+PrintSharedArchiveAndExit",
78 "HelloUnload", customJarPath, "true", "true"));
79 output.shouldMatch(".* archive version \\d+")
80 .shouldContain("java.lang.Object boot_loader")
81 .shouldContain("HelloUnload app_loader")
82 .shouldContain("CustomLoadee unregistered_loader")
83 .shouldContain("Shared Builtin Dictionary")
|