author | coleenp |
Tue, 03 Jul 2018 13:41:18 -0400 | |
changeset 50929 | ef57cfcd22ff |
parent 50791 | b1e90a8a876c |
child 53596 | bb40a5303c84 |
permissions | -rw-r--r-- |
48296 | 1 |
/* |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48296
diff
changeset
|
2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
48296 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
import java.nio.file.Files; |
|
25 |
import java.nio.file.Path; |
|
26 |
import java.nio.file.Paths; |
|
27 |
import java.util.HashMap; |
|
28 |
import java.util.List; |
|
29 |
import java.util.Map; |
|
30 |
||
31 |
import jdk.test.lib.apps.LingeredApp; |
|
32 |
||
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48296
diff
changeset
|
33 |
/** |
48296 | 34 |
* @test |
35 |
* @bug 8192823 |
|
36 |
* @summary Test clhsdb source command |
|
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48296
diff
changeset
|
37 |
* @requires vm.hasSA |
48296 | 38 |
* @library /test/lib |
39 |
* @run main/othervm ClhsdbSource |
|
40 |
*/ |
|
41 |
||
42 |
public class ClhsdbSource { |
|
43 |
||
44 |
public static void main(String[] args) throws Exception { |
|
45 |
System.out.println("Starting ClhsdbSource test"); |
|
46 |
||
47 |
LingeredApp theApp = null; |
|
48 |
try { |
|
49 |
ClhsdbLauncher test = new ClhsdbLauncher(); |
|
50 |
theApp = LingeredApp.startApp(); |
|
51 |
System.out.println("Started LingeredApp with pid " + theApp.getPid()); |
|
52 |
||
53 |
Path file = Paths.get("clhsdb_cmd_file"); |
|
54 |
Files.write(file, "jstack -v\nhelp".getBytes()); |
|
55 |
List<String> cmds = List.of("source clhsdb_cmd_file"); |
|
56 |
||
57 |
Map<String, List<String>> expStrMap = new HashMap<>(); |
|
58 |
expStrMap.put("source clhsdb_cmd_file", List.of( |
|
59 |
"No deadlocks found", |
|
60 |
"Common-Cleaner", |
|
61 |
"Signal Dispatcher", |
|
62 |
"java.lang.ref.Finalizer$FinalizerThread.run", |
|
63 |
"java.lang.ref.Reference", |
|
64 |
"Method*", |
|
65 |
"LingeredApp.main", |
|
66 |
"Available commands:", |
|
67 |
"attach pid | exec core", |
|
68 |
"intConstant [ name [ value ] ]", |
|
50929
ef57cfcd22ff
8205534: Remove SymbolTable dependency from serviceability agent
coleenp
parents:
50791
diff
changeset
|
69 |
"type [ type [ name super isOop isInteger isUnsigned size ] ]")); |
48296 | 70 |
|
71 |
Map<String, List<String>> unExpStrMap = new HashMap<>(); |
|
72 |
unExpStrMap.put("source clhsdb_cmd_file", List.of( |
|
73 |
"No such file or directory")); |
|
74 |
||
75 |
test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap); |
|
76 |
Files.delete(file); |
|
77 |
} catch (Exception ex) { |
|
78 |
throw new RuntimeException("Test ERROR " + ex, ex); |
|
79 |
} finally { |
|
80 |
LingeredApp.stopApp(theApp); |
|
81 |
} |
|
82 |
System.out.println("Test PASSED"); |
|
83 |
} |
|
84 |
} |