< prev index next >

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

Print this page

 1 /*
 2  * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.
 8  *
 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
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  *

35  * @run driver OldSuperInf
36  */
37 
38 import jdk.test.lib.cds.CDSTestUtils;
39 import jdk.test.lib.process.OutputAnalyzer;
40 
41 public class OldSuperInf {
42 
43     public static void main(String[] args) throws Exception {
44         String mainClass = "OldSuperInfApp";
45         String namePrefix = "oldsuperinf";
46         String appClasses[] = TestCommon.list("OldInf", "ChildOldInf", "GChild2", mainClass);
47         JarBuilder.build(namePrefix, appClasses);
48 
49         String appJar = TestCommon.getTestJar(namePrefix + ".jar");
50         String archiveName = namePrefix + ".jsa";
51 
52         boolean dynamicMode = CDSTestUtils.DYNAMIC_DUMP;
53 
54         // create archive with class list
55         OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:class+load,cds=debug,verification=trace");

56         TestCommon.checkExecReturn(output, 0,
57                                    dynamicMode ? true : false,
58                                    "Skipping OldInf: Old class has been linked",
59                                    "Skipping ChildOldInf: Old class has been linked",
60                                    "Skipping GChild2: Old class has been linked");
61 
62         // run with archive
63         TestCommon.run(
64             "-cp", appJar,
65             "-Xlog:class+load,cds=debug,verification=trace",
66             mainClass)
67           .assertNormalExit(out -> {
68               out.shouldContain("Verifying class OldInf with old format")
69                  .shouldContain("Verifying class ChildOldInf with new format")
70                  .shouldContain("Verifying class GChild2 with new format");
71               if (!dynamicMode) {
72                   out.shouldContain("OldInf source: shared objects file")
73                      .shouldContain("ChildOldInf source: shared objects file")
74                      .shouldContain("GChild2 source: shared objects file");
75               } else {

 1 /*
 2  * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.
 8  *
 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
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  *

35  * @run driver OldSuperInf
36  */
37 
38 import jdk.test.lib.cds.CDSTestUtils;
39 import jdk.test.lib.process.OutputAnalyzer;
40 
41 public class OldSuperInf {
42 
43     public static void main(String[] args) throws Exception {
44         String mainClass = "OldSuperInfApp";
45         String namePrefix = "oldsuperinf";
46         String appClasses[] = TestCommon.list("OldInf", "ChildOldInf", "GChild2", mainClass);
47         JarBuilder.build(namePrefix, appClasses);
48 
49         String appJar = TestCommon.getTestJar(namePrefix + ".jar");
50         String archiveName = namePrefix + ".jsa";
51 
52         boolean dynamicMode = CDSTestUtils.DYNAMIC_DUMP;
53 
54         // create archive with class list
55         OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:class+load,cds=debug,verification=trace",
56                                                 "-XX:-PreloadSharedClasses");
57         TestCommon.checkExecReturn(output, 0,
58                                    dynamicMode ? true : false,
59                                    "Skipping OldInf: Old class has been linked",
60                                    "Skipping ChildOldInf: Old class has been linked",
61                                    "Skipping GChild2: Old class has been linked");
62 
63         // run with archive
64         TestCommon.run(
65             "-cp", appJar,
66             "-Xlog:class+load,cds=debug,verification=trace",
67             mainClass)
68           .assertNormalExit(out -> {
69               out.shouldContain("Verifying class OldInf with old format")
70                  .shouldContain("Verifying class ChildOldInf with new format")
71                  .shouldContain("Verifying class GChild2 with new format");
72               if (!dynamicMode) {
73                   out.shouldContain("OldInf source: shared objects file")
74                      .shouldContain("ChildOldInf source: shared objects file")
75                      .shouldContain("GChild2 source: shared objects file");
76               } else {
< prev index next >