author | iignatyev |
Wed, 30 May 2018 20:54:45 -0700 | |
changeset 50317 | cf71bff5f533 |
permissions | -rw-r--r-- |
50317
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
1 |
/* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
4 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
8 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
13 |
* accompanied this code). |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
14 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
18 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
21 |
* questions. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
22 |
*/ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
23 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
24 |
package nsk.jdwp.ThreadGroupReference.Parent; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
25 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
26 |
import java.io.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
27 |
import java.util.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
28 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
29 |
import nsk.share.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
30 |
import nsk.share.jpda.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
31 |
import nsk.share.jdwp.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
32 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
33 |
public class parent001 { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
34 |
static final int JCK_STATUS_BASE = 95; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
35 |
static final int PASSED = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
36 |
static final int FAILED = 2; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
37 |
static final String PACKAGE_NAME = "nsk.jdwp.ThreadGroupReference.Parent"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
38 |
static final String TEST_CLASS_NAME = PACKAGE_NAME + "." + "parent001"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
39 |
static final String DEBUGEE_CLASS_NAME = TEST_CLASS_NAME + "a"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
40 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
41 |
static final String JDWP_COMMAND_NAME = "ThreadGroupReference.Parent"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
42 |
static final int JDWP_COMMAND_ID = JDWP.Command.ThreadGroupReference.Parent; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
43 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
44 |
public static void main (String argv[]) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
45 |
System.exit(run(argv,System.out) + JCK_STATUS_BASE); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
46 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
47 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
48 |
public static int run(String argv[], PrintStream out) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
49 |
return new parent001().runIt(argv, out); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
50 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
51 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
52 |
public int runIt(String argv[], PrintStream out) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
53 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
54 |
boolean success = true; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
55 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
56 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
57 |
ArgumentHandler argumentHandler = new ArgumentHandler(argv); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
58 |
Log log = new Log(out, argumentHandler); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
59 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
60 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
61 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
62 |
Binder binder = new Binder(argumentHandler, log); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
63 |
log.display("Start debugee VM"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
64 |
Debugee debugee = binder.bindToDebugee(DEBUGEE_CLASS_NAME); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
65 |
Transport transport = debugee.getTransport(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
66 |
IOPipe pipe = debugee.createIOPipe(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
67 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
68 |
log.display("Waiting for VM_INIT event"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
69 |
debugee.waitForVMInit(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
70 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
71 |
log.display("Querying for IDSizes"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
72 |
debugee.queryForIDSizes(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
73 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
74 |
log.display("Resume debugee VM"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
75 |
debugee.resume(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
76 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
77 |
log.display("Waiting for command: " + "ready"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
78 |
String cmd = pipe.readln(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
79 |
log.display("Received command: " + cmd); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
80 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
81 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
82 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
83 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
84 |
// get top level thread groups |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
85 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
86 |
log.display("Getting IDs for top level thread groups"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
87 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
88 |
long[] threadGroupIDs = null; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
89 |
int groups = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
90 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
91 |
{ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
92 |
log.display("Create command packet " + "TopLevelThreadGroups"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
93 |
CommandPacket command = new CommandPacket(JDWP.Command.VirtualMachine.TopLevelThreadGroups); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
94 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
95 |
log.display("Waiting for reply to command"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
96 |
ReplyPacket reply = debugee.receiveReplyFor(command); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
97 |
log.display("Valid reply packet received"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
98 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
99 |
log.display("Parsing reply packet:"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
100 |
reply.resetPosition(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
101 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
102 |
groups = reply.getInt(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
103 |
log.display(" groups: " + groups); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
104 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
105 |
threadGroupIDs = new long[groups]; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
106 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
107 |
for (int i = 0; i < groups; i++) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
108 |
long threadGroupID = reply.getObjectID(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
109 |
log.display(" " + i + " threadGroupID: " + threadGroupID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
110 |
threadGroupIDs[i] = threadGroupID; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
111 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
112 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
113 |
if (groups < 0) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
114 |
log.complain("Negative number of thread groups returned while getting top level thread groups IDs: " + groups); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
115 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
116 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
117 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
118 |
if (groups == 0) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
119 |
log.complain("No thread groups IDs returned while getting top level thread groups IDs: " + groups); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
120 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
121 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
122 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
123 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
124 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
125 |
// begin test of JDWP command |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
126 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
127 |
for (int i = 0; i < groups; i++) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
128 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
129 |
long threadGroupID = threadGroupIDs[i]; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
130 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
131 |
log.display("Getting name for " + i + " group ID: " |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
132 |
+ threadGroupID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
133 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
134 |
log.display("Create command " + JDWP_COMMAND_NAME |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
135 |
+ " with thread group ID: " + threadGroupID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
136 |
CommandPacket command = new CommandPacket(JDWP_COMMAND_ID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
137 |
command.addObjectID(threadGroupID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
138 |
command.setLength(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
139 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
140 |
log.display("Sending command packet:\n" + command); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
141 |
transport.write(command); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
142 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
143 |
log.display("Waiting for reply packet"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
144 |
ReplyPacket reply = new ReplyPacket(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
145 |
transport.read(reply); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
146 |
log.display("Reply packet received:\n" + reply); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
147 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
148 |
log.display("Checking reply packet header"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
149 |
reply.checkHeader(command.getPacketID()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
150 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
151 |
log.display("Parsing reply packet:"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
152 |
reply.resetPosition(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
153 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
154 |
long parentGroup = reply.getObjectID(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
155 |
log.display(" parentGroup: " + parentGroup); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
156 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
157 |
if (parentGroup != 0) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
158 |
log.complain("Nonzero ThreadGroupID of parent thread group returned for top-level thread group"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
159 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
160 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
161 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
162 |
if (! reply.isParsed()) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
163 |
log.complain("Extra trailing bytes found in reply packet at: " + reply.currentPosition()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
164 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
165 |
} else { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
166 |
log.display("Reply packet parsed successfully"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
167 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
168 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
169 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
170 |
// end test of JDWP command |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
171 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
172 |
} catch (Exception e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
173 |
log.complain("Caught exception while testing JDWP command: " + e); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
174 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
175 |
} finally { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
176 |
log.display("Sending command: " + "quit"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
177 |
pipe.println("quit"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
178 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
179 |
log.display("Waiting for debugee exits"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
180 |
int code = debugee.waitFor(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
181 |
if (code == JCK_STATUS_BASE + PASSED) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
182 |
log.display("Debugee PASSED with exit code: " + code); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
183 |
} else { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
184 |
log.complain("Debugee FAILED with exit code: " + code); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
185 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
186 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
187 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
188 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
189 |
} catch (Exception e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
190 |
log.complain("Caught unexpected exception while communicating with debugee: " + e); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
191 |
e.printStackTrace(out); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
192 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
193 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
194 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
195 |
if (!success) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
196 |
log.complain("TEST FAILED"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
197 |
return FAILED; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
198 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
199 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
200 |
} catch (Exception e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
201 |
out.println("Caught unexpected exception while starting the test: " + e); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
202 |
e.printStackTrace(out); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
203 |
out.println("TEST FAILED"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
204 |
return FAILED; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
205 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
206 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
207 |
out.println("TEST PASSED"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
208 |
return PASSED; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
209 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
210 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
211 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
212 |
} |