< prev index next >

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

 77         check(listData, true, "CustomLoadee id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 78         check(listData, true, "CustomInterface2_ia id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 79         check(listData, true, "CustomInterface2_ib id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 80         check(listData, true, "CustomLoadee2 id: [0-9]+ super: [0-9]+ interfaces: [0-9]+ [0-9]+ source: .*/custom.jar");
 81         check(listData, true, "CustomLoadee3 id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 82         check(listData, true, "CustomLoadee3Child id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 83         check(listData, true, "CustomLoadee4WithLambda id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 84 
 85         // We don't support archiving of Lambda proxies for custom loaders.
 86         check(listData, false, "@lambda-proxy.*CustomLoadee4WithLambda");
 87 
 88         // Dump the static archive
 89         CDSOptions opts = (new CDSOptions())
 90             .addPrefix("-cp", appJar,
 91                        "-Xlog:cds+class=debug",
 92                        "-XX:SharedClassListFile=" + classList);
 93         CDSTestUtils.createArchiveAndCheck(opts)
 94             .shouldContain("unreg CustomLoadee")
 95             .shouldContain("unreg CustomLoadee2")
 96             .shouldContain("unreg CustomLoadee3Child")
 97             .shouldContain("unreg OldClass ** unlinked");
 98 
 99         // Use the dumped static archive
100         opts = (new CDSOptions())
101             .setUseVersion(false)
102             .addPrefix("-cp", appJar)
103             .addSuffix("-Xlog:class+load,verification")
104             .addSuffix(commandLine);
105         CDSTestUtils.run(opts)
106             .assertNormalExit("CustomLoadee source: shared objects file",
107                               "CustomLoadee2 source: shared objects file",
108                               "CustomLoadee3Child source: shared objects file",
109                               "OldClass source: shared objects file",
110                               "Verifying class OldClass with old format");
111     }
112 
113     static void check(String listData, boolean mustMatch, String regexp) throws Exception {
114         Pattern pattern = Pattern.compile(regexp, Pattern.MULTILINE);
115         Matcher matcher = pattern.matcher(listData);
116         boolean found = matcher.find();
117         if (mustMatch && !found) {

  1 /*
  2  * Copyright (c) 2021, 2024, 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  *

 77         check(listData, true, "CustomLoadee id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 78         check(listData, true, "CustomInterface2_ia id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 79         check(listData, true, "CustomInterface2_ib id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 80         check(listData, true, "CustomLoadee2 id: [0-9]+ super: [0-9]+ interfaces: [0-9]+ [0-9]+ source: .*/custom.jar");
 81         check(listData, true, "CustomLoadee3 id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 82         check(listData, true, "CustomLoadee3Child id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 83         check(listData, true, "CustomLoadee4WithLambda id: [0-9]+ super: [0-9]+ source: .*/custom.jar");
 84 
 85         // We don't support archiving of Lambda proxies for custom loaders.
 86         check(listData, false, "@lambda-proxy.*CustomLoadee4WithLambda");
 87 
 88         // Dump the static archive
 89         CDSOptions opts = (new CDSOptions())
 90             .addPrefix("-cp", appJar,
 91                        "-Xlog:cds+class=debug",
 92                        "-XX:SharedClassListFile=" + classList);
 93         CDSTestUtils.createArchiveAndCheck(opts)
 94             .shouldContain("unreg CustomLoadee")
 95             .shouldContain("unreg CustomLoadee2")
 96             .shouldContain("unreg CustomLoadee3Child")
 97             .shouldContain("unreg OldClass unlinked");
 98 
 99         // Use the dumped static archive
100         opts = (new CDSOptions())
101             .setUseVersion(false)
102             .addPrefix("-cp", appJar)
103             .addSuffix("-Xlog:class+load,verification")
104             .addSuffix(commandLine);
105         CDSTestUtils.run(opts)
106             .assertNormalExit("CustomLoadee source: shared objects file",
107                               "CustomLoadee2 source: shared objects file",
108                               "CustomLoadee3Child source: shared objects file",
109                               "OldClass source: shared objects file",
110                               "Verifying class OldClass with old format");
111     }
112 
113     static void check(String listData, boolean mustMatch, String regexp) throws Exception {
114         Pattern pattern = Pattern.compile(regexp, Pattern.MULTILINE);
115         Matcher matcher = pattern.matcher(listData);
116         boolean found = matcher.find();
117         if (mustMatch && !found) {
< prev index next >