Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/fields/fields001/fields001.java
40955 views
1
/*
2
* Copyright (c) 2002, 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
25
/*
26
* @test
27
*
28
* @summary converted from VM Testbase nsk/jdb/fields/fields001.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* A positive test for the 'fields <class id>' command.
33
* There are three test cases:
34
* - request for the fields defined in class,
35
* - request for the fields defined in inner class,
36
* - request for the fields inherited from super class.
37
* The test passes when reply contains names of all checked fields
38
* for a given debuggee's class.
39
* COMMENTS
40
*
41
* @library /vmTestbase
42
* /test/lib
43
* @build nsk.jdb.fields.fields001.fields001a
44
* @run main/othervm
45
* nsk.jdb.fields.fields001.fields001
46
* -arch=${os.family}-${os.simpleArch}
47
* -waittime=5
48
* -debugee.vmkind=java
49
* -transport.address=dynamic
50
* -jdb=${test.jdk}/bin/jdb
51
* -java.options="${test.vm.opts} ${test.java.opts}"
52
* -workdir=.
53
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
54
*/
55
56
package nsk.jdb.fields.fields001;
57
58
import nsk.share.*;
59
import nsk.share.jdb.*;
60
61
import java.io.*;
62
import java.util.*;
63
64
public class fields001 extends JdbTest {
65
66
public static void main (String argv[]) {
67
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
68
}
69
70
public static int run(String argv[], PrintStream out) {
71
debuggeeClass = DEBUGGEE_CLASS;
72
firstBreak = FIRST_BREAK;
73
lastBreak = LAST_BREAK;
74
return new fields001().runTest(argv, out);
75
}
76
77
static final String PACKAGE_NAME = "nsk.jdb.fields.fields001";
78
static final String TEST_CLASS = PACKAGE_NAME + ".fields001";
79
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
80
static final String DEBUGGEE_CLASS1 = DEBUGGEE_CLASS + "$Inner";
81
static final String DEBUGGEE_CLASS2 = DEBUGGEE_CLASS + "$Extender";
82
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
83
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
84
static final String NOT_VALID_SAMPLE = "is not a valid";
85
86
static String[] checkedFields1 = {
87
"i_st", "o_st",
88
"i_pv", "o_pv",
89
"i_pt", "o_pt",
90
"i_pb", "o_pb",
91
"i_fn", "o_fn",
92
"i_tr", "o_tr",
93
"i_vl", "o_vl",
94
"i_a", "o_a",
95
"i_aa", "o_aa",
96
"i_aaa", "o_aaa"
97
};
98
99
static String[] checkedFields2 = {
100
"ii_pv", "oi_pv",
101
"ii_pt", "oi_pt",
102
"ii_pb", "oi_pb",
103
"ii_fn", "oi_fn",
104
"ii_tr", "oi_tr",
105
"ii_vl", "oi_vl",
106
"ii_a", "oi_a",
107
"ii_aa", "oi_aa",
108
"ii_aaa", "oi_aaa"
109
};
110
111
protected void runCases() {
112
String[] reply;
113
Paragrep grep;
114
int count;
115
Vector v;
116
String found;
117
118
jdb.setBreakpointInMethod(LAST_BREAK);
119
reply = jdb.receiveReplyFor(JdbCommand.cont);
120
121
reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS);
122
if (!checkFields(DEBUGGEE_CLASS, reply, checkedFields1)) {
123
success = false;
124
}
125
126
reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS1);
127
if (!checkFields(DEBUGGEE_CLASS1, reply, checkedFields2)) {
128
success = false;
129
}
130
131
reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS2);
132
if (!checkFields(DEBUGGEE_CLASS2, reply, checkedFields2)) {
133
success = false;
134
}
135
136
jdb.contToExit(1);
137
}
138
139
private boolean checkFields (String className, String[] reply, String[] checkedFields) {
140
Paragrep grep;
141
String found;
142
boolean result = true;
143
int count;
144
145
grep = new Paragrep(reply);
146
for (int i = 0; i < checkedFields.length; i++) {
147
count = grep.find(checkedFields[i]);
148
if (count == 0) {
149
log.complain("Failed to report field " + checkedFields[i] + " for class " + className);
150
result = false;
151
}
152
}
153
return result;
154
}
155
}
156
157