< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/OldClassWithjsr.java

Print this page

29  * @requires vm.cds
30  * @library /test/lib
31  * @compile test-classes/OldClassWithjsrApp.jasm
32  * @run driver OldClassWithjsr
33  */
34 
35 import jdk.test.lib.cds.CDSTestUtils;
36 import jdk.test.lib.process.OutputAnalyzer;
37 
38 public class OldClassWithjsr {
39     public static void main(String[] args) throws Exception {
40         String mainClass = "OldClassWithjsrApp";
41         String namePrefix = "oldclasswithjsr";
42         String appClasses[] = TestCommon.list(mainClass);
43         JarBuilder.build(namePrefix, appClasses);
44         String appJar = TestCommon.getTestJar(namePrefix + ".jar");
45 
46         boolean dynamicMode = CDSTestUtils.DYNAMIC_DUMP;
47 
48         // create archive with class list
49         OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:class+load,cds=debug,verification=trace");

50         TestCommon.checkExecReturn(output, 0,
51                                    dynamicMode ? true : false,
52                                    "Skipping " + mainClass + ": Old class has been linked");
53 
54         // run with archive
55         TestCommon.run(
56             "-cp", appJar,
57             "-Xlog:class+load,cds=debug,verification=trace",
58             mainClass, "1")
59           .assertNormalExit(out -> {
60               out.shouldContain("Verifying class " + mainClass + " with old format");
61               if (!dynamicMode) {
62                   out.shouldContain(mainClass + " source: shared objects file");
63               } else {
64                   // Old classes were already linked before dynamic dump happened,
65                   // so they couldn't be archived.
66                   out.shouldMatch(".class.load.*" + mainClass + " source:.*" + namePrefix + ".jar");
67               }
68           });
69     }

29  * @requires vm.cds
30  * @library /test/lib
31  * @compile test-classes/OldClassWithjsrApp.jasm
32  * @run driver OldClassWithjsr
33  */
34 
35 import jdk.test.lib.cds.CDSTestUtils;
36 import jdk.test.lib.process.OutputAnalyzer;
37 
38 public class OldClassWithjsr {
39     public static void main(String[] args) throws Exception {
40         String mainClass = "OldClassWithjsrApp";
41         String namePrefix = "oldclasswithjsr";
42         String appClasses[] = TestCommon.list(mainClass);
43         JarBuilder.build(namePrefix, appClasses);
44         String appJar = TestCommon.getTestJar(namePrefix + ".jar");
45 
46         boolean dynamicMode = CDSTestUtils.DYNAMIC_DUMP;
47 
48         // create archive with class list
49         OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:class+load,cds=debug,verification=trace",
50                                                 "-XX:-PreloadSharedClasses");
51         TestCommon.checkExecReturn(output, 0,
52                                    dynamicMode ? true : false,
53                                    "Skipping " + mainClass + ": Old class has been linked");
54 
55         // run with archive
56         TestCommon.run(
57             "-cp", appJar,
58             "-Xlog:class+load,cds=debug,verification=trace",
59             mainClass, "1")
60           .assertNormalExit(out -> {
61               out.shouldContain("Verifying class " + mainClass + " with old format");
62               if (!dynamicMode) {
63                   out.shouldContain(mainClass + " source: shared objects file");
64               } else {
65                   // Old classes were already linked before dynamic dump happened,
66                   // so they couldn't be archived.
67                   out.shouldMatch(".class.load.*" + mainClass + " source:.*" + namePrefix + ".jar");
68               }
69           });
70     }
< prev index next >