author | mseledtsov |
Wed, 20 Jun 2018 09:42:36 -0700 | |
changeset 50679 | 58dac477766c |
parent 50206 | adec398d9051 |
permissions | -rw-r--r-- |
36508 | 1 |
/* |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
2 |
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
36508 | 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 |
*/ |
|
23 |
||
24 |
/** |
|
25 |
* @test |
|
48397
ead47ddf5844
8191788: add jdk.internal.vm.compiler to --limit-modules if -Djvmci.Compiler=graal is in the command line
kvn
parents:
48171
diff
changeset
|
26 |
* @requires vm.cds & !vm.graal.enabled |
36508 | 27 |
* @summary Testing -Xbootclasspath/a support for CDS |
48469
7312ae4465d6
8193672: [test] Enhance vm.cds property to check for all conditions required to run CDS tests
iklam
parents:
48397
diff
changeset
|
28 |
* @requires vm.cds |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40244
diff
changeset
|
29 |
* @library /test/lib |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
30 |
* @modules java.compiler |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
31 |
* java.base/jdk.internal.misc |
36508 | 32 |
* java.management |
43467 | 33 |
* jdk.internal.jvmstat/sun.jvmstat.monitor |
36508 | 34 |
* @compile javax/sound/sampled/MyClass.jasm |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
35 |
* @compile javax/annotation/processing/FilerException.jasm |
36508 | 36 |
* @compile nonjdk/myPackage/MyClass.java |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40244
diff
changeset
|
37 |
* @build LoadClass |
36508 | 38 |
* @run main/othervm BootAppendTests |
39 |
*/ |
|
40 |
||
41 |
import java.io.File; |
|
42 |
import java.io.FileOutputStream; |
|
43 |
import java.io.IOException; |
|
44 |
import java.io.PrintStream; |
|
45 |
||
46 |
import java.nio.file.Path; |
|
47 |
import java.nio.file.Paths; |
|
48 |
||
46389 | 49 |
import jdk.test.lib.cds.CDSOptions; |
50 |
import jdk.test.lib.cds.CDSTestUtils; |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40244
diff
changeset
|
51 |
import jdk.test.lib.process.ProcessTools; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40244
diff
changeset
|
52 |
import jdk.test.lib.process.OutputAnalyzer; |
36508 | 53 |
|
54 |
public class BootAppendTests { |
|
55 |
private static final String APP_CLASS = "LoadClass"; |
|
56 |
private static final String BOOT_APPEND_MODULE_CLASS = "javax/sound/sampled/MyClass"; |
|
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
57 |
private static final String BOOT_APPEND_DUPLICATE_MODULE_CLASS = |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
58 |
"javax/annotation/processing/FilerException"; |
36508 | 59 |
private static final String BOOT_APPEND_CLASS = "nonjdk/myPackage/MyClass"; |
60 |
private static final String BOOT_APPEND_MODULE_CLASS_NAME = |
|
61 |
BOOT_APPEND_MODULE_CLASS.replace('/', '.'); |
|
62 |
private static final String BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME = |
|
63 |
BOOT_APPEND_DUPLICATE_MODULE_CLASS.replace('/', '.'); |
|
64 |
private static final String BOOT_APPEND_CLASS_NAME = |
|
65 |
BOOT_APPEND_CLASS.replace('/', '.'); |
|
66 |
private static final String[] ARCHIVE_CLASSES = |
|
67 |
{BOOT_APPEND_MODULE_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS, BOOT_APPEND_CLASS}; |
|
68 |
||
69 |
private static final String modes[] = {"on", "off"}; |
|
70 |
||
71 |
private static String appJar; |
|
72 |
private static String bootAppendJar; |
|
73 |
||
74 |
public static void main(String... args) throws Exception { |
|
75 |
dumpArchive(); |
|
46389 | 76 |
|
77 |
logTestCase("1"); |
|
36508 | 78 |
testBootAppendModuleClass(); |
46389 | 79 |
|
46410
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
80 |
logTestCase("2"); |
36508 | 81 |
testBootAppendDuplicateModuleClass(); |
46389 | 82 |
|
83 |
logTestCase("3"); |
|
36508 | 84 |
testBootAppendExcludedModuleClass(); |
46389 | 85 |
|
86 |
logTestCase("4"); |
|
36508 | 87 |
testBootAppendDuplicateExcludedModuleClass(); |
46389 | 88 |
|
89 |
logTestCase("5"); |
|
36508 | 90 |
testBootAppendClass(); |
48171
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
91 |
|
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
92 |
logTestCase("6"); |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
93 |
testBootAppendExtraDir(); |
36508 | 94 |
} |
95 |
||
46389 | 96 |
private static void logTestCase(String msg) { |
97 |
System.out.println(); |
|
98 |
System.out.printf("TESTCASE: %s", msg); |
|
99 |
System.out.println(); |
|
100 |
} |
|
101 |
||
36508 | 102 |
static void dumpArchive() throws Exception { |
103 |
// create the classlist |
|
46389 | 104 |
File classlist = CDSTestUtils.makeClassList(ARCHIVE_CLASSES); |
36508 | 105 |
|
106 |
// build jar files |
|
37263
08dec586ed5c
8153300: [TESTBUG] Enhance test/testlibrary/ClassFileInstaller.java to support JAR files
iklam
parents:
36508
diff
changeset
|
107 |
appJar = ClassFileInstaller.writeJar("app.jar", APP_CLASS); |
08dec586ed5c
8153300: [TESTBUG] Enhance test/testlibrary/ClassFileInstaller.java to support JAR files
iklam
parents:
36508
diff
changeset
|
108 |
bootAppendJar = ClassFileInstaller.writeJar("bootAppend.jar", |
36508 | 109 |
BOOT_APPEND_MODULE_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS, BOOT_APPEND_CLASS); |
110 |
||
111 |
||
46389 | 112 |
OutputAnalyzer out = CDSTestUtils.createArchiveAndCheck( |
113 |
"-Xbootclasspath/a:" + bootAppendJar, |
|
49931 | 114 |
"-cp", appJar, |
46389 | 115 |
"-XX:SharedClassListFile=" + classlist.getPath()); |
36508 | 116 |
// Make sure all the classes were successfully archived. |
117 |
for (String archiveClass : ARCHIVE_CLASSES) { |
|
50206
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
118 |
String msg = "Preload Warning: Cannot find " + archiveClass; |
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
119 |
if (archiveClass.equals(BOOT_APPEND_MODULE_CLASS)) { |
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
120 |
// We shouldn't archive a class in the appended boot class path that |
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
121 |
// are the java.desktop module. Such a class cannot be loaded |
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
122 |
// at runtime anyway. |
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
123 |
out.shouldContain(msg); |
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
124 |
} else { |
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
125 |
out.shouldNotContain(msg); |
adec398d9051
8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents:
49931
diff
changeset
|
126 |
} |
36508 | 127 |
} |
128 |
} |
|
129 |
||
130 |
// Test #1: If a class on -Xbootclasspath/a is from a package defined in |
|
131 |
// bootmodules, the class is not loaded at runtime. |
|
132 |
// Verify the behavior is the same when the class is archived |
|
133 |
// with CDS enabled at runtime. |
|
134 |
// |
|
135 |
// The javax.sound.sampled package is defined in the java.desktop module. |
|
136 |
// The archived javax.sound.sampled.MyClass from the -Xbootclasspath/a |
|
137 |
// should not be loaded at runtime. |
|
138 |
public static void testBootAppendModuleClass() throws Exception { |
|
139 |
for (String mode : modes) { |
|
46389 | 140 |
CDSOptions opts = (new CDSOptions()) |
141 |
.setXShareMode(mode).setUseVersion(false) |
|
46410
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
142 |
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar, "-showversion") |
46389 | 143 |
.addSuffix(APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME); |
144 |
||
46410
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
145 |
OutputAnalyzer out = CDSTestUtils.runWithArchive(opts); |
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
146 |
CDSTestUtils.checkExec(out, opts, "java.lang.ClassNotFoundException: javax.sound.sampled.MyClass"); |
36508 | 147 |
} |
148 |
} |
|
149 |
||
150 |
// Test #2: If a class on -Xbootclasspath/a has the same fully qualified |
|
151 |
// name as a class defined in boot modules, the class is not loaded |
|
152 |
// from -Xbootclasspath/a. Verify the behavior is the same at runtime |
|
153 |
// when CDS is enabled. |
|
154 |
// |
|
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
155 |
// The javax/annotation/processing/FilerException is a platform module |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
156 |
// class. The class on the -Xbootclasspath/a path that has the same |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
157 |
// fully-qualified name should not be loaded at runtime when CDS is enabled. |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
158 |
// The one from the platform modules should be loaded instead. |
36508 | 159 |
public static void testBootAppendDuplicateModuleClass() throws Exception { |
160 |
for (String mode : modes) { |
|
46389 | 161 |
CDSOptions opts = (new CDSOptions()) |
162 |
.setXShareMode(mode).setUseVersion(false) |
|
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
163 |
.addPrefix("-showversion", |
46410
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
164 |
"-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar) |
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
165 |
.addSuffix("-Xlog:class+load=info", |
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
166 |
APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME); |
46389 | 167 |
|
49931 | 168 |
String MATCH_PATTERN = ".class.load. javax.annotation.processing.FilerException source:.*bootAppend.jar*"; |
50679
58dac477766c
8204701: [TESTBUG] runtime/SharedArchiveFile/BootAppendTests.java should handle mapping failure
mseledtsov
parents:
50206
diff
changeset
|
169 |
CDSTestUtils.run(opts) |
58dac477766c
8204701: [TESTBUG] runtime/SharedArchiveFile/BootAppendTests.java should handle mapping failure
mseledtsov
parents:
50206
diff
changeset
|
170 |
.assertNormalExit(out -> { |
58dac477766c
8204701: [TESTBUG] runtime/SharedArchiveFile/BootAppendTests.java should handle mapping failure
mseledtsov
parents:
50206
diff
changeset
|
171 |
out.shouldNotMatch(MATCH_PATTERN); |
58dac477766c
8204701: [TESTBUG] runtime/SharedArchiveFile/BootAppendTests.java should handle mapping failure
mseledtsov
parents:
50206
diff
changeset
|
172 |
}); |
36508 | 173 |
} |
174 |
} |
|
175 |
||
176 |
// Test #3: If a class on -Xbootclasspath/a is from a package defined in boot modules, |
|
177 |
// the class can be loaded from -Xbootclasspath/a when the module is excluded |
|
40244
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
38151
diff
changeset
|
178 |
// using --limit-modules. Verify the behavior is the same at runtime when CDS |
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
38151
diff
changeset
|
179 |
// is enabled. |
36508 | 180 |
// |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
181 |
// The java.desktop module is excluded using --limit-modules at runtime |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
182 |
// CDS will be disabled with the --limit-modules option during runtime. |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
183 |
// javax.sound.sampled.MyClass will be loaded from the jar at runtime. |
36508 | 184 |
public static void testBootAppendExcludedModuleClass() throws Exception { |
185 |
for (String mode : modes) { |
|
46389 | 186 |
CDSOptions opts = (new CDSOptions()) |
187 |
.setXShareMode(mode).setUseVersion(false) |
|
46410
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
188 |
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion", |
48023
4b7462e3b552
8191653: Test failures in BootAppendTests - missing jdk.internal.vm.compiler module
ccheung
parents:
48004
diff
changeset
|
189 |
"--limit-modules=java.base", "-cp", appJar) |
46389 | 190 |
.addSuffix("-Xlog:class+load=info", |
191 |
APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME); |
|
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
192 |
CDSTestUtils.Result res = CDSTestUtils.run(opts); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
193 |
String MATCH_PATTERN = |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
194 |
".class.load. javax.sound.sampled.MyClass source:.*bootAppend.jar*"; |
36508 | 195 |
if (mode.equals("on")) { |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
196 |
res.assertSilentlyDisabledCDS(out -> { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
197 |
out.shouldHaveExitValue(0) |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
198 |
.shouldMatch(MATCH_PATTERN); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
199 |
}); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
200 |
} else { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
201 |
res.assertNormalExit(out -> { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
202 |
out.shouldMatch(MATCH_PATTERN); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
203 |
}); |
36508 | 204 |
} |
205 |
} |
|
206 |
} |
|
207 |
||
208 |
// Test #4: If a class on -Xbootclasspath/a has the same fully qualified |
|
209 |
// name as a class defined in boot modules, the class is loaded |
|
210 |
// from -Xbootclasspath/a when the boot module is excluded using |
|
40244
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
38151
diff
changeset
|
211 |
// --limit-modules. Verify the behavior is the same at runtime |
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
38151
diff
changeset
|
212 |
// when CDS is enabled. |
36508 | 213 |
// |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
214 |
// The javax.annotation.processing.FilerException is a platform module class. |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
215 |
// The class on -Xbootclasspath/a that has the same fully-qualified name |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
216 |
// as javax.annotation.processing.FilerException can be loaded at runtime when |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
217 |
// java.compiler is excluded. |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
218 |
// CDS is disabled during runtime if the --limit-modules option is |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
219 |
// specified. |
36508 | 220 |
public static void testBootAppendDuplicateExcludedModuleClass() throws Exception { |
221 |
for (String mode : modes) { |
|
46389 | 222 |
CDSOptions opts = (new CDSOptions()) |
223 |
.setXShareMode(mode).setUseVersion(false) |
|
46410
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
224 |
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion", |
48023
4b7462e3b552
8191653: Test failures in BootAppendTests - missing jdk.internal.vm.compiler module
ccheung
parents:
48004
diff
changeset
|
225 |
"--limit-modules=java.base", "-cp", appJar) |
46389 | 226 |
.addSuffix("-Xlog:class+load=info", |
227 |
APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME); |
|
228 |
||
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
229 |
CDSTestUtils.Result res = CDSTestUtils.run(opts); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
230 |
String MATCH_PATTERN = |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
231 |
".class.load. javax.annotation.processing.FilerException source:.*bootAppend.jar*"; |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
232 |
if (mode.equals("on")) { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
233 |
res.assertSilentlyDisabledCDS(out -> { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
234 |
out.shouldHaveExitValue(0) |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
235 |
.shouldMatch(MATCH_PATTERN); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
236 |
}); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
237 |
} else { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
238 |
res.assertNormalExit(out -> { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
239 |
out.shouldMatch(MATCH_PATTERN); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
240 |
}); |
46410
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
241 |
} |
36508 | 242 |
} |
243 |
} |
|
244 |
||
245 |
// Test #5: If a class on -Xbootclasspath/a is not from named modules, |
|
246 |
// the class can be loaded at runtime. Verify the behavior is |
|
247 |
// the same at runtime when CDS is enabled. |
|
248 |
// |
|
249 |
// The nonjdk.myPackage is not defined in named modules. The |
|
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
250 |
// nonjdk.myPackage.MyClass will be loaded from the jar in |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
251 |
// -Xbootclasspath/a since CDS will be disabled with the |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
252 |
// --limit-modules option. |
36508 | 253 |
public static void testBootAppendClass() throws Exception { |
254 |
for (String mode : modes) { |
|
46389 | 255 |
CDSOptions opts = (new CDSOptions()) |
256 |
.setXShareMode(mode).setUseVersion(false) |
|
46410
5ffd0f5000cc
8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents:
46389
diff
changeset
|
257 |
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion", |
48023
4b7462e3b552
8191653: Test failures in BootAppendTests - missing jdk.internal.vm.compiler module
ccheung
parents:
48004
diff
changeset
|
258 |
"--limit-modules=java.base", "-cp", appJar) |
46389 | 259 |
.addSuffix("-Xlog:class+load=info", |
260 |
APP_CLASS, BOOT_APPEND_CLASS_NAME); |
|
261 |
||
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
262 |
CDSTestUtils.Result res = CDSTestUtils.run(opts); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
263 |
String MATCH_PATTERN = |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
264 |
".class.load. nonjdk.myPackage.MyClass source:.*bootAppend.jar*"; |
36508 | 265 |
if (mode.equals("on")) { |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
266 |
res.assertSilentlyDisabledCDS(out -> { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
267 |
out.shouldHaveExitValue(0) |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
268 |
.shouldMatch(MATCH_PATTERN); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
269 |
}); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
270 |
} else { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
271 |
res.assertNormalExit(out -> { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
272 |
out.shouldMatch(MATCH_PATTERN); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
273 |
}); |
36508 | 274 |
} |
275 |
} |
|
276 |
} |
|
48171
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
277 |
|
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
278 |
// Test #6: This is similar to Test #5. During runtime, an extra dir |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
279 |
// is appended to the bootclasspath. It should not invalidate |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
280 |
// the shared archive. However, CDS will be disabled with the |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
281 |
// --limit-modules in the command line. |
48171
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
282 |
public static void testBootAppendExtraDir() throws Exception { |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
283 |
for (String mode : modes) { |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
284 |
CDSOptions opts = (new CDSOptions()) |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
285 |
.setXShareMode(mode).setUseVersion(false) |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
286 |
.addPrefix("-Xbootclasspath/a:" + bootAppendJar + File.pathSeparator + appJar, |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
287 |
"-showversion", "--limit-modules=java.base", "-cp", appJar) |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
288 |
.addSuffix("-Xlog:class+load=info", |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
289 |
APP_CLASS, BOOT_APPEND_CLASS_NAME); |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
290 |
|
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
291 |
CDSTestUtils.Result res = CDSTestUtils.run(opts); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
292 |
String MATCH_PATTERN = |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
293 |
".class.load. nonjdk.myPackage.MyClass source:.*bootAppend.jar*"; |
48171
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
294 |
if (mode.equals("on")) { |
49894
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
295 |
res.assertSilentlyDisabledCDS(out -> { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
296 |
out.shouldHaveExitValue(0) |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
297 |
.shouldMatch(MATCH_PATTERN); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
298 |
}); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
299 |
} else { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
300 |
res.assertNormalExit(out -> { |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
301 |
out.shouldMatch(MATCH_PATTERN); |
c830e94b5606
8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents:
48469
diff
changeset
|
302 |
}); |
48171
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
303 |
} |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
304 |
} |
7ad2d33a0f05
8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents:
48023
diff
changeset
|
305 |
} |
36508 | 306 |
} |