author | cjplummer |
Sat, 24 Mar 2018 13:39:07 -0700 | |
changeset 49596 | 82df30792530 |
parent 48421 | 240933cf3758 |
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 |
/* |
49596
82df30792530
8198655: test/lib/jdk/test/lib/apps/LingeredApp shouldn't inherit cout/cerr
cjplummer
parents:
48421
diff
changeset
|
2 |
* Copyright (c) 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.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 symboldump 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 ClhsdbSymbol |
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 ClhsdbSymbol { |
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 ClhsdbSymbol 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("symboldump"); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
51 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
52 |
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
|
53 |
expStrMap.put("symboldump", List.of( |
48421
240933cf3758
8193428: serviceability/sa/ClhsdbSymbol.java fails: java.lang.RuntimeException: 'UsageTracker' missing from stdout/stderr
sballal
parents:
47899
diff
changeset
|
54 |
"java/lang/String", "java/util/HashMap", |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
55 |
"Ljava/io/InputStream", "LambdaMetafactory", "PerfCounter", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
56 |
"isAnonymousClass", "JVMTI_THREAD_STATE_TERMINATED", "jdi", |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
57 |
"checkGetClassLoaderPermission", "lockCreationTime", |
49596
82df30792530
8198655: test/lib/jdk/test/lib/apps/LingeredApp shouldn't inherit cout/cerr
cjplummer
parents:
48421
diff
changeset
|
58 |
"stderrBuffer", "stdoutBuffer", "getProcess", |
47899
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
59 |
"LingeredApp")); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
60 |
|
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
61 |
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
|
62 |
} catch (Exception ex) { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
63 |
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
|
64 |
} finally { |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
65 |
LingeredApp.stopApp(theApp); |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
66 |
} |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
67 |
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
|
68 |
} |
f113d1ef7bed
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff
changeset
|
69 |
} |