author | ihse |
Tue, 20 Feb 2018 21:47:54 +0100 | |
changeset 48923 | b75c9e2e3b1f |
parent 48420 | b54852746e8f |
child 50791 | b1e90a8a876c |
permissions | -rw-r--r-- |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
1 |
/* |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
4 |
* |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
8 |
* |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
13 |
* accompanied this code). |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
14 |
* |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
18 |
* |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
21 |
* questions. |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
22 |
*/ |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
23 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
24 |
import java.util.HashMap; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
25 |
import java.util.List; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
26 |
import java.util.Map; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
27 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
28 |
import jdk.test.lib.apps.LingeredApp; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
29 |
import jdk.test.lib.Platform; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
30 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
31 |
/* |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
32 |
* @test |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
33 |
* @bug 8190198 |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
34 |
* @summary Test clhsdb printstatics command |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
35 |
* @library /test/lib |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
36 |
* @run main/othervm ClhsdbPrintStatics |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
37 |
*/ |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
38 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
39 |
public class ClhsdbPrintStatics { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
40 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
41 |
public static void main(String[] args) throws Exception { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
42 |
System.out.println("Starting ClhsdbPrintStatics test"); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
43 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
44 |
LingeredApp theApp = null; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
45 |
try { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
46 |
ClhsdbLauncher test = new ClhsdbLauncher(); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
47 |
theApp = LingeredApp.startApp(); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
48 |
System.out.println("Started LingeredApp with pid " + theApp.getPid()); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
49 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
50 |
List<String> cmds = List.of( |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
51 |
"printstatics", "printstatics SystemDictionary", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
52 |
"printstatics Threads", "printstatics Universe", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
53 |
"printstatics JvmtiExport"); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
54 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
55 |
Map<String, List<String>> expStrMap = new HashMap<>(); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
56 |
expStrMap.put("printstatics", List.of( |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
57 |
"All known static fields", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
58 |
"Abstract_VM_Version::_vm_major_version", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
59 |
"ClassLoaderDataGraph::_head", "SymbolTable::_the_table", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
60 |
"JNIHandles::_weak_global_handles", "PerfMemory::_top", |
48420
b54852746e8f
8193427: serviceability/sa/ClhsdbPrintStatics.java fails: java.lang.RuntimeException: '_jfr_checkpoints' missing from stdout/stderr
sballal
parents:
47899
diff
changeset
|
61 |
"ObjectSynchronizer::gBlockList", |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
62 |
"java_lang_Class::_oop_size_offset", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
63 |
"CodeCache::_scavenge_root_nmethods")); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
64 |
expStrMap.put("printstatics SystemDictionary", List.of( |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
65 |
"Static fields of SystemDictionary", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
66 |
"SystemDictionary::Class_klass_knum", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
67 |
"SystemDictionary::ClassLoader_klass_knum", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
68 |
"SystemDictionary::Object_klass_knum")); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
69 |
expStrMap.put("printstatics Threads", List.of( |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
70 |
"Static fields of Threads", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
71 |
"_number_of_threads", "_number_of_non_daemon_threads", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
72 |
"JavaThread* Threads")); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
73 |
expStrMap.put("printstatics Universe", List.of( |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
74 |
"Static fields of Universe", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
75 |
"uintptr_t Universe::_verify_oop_mask", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
76 |
"intptr_t Universe::_non_oop_bits", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
77 |
"bool Universe::_fully_initialized", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
78 |
"Universe::_doubleArrayKlassObj")); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
79 |
expStrMap.put("printstatics JvmtiExport", List.of( |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
80 |
"Static fields of JvmtiExport", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
81 |
"bool JvmtiExport::_can_access_local_variables", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
82 |
"bool JvmtiExport::_can_hotswap_or_post_breakpoint", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
83 |
"bool JvmtiExport::_can_post_on_exceptions")); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
84 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
85 |
test.run(theApp.getPid(), cmds, expStrMap, null); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
86 |
} catch (Exception ex) { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
87 |
throw new RuntimeException("Test ERROR " + ex, ex); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
88 |
} finally { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
89 |
LingeredApp.stopApp(theApp); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
90 |
} |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
91 |
System.out.println("Test PASSED"); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
92 |
} |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
93 |
} |