< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/OldSuperClass.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  *

32  * @compile test-classes/ChildOldSuper.java
33  * @compile test-classes/GChild.java
34  * @compile test-classes/OldSuperApp.java
35  * @run driver OldSuperClass
36  */
37 
38 import jdk.test.lib.cds.CDSTestUtils;
39 import jdk.test.lib.process.OutputAnalyzer;
40 
41 public class OldSuperClass {
42     public static void main(String[] args) throws Exception {
43         String mainClass = "OldSuperApp";
44         String namePrefix = "oldsuperclass";
45         String appClasses[] = TestCommon.list("OldSuper", "ChildOldSuper", "GChild", mainClass);
46         JarBuilder.build(namePrefix, appClasses);
47         String appJar = TestCommon.getTestJar(namePrefix + ".jar");
48 
49         boolean dynamicMode = CDSTestUtils.DYNAMIC_DUMP;
50 
51         // create archive with class list
52         OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:class+load,cds=debug,verification=trace");

53         TestCommon.checkExecReturn(output, 0,
54                                    dynamicMode ? true : false,
55                                    "Skipping OldSuper: Old class has been linked",
56                                    "Skipping ChildOldSuper: Old class has been linked",
57                                    "Skipping GChild: Old class has been linked");
58 
59         // run with archive
60         TestCommon.run(
61             "-cp", appJar,
62             "-Xlog:class+load,cds=debug,verification=trace",
63             mainClass)
64           .assertNormalExit(out -> {
65               out.shouldContain("Verifying class OldSuper with old format")
66                  .shouldContain("Verifying class ChildOldSuper with new format")
67                  .shouldContain("Verifying class GChild with new format");
68               if (!dynamicMode) {
69                   out.shouldContain("OldSuper source: shared objects file")
70                      .shouldContain("ChildOldSuper source: shared objects file")
71                      .shouldContain("GChild source: shared objects file");
72               } 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  *

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