Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/serviceability/sa/ClhsdbSource.java
41149 views
1
/*
2
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
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
import jtreg.SkippedException;
33
34
/**
35
* @test
36
* @bug 8192823
37
* @summary Test clhsdb source command
38
* @requires vm.hasSA
39
* @library /test/lib
40
* @run main/othervm ClhsdbSource
41
*/
42
43
public class ClhsdbSource {
44
45
public static void main(String[] args) throws Exception {
46
System.out.println("Starting ClhsdbSource test");
47
48
LingeredApp theApp = null;
49
try {
50
ClhsdbLauncher test = new ClhsdbLauncher();
51
theApp = LingeredApp.startApp();
52
System.out.println("Started LingeredApp with pid " + theApp.getPid());
53
54
Path file = Paths.get("clhsdb_cmd_file");
55
Files.write(file, "jstack -v\nhelp".getBytes());
56
List<String> cmds = List.of("source clhsdb_cmd_file");
57
58
Map<String, List<String>> expStrMap = new HashMap<>();
59
expStrMap.put("source clhsdb_cmd_file", List.of(
60
"No deadlocks found",
61
"Common\\-Cleaner",
62
"Signal Dispatcher",
63
"java.lang.ref.Finalizer\\$FinalizerThread.run",
64
"java.lang.ref.Reference",
65
"Method\\*",
66
"LingeredApp.steadyState",
67
"Available commands:",
68
"attach pid \\| exec core",
69
"intConstant \\[ name \\[ value \\] \\]",
70
"type \\[ type \\[ name super isOop isInteger isUnsigned size \\] \\]"));
71
72
Map<String, List<String>> unExpStrMap = new HashMap<>();
73
unExpStrMap.put("source clhsdb_cmd_file", List.of(
74
"No such file or directory"));
75
76
test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
77
Files.delete(file);
78
} catch (SkippedException se) {
79
throw se;
80
} catch (Exception ex) {
81
throw new RuntimeException("Test ERROR " + ex, ex);
82
} finally {
83
LingeredApp.stopApp(theApp);
84
}
85
System.out.println("Test PASSED");
86
}
87
}
88
89