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-- |
50951
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
1 |
/* |
57567
b000362a89a0
8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents:
51990
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
50951
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
4 |
* |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
8 |
* |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
13 |
* accompanied this code). |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
14 |
* |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
18 |
* |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
21 |
* questions. |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
22 |
* |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
23 |
*/ |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
24 |
|
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
25 |
/* |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
26 |
* @test |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
27 |
* @summary Compare archived system modules with non-archived. |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
28 |
* @requires vm.cds.archived.java.heap |
57567
b000362a89a0
8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents:
51990
diff
changeset
|
29 |
* @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/cds/appcds |
50951
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
30 |
* @compile PrintSystemModulesApp.java |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
31 |
* @run driver ClassFileInstaller -jar app.jar PrintSystemModulesApp |
51990
6003e034cdd8
8209946: [TESTBUG] CDS tests should use "@run driver"
iklam
parents:
51547
diff
changeset
|
32 |
* @run driver ArchivedModuleCompareTest |
50951
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
33 |
*/ |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
34 |
|
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
36 |
import jdk.test.lib.process.ProcessTools; |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
37 |
|
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
38 |
public class ArchivedModuleCompareTest { |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
39 |
public static void main(String[] args) throws Exception { |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
40 |
String appJar = ClassFileInstaller.getJarPath("app.jar"); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
41 |
|
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
42 |
// Test case 1) |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
43 |
// Compare the list of archived system module names with non-archived |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
44 |
// list. They must be the same. |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
45 |
System.out.println("---------------- Test case 1 -----------------"); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
46 |
OutputAnalyzer output = TestCommon.dump(appJar, |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
47 |
TestCommon.list("PrintSystemModulesApp")); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
48 |
TestCommon.checkDump(output); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
49 |
|
51547
2b004d807187
8209534: [TESTBUG]runtime/appcds/cacheObject/ArchivedModuleCompareTest.java fails with EnableJVMCI.
jiangli
parents:
50951
diff
changeset
|
50 |
output = TestCommon.execOff("-cp", appJar, "PrintSystemModulesApp"); |
50951
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
51 |
output.shouldHaveExitValue(0); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
52 |
String bootModules1 = output.getStdout(); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
53 |
|
51547
2b004d807187
8209534: [TESTBUG]runtime/appcds/cacheObject/ArchivedModuleCompareTest.java fails with EnableJVMCI.
jiangli
parents:
50951
diff
changeset
|
54 |
output = TestCommon.exec(appJar, "PrintSystemModulesApp"); |
50951
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
55 |
TestCommon.checkExec(output); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
56 |
if (output.getStderr().contains("sharing")) { |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
57 |
String bootModules2 = output.getStdout(); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
58 |
TestCommon.checkOutputStrings(bootModules1, bootModules2, ", "); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
59 |
} |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
60 |
|
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
61 |
// Test case 2) |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
62 |
// Verify --show-module-resolution output with the output from |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
63 |
// -Xshare:off run |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
64 |
System.out.println("---------------- Test case 2 -----------------"); |
51547
2b004d807187
8209534: [TESTBUG]runtime/appcds/cacheObject/ArchivedModuleCompareTest.java fails with EnableJVMCI.
jiangli
parents:
50951
diff
changeset
|
65 |
output = TestCommon.execOff("-cp", appJar, |
2b004d807187
8209534: [TESTBUG]runtime/appcds/cacheObject/ArchivedModuleCompareTest.java fails with EnableJVMCI.
jiangli
parents:
50951
diff
changeset
|
66 |
"--show-module-resolution", |
2b004d807187
8209534: [TESTBUG]runtime/appcds/cacheObject/ArchivedModuleCompareTest.java fails with EnableJVMCI.
jiangli
parents:
50951
diff
changeset
|
67 |
"-version"); |
50951
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
68 |
output.shouldHaveExitValue(0); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
69 |
String moduleResolutionOut1 = output.getStdout(); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
70 |
|
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
71 |
output = TestCommon.exec(appJar, |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
72 |
"--show-module-resolution", |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
73 |
"-version"); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
74 |
TestCommon.checkExec(output); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
75 |
if (output.getStderr().contains("sharing")) { |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
76 |
String moduleResolutionOut2 = output.getStdout(); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
77 |
TestCommon.checkOutputStrings( |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
78 |
moduleResolutionOut1, moduleResolutionOut2, "\n"); |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
79 |
} |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
80 |
} |
b96466cdfc45
8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff
changeset
|
81 |
} |