author | ihse |
Tue, 20 Feb 2018 21:47:54 +0100 | |
changeset 48923 | b75c9e2e3b1f |
parent 48160 | 599f67f3c6d6 |
child 49921 | b708a1e34fcc |
permissions | -rw-r--r-- |
48160
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
1 |
/* |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
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 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
32 |
/* |
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 |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
36 |
* @library /test/lib |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
37 |
* @run main/othervm ClhsdbJhisto |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
38 |
*/ |
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 |
public class ClhsdbJhisto { |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
41 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
42 |
public static void main(String[] args) throws Exception { |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
43 |
System.out.println("Starting ClhsdbJhisto test"); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
44 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
45 |
LingeredAppWithInterface theApp = null; |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
46 |
try { |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
47 |
ClhsdbLauncher test = new ClhsdbLauncher(); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
48 |
List<String> vmArgs = new ArrayList<String>(); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
49 |
vmArgs.addAll(Utils.getVmOptions()); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
50 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
51 |
theApp = new LingeredAppWithInterface(); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
52 |
LingeredApp.startApp(vmArgs, theApp); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
53 |
System.out.println("Started LingeredApp with pid " + theApp.getPid()); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
54 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
55 |
List<String> cmds = List.of("jhisto"); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
56 |
|
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
57 |
Map<String, List<String>> expStrMap = new HashMap<>(); |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
58 |
expStrMap.put("jhisto", List.of( |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
59 |
"java.lang.String", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
60 |
"java.util.HashMap", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
61 |
"java.lang.Class", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
62 |
"java.nio.HeapByteBuffer", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
63 |
"java.net.URI", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
64 |
"LingeredAppWithInterface", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
65 |
"ParselTongue", |
599f67f3c6d6
8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff
changeset
|
66 |
"ImmutableCollections$SetN$1")); |
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 |
} |