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