author | goetz |
Fri, 20 Jul 2018 09:46:57 +0200 | |
changeset 51214 | 67736b4846a0 |
parent 50791 | b1e90a8a876c |
child 53513 | 8c035b34248d |
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 |
/* |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
47918
diff
changeset
|
2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
47899
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.ArrayList; |
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.HashMap; |
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.List; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
27 |
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
|
28 |
|
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.apps.LingeredApp; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
30 |
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
|
31 |
import jdk.test.lib.Utils; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
32 |
|
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
47918
diff
changeset
|
33 |
/** |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
34 |
* @test |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
35 |
* @bug 8190198 |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
36 |
* @summary Test clhsdb flags command |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
47918
diff
changeset
|
37 |
* @requires vm.hasSA |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
38 |
* @library /test/lib |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
39 |
* @run main/othervm ClhsdbFlags |
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 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
42 |
public class ClhsdbFlags { |
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 |
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
|
45 |
System.out.println("Starting ClhsdbFlags test"); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
46 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
47 |
LingeredApp theApp = null; |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
48 |
try { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
49 |
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
|
50 |
List<String> vmArgs = new ArrayList<String>(); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
51 |
vmArgs.add("-XX:+UnlockExperimentalVMOptions"); |
47918
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
52 |
vmArgs.add("-XX:+UnlockDiagnosticVMOptions"); |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
53 |
vmArgs.add("-XX:-MaxFDLimit"); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
54 |
vmArgs.addAll(Utils.getVmOptions()); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
55 |
theApp = LingeredApp.startApp(vmArgs); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
56 |
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
|
57 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
58 |
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
|
59 |
"flags", "flags -nd", |
47918
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
60 |
"flags UnlockDiagnosticVMOptions", "flags MaxFDLimit", |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
61 |
"flags MaxJavaStackTraceDepth"); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
62 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
63 |
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
|
64 |
expStrMap.put("flags", List.of( |
47918
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
65 |
"UnlockDiagnosticVMOptions = true", |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
66 |
"MaxFDLimit = false", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
67 |
"MaxJavaStackTraceDepth = 1024", |
47918
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
68 |
"VerifyMergedCPBytecodes", |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
69 |
"ConcGCThreads", "UseThreadPriorities", |
47918
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
70 |
"ShowHiddenFrames")); |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
71 |
expStrMap.put("flags -nd", List.of( |
47918
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
72 |
"UnlockDiagnosticVMOptions = true", |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
73 |
"MaxFDLimit = false", |
47918
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
74 |
"InitialHeapSize", |
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
75 |
"MaxHeapSize")); |
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
76 |
expStrMap.put("flags UnlockDiagnosticVMOptions", List.of( |
a82c9f231737
8191401: [TESTBUG] serviceability/sa/ClhsdbFlags.java can fail due to UseJVMCICompiler
sballal
parents:
47899
diff
changeset
|
77 |
"UnlockDiagnosticVMOptions = true")); |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
78 |
expStrMap.put("flags MaxFDLimit", List.of( |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
79 |
"MaxFDLimit = false")); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
80 |
expStrMap.put("flags MaxJavaStackTraceDepth", List.of( |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
81 |
"MaxJavaStackTraceDepth = 1024")); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
82 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
83 |
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
|
84 |
} catch (Exception ex) { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
85 |
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
|
86 |
} finally { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
87 |
LingeredApp.stopApp(theApp); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
88 |
} |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
89 |
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
|
90 |
} |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
91 |
} |