author | goetz |
Mon, 25 Jun 2018 23:04:21 +0200 | |
changeset 50791 | b1e90a8a876c |
parent 49921 | b708a1e34fcc |
child 52797 | 55a05ed55768 |
permissions | -rw-r--r-- |
48160
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
1 |
/* |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
49921
diff
changeset
|
2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
48160
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
4 |
* |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
8 |
* |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
13 |
* accompanied this code). |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
14 |
* |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
18 |
* |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
21 |
* questions. |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
22 |
*/ |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
23 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
24 |
import java.util.ArrayList; |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
25 |
import java.util.HashMap; |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
26 |
import java.util.List; |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
27 |
import java.util.Map; |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
28 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
29 |
import jdk.test.lib.apps.LingeredApp; |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
30 |
import jdk.test.lib.Utils; |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
31 |
|
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
49921
diff
changeset
|
32 |
/** |
48160
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
33 |
* @test |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
34 |
* @bug 8191658 |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
35 |
* @summary Test clhsdb jhisto command |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
49921
diff
changeset
|
36 |
* @requires vm.hasSA |
48160
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
37 |
* @library /test/lib |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
38 |
* @run main/othervm ClhsdbJhisto |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
39 |
*/ |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
40 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
41 |
public class ClhsdbJhisto { |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
42 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
43 |
public static void main(String[] args) throws Exception { |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
44 |
System.out.println("Starting ClhsdbJhisto test"); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
45 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
46 |
LingeredAppWithInterface theApp = null; |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
47 |
try { |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
48 |
ClhsdbLauncher test = new ClhsdbLauncher(); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
49 |
List<String> vmArgs = new ArrayList<String>(); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
50 |
vmArgs.addAll(Utils.getVmOptions()); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
51 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
52 |
theApp = new LingeredAppWithInterface(); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
53 |
LingeredApp.startApp(vmArgs, theApp); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
54 |
System.out.println("Started LingeredApp with pid " + theApp.getPid()); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
55 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
56 |
List<String> cmds = List.of("jhisto"); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
57 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
58 |
Map<String, List<String>> expStrMap = new HashMap<>(); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
59 |
expStrMap.put("jhisto", List.of( |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
60 |
"java.lang.String", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
61 |
"java.util.HashMap", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
62 |
"java.lang.Class", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
63 |
"java.nio.HeapByteBuffer", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
64 |
"java.net.URI", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
65 |
"LingeredAppWithInterface", |
49921
b708a1e34fcc
8202417: [TESTBUG] Broken hard-coded dependency in serviceability/sa/ClhsdbJhisto.java
redestad
parents:
48160
diff
changeset
|
66 |
"ParselTongue")); |
48160
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
67 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
68 |
test.run(theApp.getPid(), cmds, expStrMap, null); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
69 |
} catch (Exception ex) { |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
70 |
throw new RuntimeException("Test ERROR " + ex, ex); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
71 |
} finally { |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
72 |
LingeredApp.stopApp(theApp); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
73 |
} |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
74 |
System.out.println("Test PASSED"); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
75 |
} |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
76 |
} |