author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 57705 | 7cf02b2c1455 |
permissions | -rw-r--r-- |
48138 | 1 |
/* |
57567
b000362a89a0
8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents:
51992
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
48138 | 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 |
/** |
|
26 |
* @test |
|
48469
7312ae4465d6
8193672: [test] Enhance vm.cds property to check for all conditions required to run CDS tests
iklam
parents:
48397
diff
changeset
|
27 |
* @requires vm.cds & !vm.graal.enabled |
48138 | 28 |
* @library ../.. |
29 |
* @library /test/lib |
|
57705
7cf02b2c1455
8229267: [TESTBUG] Remove unnecessary @modules dependencies in CDS tests
iklam
parents:
57567
diff
changeset
|
30 |
* @modules jdk.jartool/sun.tools.jar |
48138 | 31 |
* @compile src/jdk/test/Main.java |
32 |
* @compile src/com/sun/tools/javac/Main.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
|
33 |
* @compile src/com/sun/tools/javac/MyMain.jasm |
57567
b000362a89a0
8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents:
51992
diff
changeset
|
34 |
* @compile ../../../javax/annotation/processing/FilerException.jasm |
51990
6003e034cdd8
8209946: [TESTBUG] CDS tests should use "@run driver"
iklam
parents:
49894
diff
changeset
|
35 |
* @run driver ClassPathTests |
48138 | 36 |
* @summary AppCDS tests for testing classpath/package conflicts |
37 |
*/ |
|
38 |
||
39 |
/* |
|
40 |
* These tests will verify that AppCDS will correctly handle archived classes |
|
41 |
* on the classpath that are in a package that is also exported by the jimage. |
|
42 |
* These classes should fail to load unless --limit-modules is used to hide the |
|
43 |
* package exported by the jimage. There are 8 variants of this test: |
|
44 |
* - With a jimage app package and with a jimage ext package |
|
45 |
* - With --limit-modules and without --limit-modules |
|
46 |
* - With AppCDS and without AppCDS (to verify behaviour is the same for both). |
|
47 |
* |
|
48 |
* There is also a 9th test to verify that when --limit-modules is used, a jimage |
|
49 |
* class in the archive can be replaced by a classpath class with the |
|
50 |
* same name and package. |
|
51 |
*/ |
|
52 |
||
51992
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
53 |
import java.lang.reflect.InvocationTargetException; |
48138 | 54 |
import java.lang.reflect.Method; |
55 |
import java.nio.file.Path; |
|
56 |
import java.nio.file.Paths; |
|
57 |
||
58 |
import jdk.test.lib.Asserts; |
|
59 |
import jdk.test.lib.cds.CDSOptions; |
|
60 |
import jdk.test.lib.cds.CDSTestUtils; |
|
61 |
import jdk.test.lib.process.ProcessTools; |
|
62 |
import jdk.test.lib.process.OutputAnalyzer; |
|
63 |
||
51992
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
64 |
import jtreg.SkippedException; |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
65 |
|
48138 | 66 |
|
67 |
public class ClassPathTests { |
|
68 |
private static final String TEST_SRC = System.getProperty("test.src"); |
|
69 |
private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); |
|
70 |
private static final Path CLASSES_DIR = Paths.get("classes"); |
|
71 |
||
72 |
// the test module |
|
73 |
private static final String MAIN_CLASS = "jdk.test.Main"; |
|
74 |
private static final String LIMITMODS_MAIN_CLASS = "jdk.test.LimitModsMain"; |
|
75 |
||
76 |
// test classes to archive. These are both in UPGRADED_MODULES |
|
77 |
private static final String JIMAGE_CLASS = "com/sun/tools/javac/Main"; |
|
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
|
78 |
private static final String APP_ARCHIVE_CLASS = "com/sun/tools/javac/MyMain"; |
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
|
79 |
private static final String PLATFORM_ARCHIVE_CLASS = "javax/annotation/processing/FilerException"; |
48138 | 80 |
private static final String[] ARCHIVE_CLASSES = {APP_ARCHIVE_CLASS, PLATFORM_ARCHIVE_CLASS, JIMAGE_CLASS}; |
81 |
private static final int NUMBER_OF_TEST_CASES = 10; |
|
82 |
||
83 |
private static String appJar; |
|
84 |
private static String testArchiveName; |
|
85 |
||
86 |
||
51992
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
87 |
public static void main(String[] args) throws Throwable { |
48138 | 88 |
ClassPathTests tests = new ClassPathTests(); |
89 |
tests.dumpArchive(); |
|
90 |
||
91 |
Method[] methods = tests.getClass().getDeclaredMethods(); |
|
92 |
int numOfTestMethodsRun = 0; |
|
93 |
for (Method m : methods) { |
|
94 |
if (m.getName().startsWith("test")) { |
|
95 |
System.out.println("About to run test method: " + m.getName()); |
|
51992
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
96 |
try { |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
97 |
m.invoke(tests); |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
98 |
} catch (InvocationTargetException ite) { |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
99 |
Throwable throwable = ite.getCause(); |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
100 |
if (throwable instanceof SkippedException) { |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
101 |
throw throwable; |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
102 |
} else { |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
103 |
throw ite; |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
104 |
} |
266a89a5d1af
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
ccheung
parents:
51990
diff
changeset
|
105 |
} |
48138 | 106 |
numOfTestMethodsRun++; |
107 |
} |
|
108 |
} |
|
109 |
||
110 |
Asserts.assertTrue((numOfTestMethodsRun == NUMBER_OF_TEST_CASES), |
|
111 |
"Expected " + NUMBER_OF_TEST_CASES + " test methods to run, actual number is " |
|
112 |
+ numOfTestMethodsRun); |
|
113 |
} |
|
114 |
||
115 |
private void dumpArchive() throws Exception { |
|
116 |
// Create a jar file with all the classes related to this test. |
|
117 |
JarBuilder.build( "classpathtests", |
|
118 |
APP_ARCHIVE_CLASS, PLATFORM_ARCHIVE_CLASS, JIMAGE_CLASS, |
|
119 |
"jdk/test/Main"); |
|
120 |
appJar = TestCommon.getTestJar("classpathtests.jar"); |
|
121 |
||
122 |
// dump the archive with altnernate jdk.comiler and jdk.activation classes in the class list |
|
123 |
OutputAnalyzer output1 = TestCommon.dump(appJar, TestCommon.list(ARCHIVE_CLASSES)); |
|
124 |
TestCommon.checkDump(output1); |
|
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
|
125 |
// The PLATFORM_ARCHIVE_CLASS belongs to the 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
|
126 |
// module will be found from the module during dumping. |
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
|
127 |
// The JIMAGE_CLASS will be found from the jdk.compiler module during |
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
|
128 |
// dumping. |
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
|
129 |
// The APP_ARCHIVE_CLASS, which belongs to a package within 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
|
130 |
// jdk.compiler module, will not be found during dump time. |
48138 | 131 |
for (String archiveClass : ARCHIVE_CLASSES) { |
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
|
132 |
if (archiveClass.equals(APP_ARCHIVE_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
|
133 |
output1.shouldContain("Preload Warning: Cannot find " + archiveClass); |
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
|
134 |
} else { |
48138 | 135 |
output1.shouldNotContain("Preload Warning: Cannot find " + archiveClass); |
136 |
} |
|
137 |
} |
|
138 |
||
139 |
testArchiveName = TestCommon.getCurrentArchiveName(); |
|
140 |
} |
|
141 |
||
142 |
// #1: Archived classpath class in same package as jimage app class. With AppCDS. |
|
143 |
// Should fail to load. |
|
144 |
public void testAppClassWithAppCDS() throws Exception { |
|
145 |
OutputAnalyzer output = TestCommon.exec( |
|
146 |
appJar, MAIN_CLASS, |
|
147 |
"Test #1", APP_ARCHIVE_CLASS, "false"); // last 3 args passed to test |
|
148 |
TestCommon.checkExec(output); |
|
149 |
} |
|
150 |
||
151 |
// #2: Archived classpath class in same package as jimage app class. Without AppCDS. |
|
152 |
// Should fail to load. |
|
153 |
public void testAppClassWithoutAppCDS() throws Exception { |
|
154 |
CDSOptions opts = (new CDSOptions()) |
|
155 |
.addPrefix("-cp", appJar) |
|
156 |
.setArchiveName(testArchiveName) |
|
157 |
.addSuffix(MAIN_CLASS, "Test #2", APP_ARCHIVE_CLASS, "false"); |
|
158 |
||
159 |
CDSTestUtils.runWithArchiveAndCheck(opts); |
|
160 |
} |
|
161 |
||
162 |
// #3: Archived classpath class in same package as jimage ext class. With AppCDS. |
|
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 |
// The class should be loaded from the module. |
48138 | 164 |
public void testExtClassWithAppCDS() throws Exception { |
165 |
OutputAnalyzer output = TestCommon.exec( |
|
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
|
166 |
appJar, MAIN_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
|
167 |
"Test #3", PLATFORM_ARCHIVE_CLASS, "true", "EXT"); // last 4 args passed to test |
48138 | 168 |
TestCommon.checkExec(output); |
169 |
} |
|
170 |
||
171 |
// #4: Archived classpath class in same package as jimage ext class. Without AppCDS. |
|
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
|
172 |
// The class should be loaded from the module. |
48138 | 173 |
public void testExtClassWithoutAppCDS() throws Exception { |
174 |
CDSOptions opts = (new CDSOptions()) |
|
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
|
175 |
.addPrefix("-cp", appJar) |
48138 | 176 |
.setArchiveName(testArchiveName) |
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
|
177 |
.addSuffix(MAIN_CLASS, "Test #4", PLATFORM_ARCHIVE_CLASS, "true", "EXT"); |
48138 | 178 |
|
179 |
CDSTestUtils.runWithArchiveAndCheck(opts); |
|
180 |
} |
|
181 |
||
182 |
// #5: Archived classpath class in same package as jimage app class. With AppCDS. |
|
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
|
183 |
// Should load with CDS disabled because --limit-modules is used. |
48138 | 184 |
public void testAppClassWithLimitModsWithAppCDS() throws Exception { |
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
|
185 |
TestCommon.run("-cp", appJar, |
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
|
186 |
"--limit-modules", "java.base", |
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
|
187 |
MAIN_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
|
188 |
"Test #5", APP_ARCHIVE_CLASS, "true") // last 3 args passed to test |
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
|
189 |
.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
|
190 |
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
|
191 |
}); |
48138 | 192 |
} |
193 |
||
194 |
// #6: Archived classpath class in same package as jimage app class. Without AppCDS. |
|
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
|
195 |
// Should load with CDS disabled because --limit-modules is used. |
48138 | 196 |
public void testAppClassWithLimitModsWithoutAppCDS() throws Exception { |
197 |
CDSOptions opts = (new CDSOptions()) |
|
198 |
.addPrefix("-cp", appJar, "--limit-modules", "java.base") |
|
199 |
.setArchiveName(testArchiveName) |
|
200 |
.addSuffix(MAIN_CLASS, "Test #6", APP_ARCHIVE_CLASS, "true"); |
|
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
|
201 |
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
|
202 |
.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
|
203 |
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
|
204 |
}); |
48138 | 205 |
} |
206 |
||
207 |
// #7: Archived classpath class in same package as jimage ext class. With AppCDS. |
|
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
|
208 |
// Should load with CDS disabled because --limit-modules is used. |
48138 | 209 |
public void testExtClassWithLimitModsWithAppCDS() throws Exception { |
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
|
210 |
TestCommon.run("-cp", appJar, |
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
|
211 |
"--limit-modules", "java.base", |
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
|
212 |
MAIN_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
|
213 |
"Test #7", PLATFORM_ARCHIVE_CLASS, "true") // last 3 args passed to test |
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 |
.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
|
215 |
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
|
216 |
}); |
48138 | 217 |
} |
218 |
||
219 |
// #8: Archived classpath class in same package as jimage ext class. Without AppCDS. |
|
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
|
220 |
// Should load with CDS disabled because --limit-modules is used. |
48138 | 221 |
public void testExtClassWithLimitModsWithoutAppCDS() throws Exception { |
222 |
CDSOptions opts = (new CDSOptions()) |
|
223 |
.addPrefix("-cp", appJar, "--limit-modules", "java.base") |
|
224 |
.setArchiveName(testArchiveName) |
|
225 |
.addSuffix(MAIN_CLASS, "Test #8", PLATFORM_ARCHIVE_CLASS, "true"); |
|
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
|
226 |
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
|
227 |
.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
|
228 |
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
|
229 |
}); |
48138 | 230 |
} |
231 |
||
232 |
// #9: Archived classpath class with same name as jimage app class. With AppCDS. |
|
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
|
233 |
// Should load with CDS disabled because --limit-modules is used. |
48138 | 234 |
public void testReplacingJImageClassWithAppCDS() throws Exception { |
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
|
235 |
TestCommon.run("-cp", appJar, |
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 |
"--limit-modules", "java.base", |
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 |
MAIN_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
|
238 |
"Test #9", JIMAGE_CLASS, "true") // last 3 args passed to test |
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 |
.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
|
240 |
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
|
241 |
}); |
48138 | 242 |
} |
243 |
||
244 |
// #10: Archived classpath class with same name as jimage app class. Without AppCDS. |
|
245 |
// Should load because --limit-modules is used. Note the archive will actually contain |
|
246 |
// the original jimage version of the class, but AppCDS should refuse to load it |
|
247 |
// since --limit-modules is used. This should result in the -cp version being used. |
|
248 |
public void testReplacingJImageClassWithoutAppCDS() throws Exception { |
|
249 |
CDSOptions opts = (new CDSOptions()) |
|
250 |
.addPrefix("-cp", appJar, "--limit-modules", "java.base") |
|
251 |
.setArchiveName(testArchiveName) |
|
252 |
.addSuffix(MAIN_CLASS, "Test #10", JIMAGE_CLASS, "true"); |
|
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
|
253 |
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
|
254 |
.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
|
255 |
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
|
256 |
}); |
48138 | 257 |
} |
258 |
} |