author | goetz |
Thu, 03 Aug 2017 10:24:34 +0200 | |
changeset 46779 | d80ca591ae48 |
parent 46747 | 7b6570052b58 |
permissions | -rw-r--r-- |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
1 |
/* |
46491
e43953993af3
8180631: [TESTBUG] CDS tests should use CDSTestUtils.executeAndLog whenever spawning sub processes
mseledtsov
parents:
41705
diff
changeset
|
2 |
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
4 |
* |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
8 |
* |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
13 |
* accompanied this code). |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
14 |
* |
41705
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
18 |
* |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
21 |
* questions. |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
22 |
*/ |
41705
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
23 |
|
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
24 |
/* |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
25 |
* @test |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
26 |
* @bug 8059510 |
46747
7b6570052b58
8130072: Add a flag to print out statistics for both system dictionary and shared dictionary
coleenp
parents:
46742
diff
changeset
|
27 |
* @summary Test jcmd VM.symboltable, VM.stringtable and VM.systemdictionary options |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38089
diff
changeset
|
28 |
* @library /test/lib |
36851 | 29 |
* @modules java.base/jdk.internal.misc |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28363
diff
changeset
|
30 |
* java.management |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
31 |
* @run main/othervm -XX:+UnlockDiagnosticVMOptions DumpSymbolAndStringTable |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
32 |
*/ |
46491
e43953993af3
8180631: [TESTBUG] CDS tests should use CDSTestUtils.executeAndLog whenever spawning sub processes
mseledtsov
parents:
41705
diff
changeset
|
33 |
import jdk.test.lib.cds.CDSTestUtils; |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38089
diff
changeset
|
34 |
import jdk.test.lib.process.ProcessTools; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38089
diff
changeset
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38089
diff
changeset
|
36 |
import jdk.test.lib.JDKToolFinder; |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
37 |
|
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
38 |
public class DumpSymbolAndStringTable { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
39 |
public static void main(String[] args) throws Exception { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
40 |
// Grab my own PID |
38089
9e58203ef0e2
8153992: Some hotspot tests fail on compact2 due to an unnecessary test library dependency
akulyakh
parents:
36851
diff
changeset
|
41 |
String pid = Long.toString(ProcessTools.getProcessId()); |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
42 |
|
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
43 |
ProcessBuilder pb = new ProcessBuilder(); |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
44 |
pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.symboltable", "-verbose"}); |
46491
e43953993af3
8180631: [TESTBUG] CDS tests should use CDSTestUtils.executeAndLog whenever spawning sub processes
mseledtsov
parents:
41705
diff
changeset
|
45 |
OutputAnalyzer output = CDSTestUtils.executeAndLog(pb, "jcmd-symboltable"); |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
46 |
try { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
47 |
output.shouldContain("24 2: DumpSymbolAndStringTable\n"); |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
48 |
} catch (RuntimeException e) { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
49 |
output.shouldContain("Unknown diagnostic command"); |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
50 |
} |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
51 |
|
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
52 |
pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.stringtable", "-verbose"}); |
46491
e43953993af3
8180631: [TESTBUG] CDS tests should use CDSTestUtils.executeAndLog whenever spawning sub processes
mseledtsov
parents:
41705
diff
changeset
|
53 |
output = CDSTestUtils.executeAndLog(pb, "jcmd-stringtable"); |
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
54 |
try { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
55 |
output.shouldContain("16: java.lang.String\n"); |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
56 |
} catch (RuntimeException e) { |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
57 |
output.shouldContain("Unknown diagnostic command"); |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
58 |
} |
46742 | 59 |
|
60 |
pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.systemdictionary"}); |
|
61 |
output = CDSTestUtils.executeAndLog(pb, "jcmd-systemdictionary"); |
|
62 |
try { |
|
63 |
output.shouldContain("System Dictionary for jdk/internal/loader/ClassLoaders$AppClassLoader statistics:"); |
|
64 |
output.shouldContain("Number of buckets"); |
|
65 |
output.shouldContain("Number of entries"); |
|
66 |
output.shouldContain("Maximum bucket size"); |
|
67 |
} catch (RuntimeException e) { |
|
68 |
output.shouldContain("Unknown diagnostic command"); |
|
69 |
} |
|
70 |
||
71 |
pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.systemdictionary", "-verbose"}); |
|
72 |
output = CDSTestUtils.executeAndLog(pb, "jcmd-systemdictionary"); |
|
73 |
try { |
|
74 |
output.shouldContain("Dictionary for class loader 0x"); |
|
75 |
output.shouldContain("^java.lang.String"); |
|
76 |
} catch (RuntimeException e) { |
|
77 |
output.shouldContain("Unknown diagnostic command"); |
|
78 |
} |
|
28363
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
79 |
} |
047115468f16
8059510: Compact symbol table layout inside shared archive.
jiangli
parents:
diff
changeset
|
80 |
} |