< prev index next >

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

Print this page

42 
43     public static void main(String[] args) throws Exception {
44         String mainClass = "LambdaContainsOldInfApp";
45         String namePrefix = "lambdacontainsoldinf";
46         JarBuilder.build(namePrefix, mainClass, "OldProvider");
47 
48         String appJar = TestCommon.getTestJar(namePrefix + ".jar");
49         String classList = namePrefix + ".list";
50         String archiveName = namePrefix + ".jsa";
51 
52         String[] mainArgs = { "dummy", "addLambda" };
53 
54         for (String mainArg : mainArgs) {
55             // dump class list
56             CDSTestUtils.dumpClassList(classList, "-cp", appJar, mainClass, mainArg);
57 
58             // create archive with the class list
59             CDSOptions opts = (new CDSOptions())
60                 .addPrefix("-XX:ExtraSharedClassListFile=" + classList,
61                            "-cp", appJar,
62                            "-Xlog:class+load,cds")

63                 .setArchiveName(archiveName);
64             OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
65             TestCommon.checkExecReturn(output, 0, true,
66                                        "Skipping OldProvider: Old class has been linked");
67             output.shouldMatch("Skipping.LambdaContainsOldInfApp[$][$]Lambda.*0x.*:.*Old.class.has.been.linked");
68 
69             // run with archive
70             CDSOptions runOpts = (new CDSOptions())
71                 .addPrefix("-cp", appJar, "-Xlog:class+load,cds=debug")
72                 .setArchiveName(archiveName)
73                 .setUseVersion(false)
74                 .addSuffix(mainClass)
75                 .addSuffix(mainArg);
76             output = CDSTestUtils.runWithArchive(runOpts);
77             TestCommon.checkExecReturn(output, 0, true,
78                 "[class,load] LambdaContainsOldInfApp source: shared objects file");
79             output.shouldMatch(".class.load. OldProvider.source:.*lambdacontainsoldinf.jar")
80                   .shouldMatch(".class.load. LambdaContainsOldInfApp[$][$]Lambda.*/0x.*source:.*LambdaContainsOldInf");
81        }
82     }

42 
43     public static void main(String[] args) throws Exception {
44         String mainClass = "LambdaContainsOldInfApp";
45         String namePrefix = "lambdacontainsoldinf";
46         JarBuilder.build(namePrefix, mainClass, "OldProvider");
47 
48         String appJar = TestCommon.getTestJar(namePrefix + ".jar");
49         String classList = namePrefix + ".list";
50         String archiveName = namePrefix + ".jsa";
51 
52         String[] mainArgs = { "dummy", "addLambda" };
53 
54         for (String mainArg : mainArgs) {
55             // dump class list
56             CDSTestUtils.dumpClassList(classList, "-cp", appJar, mainClass, mainArg);
57 
58             // create archive with the class list
59             CDSOptions opts = (new CDSOptions())
60                 .addPrefix("-XX:ExtraSharedClassListFile=" + classList,
61                            "-cp", appJar,
62                            "-Xlog:class+load,cds",
63                            "-XX:-PreloadSharedClasses")
64                 .setArchiveName(archiveName);
65             OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts);
66             TestCommon.checkExecReturn(output, 0, true,
67                                        "Skipping OldProvider: Old class has been linked");
68             output.shouldMatch("Skipping.LambdaContainsOldInfApp[$][$]Lambda.*0x.*:.*Old.class.has.been.linked");
69 
70             // run with archive
71             CDSOptions runOpts = (new CDSOptions())
72                 .addPrefix("-cp", appJar, "-Xlog:class+load,cds=debug")
73                 .setArchiveName(archiveName)
74                 .setUseVersion(false)
75                 .addSuffix(mainClass)
76                 .addSuffix(mainArg);
77             output = CDSTestUtils.runWithArchive(runOpts);
78             TestCommon.checkExecReturn(output, 0, true,
79                 "[class,load] LambdaContainsOldInfApp source: shared objects file");
80             output.shouldMatch(".class.load. OldProvider.source:.*lambdacontainsoldinf.jar")
81                   .shouldMatch(".class.load. LambdaContainsOldInfApp[$][$]Lambda.*/0x.*source:.*LambdaContainsOldInf");
82        }
83     }
< prev index next >