author | iignatyev |
Thu, 02 Aug 2018 14:40:55 -0700 | |
changeset 51287 | 7b1ddbafa134 |
parent 50791 | b1e90a8a876c |
child 53596 | bb40a5303c84 |
permissions | -rw-r--r-- |
48181
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
1 |
/* |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48181
diff
changeset
|
2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
48181
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 |
|
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48181
diff
changeset
|
29 |
/** |
48181
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 'field' command |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48181
diff
changeset
|
33 |
* @requires vm.hasSA |
48181
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
34 |
* @library /test/lib |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
35 |
* @run main/othervm ClhsdbField |
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 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
38 |
public class ClhsdbField { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
39 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
40 |
public static void main(String[] args) throws Exception { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
41 |
System.out.println("Starting ClhsdbField test"); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
42 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
43 |
LingeredApp theApp = null; |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
44 |
try { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
45 |
ClhsdbLauncher test = new ClhsdbLauncher(); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
46 |
theApp = LingeredApp.startApp(); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
47 |
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
|
48 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
49 |
List<String> cmds = List.of("field"); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
50 |
|
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
51 |
Map<String, List<String>> expStrMap = new HashMap<>(); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
52 |
expStrMap.put("field", List.of( |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
53 |
"field ConstantPool _pool_holder InstanceKlass*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
54 |
"field InstanceKlass _methods Array<Method*>*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
55 |
"field InstanceKlass _constants ConstantPool*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
56 |
"field Klass _name Symbol*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
57 |
"field JavaThread _next JavaThread*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
58 |
"field JavaThread _osthread OSThread*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
59 |
"field JVMState _bci", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
60 |
"field TenuredGeneration _the_space ContiguousSpace*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
61 |
"field VirtualSpace _low_boundary char*", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
62 |
"field MethodCounters _backedge_counter InvocationCounter", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
63 |
"field nmethod _entry_bci int", |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
64 |
"field Universe _collectedHeap CollectedHeap")); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
65 |
test.run(theApp.getPid(), cmds, expStrMap, null); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
66 |
} catch (Exception ex) { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
67 |
throw new RuntimeException("Test ERROR " + ex, ex); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
68 |
} finally { |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
69 |
LingeredApp.stopApp(theApp); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
70 |
} |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
71 |
System.out.println("Test PASSED"); |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
72 |
} |
61a14b5cb1c6
8191538: SA: tests for clhsdb commands: vmstructsdump, field, symboltable and symbol
jgeorge
parents:
diff
changeset
|
73 |
} |