Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/use/use001/use001.java
40951 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/use/use001.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* A positive test case for the 'use [source file path]' command.
33
* The test checks if jdb correctly sets and shows source file path.
34
* Working directory is added to the current path using 'use' command
35
* with argument composed of old value and current working directory.
36
* The test passes if working directory is encountered in reply message
37
* returned by subsequent 'use' command.
38
* The test consists of two program:
39
* use001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
40
* use001a.java - the debugged application.
41
* COMMENTS
42
*
43
* @library /vmTestbase
44
* /test/lib
45
* @build nsk.jdb.use.use001.use001a
46
* @run main/othervm
47
* nsk.jdb.use.use001.use001
48
* -arch=${os.family}-${os.simpleArch}
49
* -waittime=5
50
* -debugee.vmkind=java
51
* -transport.address=dynamic
52
* -jdb=${test.jdk}/bin/jdb
53
* -java.options="${test.vm.opts} ${test.java.opts}"
54
* -workdir=.
55
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
56
*/
57
58
package nsk.jdb.use.use001;
59
60
import nsk.share.*;
61
import nsk.share.jdb.*;
62
import jdk.test.lib.Utils;
63
64
import java.io.*;
65
import java.util.*;
66
67
public class use001 extends JdbTest {
68
69
public static void main (String argv[]) {
70
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
71
}
72
73
public static int run(String argv[], PrintStream out) {
74
debuggeeClass = DEBUGGEE_CLASS;
75
firstBreak = FIRST_BREAK;
76
lastBreak = LAST_BREAK;
77
return new use001().runTest(argv, out);
78
}
79
80
static final String PACKAGE_NAME = "nsk.jdb.use.use001";
81
static final String TEST_CLASS = PACKAGE_NAME + ".use001";
82
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
83
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
84
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
85
86
protected void runCases() {
87
String[] reply;
88
Paragrep grep;
89
int count;
90
Vector v;
91
String found;
92
93
String path = "";
94
String srcdir = Utils.TEST_SRC;
95
96
// jdb.setBreakpointInMethod(LAST_BREAK);
97
// reply = jdb.receiveReplyFor(JdbCommand.cont);
98
99
while (true) {
100
reply = jdb.receiveReplyFor(JdbCommand.use);
101
/*
102
if (reply.length == 0) {
103
log.complain("Empty reply on first 'use' command");
104
success = false;
105
break;
106
}
107
*/
108
if (reply.length > 0) {
109
path = reply[0];
110
}
111
/*
112
grep = new Paragrep(reply);
113
count = grep.find(srcdir);
114
if (count == 0) {
115
log.complain("Not found current source directory in source file path");
116
success = false;
117
break;
118
}
119
*/
120
reply = jdb.receiveReplyFor(JdbCommand.use + srcdir + File.pathSeparator + path);
121
if (reply.length == 0) {
122
log.complain("Empty reply on third 'use' command");
123
success = false;
124
break;
125
}
126
127
reply = jdb.receiveReplyFor(JdbCommand.use);
128
grep = new Paragrep(reply);
129
if (grep.find(srcdir) == 0) {
130
log.complain("Current source directory should be in source file path");
131
success = false;
132
break;
133
}
134
135
break;
136
}
137
138
jdb.contToExit(1);
139
}
140
}
141
142