author | ihse |
Tue, 20 Feb 2018 21:47:54 +0100 | |
changeset 48923 | b75c9e2e3b1f |
parent 48181 | 61a14b5cb1c6 |
child 50791 | b1e90a8a876c |
permissions | -rw-r--r-- |
48181
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
1 |
/* |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
4 |
* |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
8 |
* |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
13 |
* accompanied this code). |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
14 |
* |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
18 |
* |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
21 |
* questions. |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
22 |
*/ |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
23 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
24 |
import java.util.HashMap; |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
25 |
import java.util.List; |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
26 |
import java.util.Map; |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
27 |
import jdk.test.lib.apps.LingeredApp; |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
28 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
29 |
/* |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
30 |
* @test |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
31 |
* @bug 8191538 |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
32 |
* @summary Test clhsdb 'vmstructsdump' command |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
33 |
* @library /test/lib |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
34 |
* @run main/othervm ClhsdbVmStructsDump |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
35 |
*/ |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
36 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
37 |
public class ClhsdbVmStructsDump { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
38 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
39 |
public static void main(String[] args) throws Exception { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
40 |
System.out.println("Starting ClhsdbVmStructsDump test"); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
41 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
42 |
LingeredApp theApp = null; |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
43 |
try { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
44 |
ClhsdbLauncher test = new ClhsdbLauncher(); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
45 |
theApp = LingeredApp.startApp(); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
46 |
System.out.println("Started LingeredApp with pid " + theApp.getPid()); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
47 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
48 |
List<String> cmds = List.of("vmstructsdump"); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
49 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
50 |
Map<String, List<String>> expStrMap = new HashMap<>(); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
51 |
expStrMap.put("vmstructsdump", List.of( |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
52 |
"field ConstantPool _pool_holder InstanceKlass*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
53 |
"field InstanceKlass _methods Array<Method*>*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
54 |
"field InstanceKlass _constants ConstantPool*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
55 |
"field Klass _name Symbol*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
56 |
"type ClassLoaderData* null", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
57 |
"type DictionaryEntry KlassHashtableEntry", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
58 |
"field JavaThread _next JavaThread*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
59 |
"field JavaThread _osthread OSThread*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
60 |
"type TenuredGeneration CardGeneration", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
61 |
"field JVMState _bci", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
62 |
"type Universe null", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
63 |
"type ConstantPoolCache MetaspaceObj")); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
64 |
test.run(theApp.getPid(), cmds, expStrMap, null); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
65 |
} catch (Exception ex) { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
66 |
throw new RuntimeException("Test ERROR " + ex, ex); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
67 |
} finally { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
68 |
LingeredApp.stopApp(theApp); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
69 |
} |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
70 |
System.out.println("Test PASSED"); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
71 |
} |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
72 |
} |