author | ccheung |
Fri, 17 Aug 2018 14:50:59 -0700 | |
changeset 51439 | 0517bd2a0eda |
permissions | -rw-r--r-- |
51439
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
1 |
/* |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
4 |
* |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
8 |
* |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
13 |
* accompanied this code). |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
14 |
* |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
18 |
* |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
21 |
* questions. |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
22 |
* |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
23 |
*/ |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
24 |
|
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
25 |
/* |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
26 |
* @test |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
27 |
* @bug 8209385 |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
28 |
* @summary non-empty dir in -cp should be fine during dump time if only classes |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
29 |
* from the system modules are being loaded even though some are |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
30 |
* defined to the PlatformClassLoader and AppClassLoader. |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
31 |
* @requires vm.cds |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
32 |
* @library /test/lib |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
33 |
* @modules jdk.jartool/sun.tools.jar |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
34 |
* @compile test-classes/Hello.java |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
35 |
* @run main/othervm -Dtest.cds.copy.child.stdout=false UnusedCPDuringDump |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
36 |
*/ |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
37 |
|
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
38 |
import java.io.File; |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
39 |
import jdk.test.lib.process.OutputAnalyzer; |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
40 |
|
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
41 |
public class UnusedCPDuringDump { |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
42 |
|
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
43 |
public static void main(String[] args) throws Exception { |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
44 |
File dir = new File(System.getProperty("user.dir")); |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
45 |
File emptydir = new File(dir, "emptydir"); |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
46 |
emptydir.mkdir(); |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
47 |
String appJar = JarBuilder.getOrCreateHelloJar(); |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
48 |
|
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
49 |
OutputAnalyzer output = TestCommon.dump(dir.getPath(), |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
50 |
TestCommon.list("sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo", |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
51 |
"com/sun/tools/sjavac/client/ClientMain"), |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
52 |
"-Xlog:class+path=info,class+load=debug"); |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
53 |
TestCommon.checkDump(output, |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
54 |
"[class,load] sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo", |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
55 |
"for instance a 'jdk/internal/loader/ClassLoaders$PlatformClassLoader'", |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
56 |
"[class,load] com.sun.tools.sjavac.client.ClientMain", |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
57 |
"for instance a 'jdk/internal/loader/ClassLoaders$AppClassLoader'"); |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
58 |
|
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
59 |
String jsaOpt = "-XX:SharedArchiveFile=" + TestCommon.getCurrentArchiveName(); |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
60 |
TestCommon.run("-cp", appJar, jsaOpt, "-Xlog:class+path=info,class+load=debug", "Hello") |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
61 |
.assertNormalExit("Hello World"); |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
62 |
} |
0517bd2a0eda
8209385: CDS runtime classpath checking is too strict when only classes from the system modules are archived
ccheung
parents:
diff
changeset
|
63 |
} |