author | ccheung |
Tue, 01 May 2018 17:28:03 -0700 | |
changeset 49942 | f4310c01104d |
parent 49739 | 00805b129186 |
child 50079 | 5830a17d9fc8 |
permissions | -rw-r--r-- |
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
1 |
/* |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
4 |
* |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
8 |
* |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
13 |
* accompanied this code). |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
14 |
* |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
18 |
* |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
21 |
* questions. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
22 |
* |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
23 |
*/ |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
24 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
25 |
/** |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
26 |
* @test |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
27 |
* @requires vm.cds |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
28 |
* @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
29 |
* @modules jdk.compiler |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
30 |
* jdk.jartool/sun.tools.jar |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
31 |
* jdk.jlink |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
32 |
* @run main MainModuleOnly |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
33 |
* @summary Test some scenarios with a main modular jar specified in the --module-path and -cp options in the command line. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
34 |
*/ |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
35 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
36 |
import java.io.File; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
37 |
import java.nio.file.Files; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
38 |
import java.nio.file.Path; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
39 |
import java.nio.file.Paths; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
40 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
41 |
import jdk.test.lib.process.OutputAnalyzer; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
42 |
import jdk.testlibrary.ProcessTools; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
43 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
44 |
public class MainModuleOnly { |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
45 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
46 |
private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
47 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
48 |
private static final String TEST_SRC = System.getProperty("test.src"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
49 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
50 |
private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
51 |
private static final Path MODS_DIR = Paths.get("mods"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
52 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
53 |
// the module name of the test module |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
54 |
private static final String TEST_MODULE1 = "com.simple"; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
55 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
56 |
// the module main class |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
57 |
private static final String MAIN_CLASS = "com.simple.Main"; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
58 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
59 |
private static Path moduleDir = null; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
60 |
private static Path moduleDir2 = null; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
61 |
private static Path destJar = null; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
62 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
63 |
public static void buildTestModule() throws Exception { |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
64 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
65 |
// javac -d mods/$TESTMODULE --module-path MOD_DIR src/$TESTMODULE/** |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
66 |
JarBuilder.compileModule(SRC_DIR.resolve(TEST_MODULE1), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
67 |
MODS_DIR.resolve(TEST_MODULE1), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
68 |
MODS_DIR.toString()); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
69 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
70 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
71 |
moduleDir = Files.createTempDirectory(USER_DIR, "mlib"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
72 |
moduleDir2 = Files.createTempDirectory(USER_DIR, "mlib2"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
73 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
74 |
Path srcJar = moduleDir.resolve(TEST_MODULE1 + ".jar"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
75 |
destJar = moduleDir2.resolve(TEST_MODULE1 + ".jar"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
76 |
String classes = MODS_DIR.resolve(TEST_MODULE1).toString(); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
77 |
JarBuilder.createModularJar(srcJar.toString(), classes, MAIN_CLASS); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
78 |
Files.copy(srcJar, destJar); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
79 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
80 |
} |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
81 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
82 |
public static void main(String... args) throws Exception { |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
83 |
// compile the modules and create the modular jar files |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
84 |
buildTestModule(); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
85 |
String appClasses[] = {MAIN_CLASS}; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
86 |
// create an archive with both -cp and --module-path in the command line. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
87 |
// Only the class in the modular jar in the --module-path will be archived; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
88 |
// the class in the modular jar in the -cp won't be archived. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
89 |
OutputAnalyzer output = TestCommon.createArchive( |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
90 |
destJar.toString(), appClasses, |
49942
f4310c01104d
8202130: [TESTBUG] Some appcds regression test cases fail with "Error: VM option 'PrintSystemDictionaryAtExit' is notproduct and is available only in debug version of VM"
ccheung
parents:
49739
diff
changeset
|
91 |
"-Xlog:class+load=trace", |
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
92 |
"--module-path", moduleDir.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
93 |
"-m", TEST_MODULE1); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
94 |
TestCommon.checkDump(output); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
95 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
96 |
// run with the archive using the same command line as in dump time. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
97 |
// The main class should be loaded from the archive. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
98 |
TestCommon.run("-Xlog:class+load=trace", |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
99 |
"-cp", destJar.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
100 |
"--module-path", moduleDir.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
101 |
"-m", TEST_MODULE1) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
102 |
.assertNormalExit("[class,load] com.simple.Main source: shared objects file"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
103 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
104 |
// run with the archive with the main class name inserted before the -m. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
105 |
// The main class name will be picked up before the module name. So the |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
106 |
// main class should be loaded from the jar in the -cp. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
107 |
TestCommon.run("-Xlog:class+load=trace", |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
108 |
"-cp", destJar.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
109 |
"--module-path", moduleDir.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
110 |
MAIN_CLASS, "-m", TEST_MODULE1) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
111 |
.assertNormalExit(out -> |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
112 |
out.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar")); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
113 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
114 |
// run with the archive with exploded module. Since during dump time, we |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
115 |
// only archive classes from the modular jar in the --module-path, the |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
116 |
// main class should be loaded from the exploded module directory. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
117 |
TestCommon.run("-Xlog:class+load=trace", |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
118 |
"-cp", destJar.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
119 |
"--module-path", MODS_DIR.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
120 |
"-m", TEST_MODULE1 + "/" + MAIN_CLASS) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
121 |
.assertNormalExit(out -> { |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
122 |
out.shouldMatch(".class.load. com.simple.Main source:.*com.simple") |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
123 |
.shouldContain(MODS_DIR.toString()); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
124 |
}); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
125 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
126 |
// run with the archive with the --upgrade-module-path option. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
127 |
// CDS will be disabled with this options and the main class will be |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
128 |
// loaded from the modular jar. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
129 |
TestCommon.run("-Xlog:class+load=trace", |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
130 |
"-cp", destJar.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
131 |
"--upgrade-module-path", moduleDir.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
132 |
"--module-path", moduleDir.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
133 |
"-m", TEST_MODULE1) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
134 |
.assertSilentlyDisabledCDS(out -> { |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
135 |
out.shouldHaveExitValue(0) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
136 |
.shouldMatch("CDS is disabled when the.*option is specified") |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
137 |
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
138 |
}); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
139 |
// run with the archive with the --limit-modules option. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
140 |
// CDS will be disabled with this options and the main class will be |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
141 |
// loaded from the modular jar. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
142 |
TestCommon.run("-Xlog:class+load=trace", |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
143 |
"-cp", destJar.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
144 |
"--limit-modules", "java.base," + TEST_MODULE1, |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
145 |
"--module-path", moduleDir.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
146 |
"-m", TEST_MODULE1) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
147 |
.assertSilentlyDisabledCDS(out -> { |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
148 |
out.shouldHaveExitValue(0) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
149 |
.shouldMatch("CDS is disabled when the.*option is specified") |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
150 |
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
151 |
}); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
152 |
// run with the archive with the --patch-module option. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
153 |
// CDS will be disabled with this options and the main class will be |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
154 |
// loaded from the modular jar. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
155 |
TestCommon.run("-Xlog:class+load=trace", |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
156 |
"-cp", destJar.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
157 |
"--patch-module", TEST_MODULE1 + "=" + MODS_DIR.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
158 |
"--module-path", moduleDir.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
159 |
"-m", TEST_MODULE1) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
160 |
.assertSilentlyDisabledCDS(out -> { |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
161 |
out.shouldHaveExitValue(0) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
162 |
.shouldMatch("CDS is disabled when the.*option is specified") |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
163 |
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
164 |
}); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
165 |
// modify the timestamp of the jar file |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
166 |
(new File(destJar.toString())).setLastModified(System.currentTimeMillis() + 2000); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
167 |
// run with the archive and the jar with modified timestamp. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
168 |
// It should fail due to timestamp of the jar doesn't match the one |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
169 |
// used during dump time. |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
170 |
TestCommon.run("-Xlog:class+load=trace", |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
171 |
"-cp", destJar.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
172 |
"--module-path", moduleDir.toString(), |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
173 |
"-m", TEST_MODULE1) |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
174 |
.assertAbnormalExit( |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
175 |
"A jar/jimage file is not the one used while building the shared archive file:"); |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
176 |
} |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
diff
changeset
|
177 |
} |