Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/classes/classes001/classes001.java
40952 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/classes/classes001.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* A positive test case for the 'classes' command.
33
* The test checks if jdb correctly replies on 'classes' command.
34
* The test passes when reply contains full names of all checked classes.
35
* COMMENTS
36
*
37
* @library /vmTestbase
38
* /test/lib
39
* @build nsk.jdb.classes.classes001.classes001a
40
* @run main/othervm
41
* nsk.jdb.classes.classes001.classes001
42
* -arch=${os.family}-${os.simpleArch}
43
* -waittime=5
44
* -debugee.vmkind=java
45
* -transport.address=dynamic
46
* -jdb=${test.jdk}/bin/jdb
47
* -java.options="${test.vm.opts} ${test.java.opts}"
48
* -workdir=.
49
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
50
*/
51
52
package nsk.jdb.classes.classes001;
53
54
import nsk.share.*;
55
import nsk.share.jdb.*;
56
57
import java.io.*;
58
import java.util.*;
59
60
public class classes001 extends JdbTest {
61
62
public static void main (String argv[]) {
63
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
64
}
65
66
public static int run(String argv[], PrintStream out) {
67
debuggeeClass = DEBUGGEE_CLASS;
68
firstBreak = FIRST_BREAK;
69
lastBreak = LAST_BREAK;
70
return new classes001().runTest(argv, out);
71
}
72
73
static final String PACKAGE_NAME = "nsk.jdb.classes.classes001";
74
static final String TEST_CLASS = PACKAGE_NAME + ".classes001";
75
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
76
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
77
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
78
static final String NOT_VALID_SAMPLE = "is not a valid";
79
80
static String[] checkedClasses = {
81
DEBUGGEE_CLASS,
82
DEBUGGEE_CLASS + "$Inner1",
83
DEBUGGEE_CLASS + "$Inner2",
84
DEBUGGEE_CLASS + "$Inner3",
85
DEBUGGEE_CLASS + "$Inner4",
86
DEBUGGEE_CLASS + "$Inner5",
87
DEBUGGEE_CLASS + "$Inner6",
88
DEBUGGEE_CLASS + "$Inner7",
89
DEBUGGEE_CLASS + "$Inner8",
90
DEBUGGEE_CLASS + "$InnerInt1",
91
DEBUGGEE_CLASS + "$InnerInt2",
92
DEBUGGEE_CLASS + "$InnerInt3",
93
DEBUGGEE_CLASS + "$InnerInt4",
94
DEBUGGEE_CLASS + "$InnerInt5",
95
PACKAGE_NAME + ".Outer1",
96
PACKAGE_NAME + ".Outer2",
97
PACKAGE_NAME + ".Outer3",
98
PACKAGE_NAME + ".OuterInt1",
99
PACKAGE_NAME + ".OuterInt2"
100
};
101
102
/* ------------------------------------- */
103
104
protected void runCases() {
105
String[] reply;
106
Paragrep grep;
107
int count;
108
Vector v;
109
String found;
110
111
jdb.setBreakpointInMethod(LAST_BREAK);
112
reply = jdb.receiveReplyFor(JdbCommand.cont);
113
114
reply = jdb.receiveReplyFor(JdbCommand.classes);
115
116
for (int i = 0; i < checkedClasses.length; i++) {
117
if (!checkClass(checkedClasses[i], reply)) {
118
success = false;
119
}
120
}
121
122
jdb.contToExit(1);
123
}
124
125
private boolean checkClass (String className, String[] reply) {
126
Paragrep grep;
127
String found;
128
boolean result = true;
129
130
grep = new Paragrep(reply);
131
found = grep.findFirst(className);
132
if (found.length() == 0) {
133
log.complain("Failed to report class " + className);
134
result = false;
135
}
136
return result;
137
}
138
}
139
140