Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/serviceability/sa/ClhsdbFlags.java
41152 views
1
/*
2
* Copyright (c) 2017, 2020, 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.util.HashMap;
25
import java.util.List;
26
import java.util.Map;
27
28
import jdk.test.lib.apps.LingeredApp;
29
import jdk.test.lib.Utils;
30
import jtreg.SkippedException;
31
32
/**
33
* @test
34
* @bug 8190198
35
* @bug 8217612
36
* @bug 8217845
37
* @summary Test clhsdb flags command
38
* @requires vm.hasSA
39
* @library /test/lib
40
* @run main/othervm ClhsdbFlags
41
*/
42
43
public class ClhsdbFlags {
44
45
public static void runBasicTest() throws Exception {
46
System.out.println("Starting ClhsdbFlags basic test");
47
48
LingeredApp theApp = null;
49
try {
50
ClhsdbLauncher test = new ClhsdbLauncher();
51
theApp = LingeredApp.startApp(
52
"-XX:+UnlockExperimentalVMOptions",
53
"-XX:+UnlockDiagnosticVMOptions",
54
"-XX:-MaxFDLimit");
55
System.out.println("Started LingeredApp with pid " + theApp.getPid());
56
57
List<String> cmds = List.of(
58
"flags", "flags -nd",
59
"flags UnlockDiagnosticVMOptions", "flags MaxFDLimit",
60
"flags MaxJavaStackTraceDepth");
61
62
Map<String, List<String>> expStrMap = new HashMap<>();
63
expStrMap.put("flags", List.of(
64
"command line", "ergonomic", "default",
65
"UnlockDiagnosticVMOptions = true",
66
"MaxFDLimit = false",
67
"MaxJavaStackTraceDepth = 1024",
68
"ConcGCThreads", "UseThreadPriorities",
69
"ShowHiddenFrames"));
70
expStrMap.put("flags -nd", List.of(
71
"UnlockDiagnosticVMOptions = true",
72
"MaxFDLimit = false",
73
"InitialHeapSize",
74
"MaxHeapSize"));
75
expStrMap.put("flags UnlockDiagnosticVMOptions", List.of(
76
"UnlockDiagnosticVMOptions = true"));
77
expStrMap.put("flags MaxFDLimit", List.of(
78
"MaxFDLimit = false"));
79
expStrMap.put("flags MaxJavaStackTraceDepth", List.of(
80
"MaxJavaStackTraceDepth = 1024"));
81
82
test.run(theApp.getPid(), cmds, expStrMap, null);
83
} catch (SkippedException se) {
84
throw se;
85
} catch (Exception ex) {
86
throw new RuntimeException("Test ERROR " + ex, ex);
87
} finally {
88
LingeredApp.stopApp(theApp);
89
}
90
System.out.println("Test PASSED");
91
}
92
93
public static void runAllTypesTest() throws Exception {
94
System.out.println("Starting ClhsdbFlags all types test");
95
96
LingeredApp theApp = null;
97
try {
98
ClhsdbLauncher test = new ClhsdbLauncher();
99
// *Prepend* options to prevent interference with flags below
100
String[] vmArgs = Utils.prependTestJavaOpts(
101
"-XX:+UnlockDiagnosticVMOptions", // bool
102
"-XX:ActiveProcessorCount=1", // int
103
"-XX:ParallelGCThreads=1", // uint
104
"-XX:MaxJavaStackTraceDepth=1024", // intx
105
"-XX:LogEventsBufferEntries=10", // uintx
106
"-XX:HeapSizePerGCThread=32m", // size_t
107
"-XX:NativeMemoryTracking=off", // ccstr
108
"-XX:OnError='echo error'", // ccstrlist
109
"-XX:CompileThresholdScaling=1.0", // double
110
"-XX:ErrorLogTimeout=120"); // uint64_t
111
theApp = new LingeredApp();
112
LingeredApp.startAppExactJvmOpts(theApp, vmArgs);
113
System.out.println("Started LingeredApp with pid " + theApp.getPid());
114
115
List<String> cmds = List.of("flags");
116
117
Map<String, List<String>> expStrMap = new HashMap<>();
118
expStrMap.put("flags", List.of(
119
"UnlockDiagnosticVMOptions = true",
120
"ActiveProcessorCount = 1",
121
"ParallelGCThreads = 1",
122
"MaxJavaStackTraceDepth = 1024",
123
"LogEventsBufferEntries = 10",
124
"HeapSizePerGCThread = 3",
125
"NativeMemoryTracking = \"off\"",
126
"OnError = \"'echo error'\"",
127
"CompileThresholdScaling = 1.0",
128
"ErrorLogTimeout = 120"));
129
130
test.run(theApp.getPid(), cmds, expStrMap, null);
131
} catch (Exception ex) {
132
throw new RuntimeException("Test ERROR " + ex, ex);
133
} finally {
134
LingeredApp.stopApp(theApp);
135
}
136
System.out.println("Test PASSED");
137
}
138
139
public static void main(String[] args) throws Exception {
140
runBasicTest();
141
runAllTypesTest();
142
}
143
}
144
145