Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/threads/threads002/threads002.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/threads/threads002.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* This is a test for jdb 'threads' command.
33
* The debugee starts 5 'MyThreads' that are all suspended on the lock
34
* that the main thread posseses. The 'threads' command is issued
35
* at this point. The test passes if 5 suspended 'MyThreads' are reported.
36
* COMMENTS
37
* This test functionally equals to nsk/jdb/threads/threads001 test
38
* and replaces it.
39
*
40
* @library /vmTestbase
41
* /test/lib
42
* @build nsk.jdb.threads.threads002.threads002a
43
* @run main/othervm
44
* nsk.jdb.threads.threads002.threads002
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.threads.threads002;
56
57
import nsk.share.*;
58
import nsk.share.jdb.*;
59
60
import java.io.*;
61
import java.util.*;
62
63
public class threads002 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 threads002().runTest(argv, out);
74
}
75
76
static final String PACKAGE_NAME = "nsk.jdb.threads.threads002";
77
static final String TEST_CLASS = PACKAGE_NAME + ".threads002";
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
82
static final String THREAD_NAME = PACKAGE_NAME + ".MyThread";
83
84
protected void runCases() {
85
String[] reply;
86
Paragrep grep;
87
int count;
88
Vector v;
89
String found;
90
91
jdb.setBreakpointInMethod(LAST_BREAK);
92
jdb.receiveReplyFor(JdbCommand.cont);
93
94
reply = jdb.receiveReplyFor(JdbCommand.threads);
95
grep = new Paragrep(reply);
96
count = grep.find(THREAD_NAME);
97
if (count != threads002a.numThreads ) {
98
failure("Unexpected number of " + THREAD_NAME + " was listed: " + count +
99
"\n\texpected value: " + threads002a.numThreads);
100
}
101
102
jdb.contToExit(1);
103
}
104
}
105
106