Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/serviceability/sa/TestIntConstant.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.util.ArrayList;
25
import java.util.List;
26
import jdk.test.lib.apps.LingeredApp;
27
import jdk.test.lib.Utils;
28
import java.util.Map;
29
import java.util.HashMap;
30
import jtreg.SkippedException;
31
32
/**
33
* @test
34
* @summary Test the 'intConstant' command of jhsdb clhsdb.
35
* @bug 8190307
36
* @requires vm.hasSA
37
* @library /test/lib
38
* @build jdk.test.lib.apps.*
39
* @run main/othervm TestIntConstant
40
*/
41
42
public class TestIntConstant {
43
44
public static void main (String... args) throws Exception {
45
System.out.println("Starting TestIntConstant test");
46
LingeredApp app = null;
47
try {
48
ClhsdbLauncher test = new ClhsdbLauncher();
49
50
app = LingeredApp.startApp();
51
52
System.out.println ("Started LingeredApp with pid " + app.getPid());
53
54
List<String> cmds = List.of("intConstant",
55
"intConstant _temp_constant 45",
56
"intConstant _temp_constant");
57
58
Map<String, List<String>> expStrMap = new HashMap<>();
59
60
// Strings to check for in the output of 'intConstant'. The
61
// 'intConstant' command prints out entries from the
62
// 'gHotSpotVMIntConstants', which is a table of integer constants,
63
// with names and the values derived from enums and #define preprocessor
64
// macros in hotspot.
65
expStrMap.put("intConstant", List.of(
66
"CollectedHeap::G1 3",
67
"RUNNABLE 2",
68
"Deoptimization::Reason_class_check 4",
69
"_thread_uninitialized 0"));
70
expStrMap.put("intConstant _temp_constant", List.of(
71
"intConstant _temp_constant 45"));
72
test.run(app.getPid(), cmds, expStrMap, null);
73
} catch (SkippedException se) {
74
throw se;
75
} catch (Exception ex) {
76
throw new RuntimeException("Test ERROR " + ex, ex);
77
} finally {
78
LingeredApp.stopApp(app);
79
}
80
System.out.println("Test PASSED");
81
}
82
}
83
84