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) 2007, 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 |
/* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
25 |
* @test |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
26 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
27 |
* @summary converted from VM Testbase nsk/jdwp/ObjectReference/ReferringObjects/referringObjects002. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
28 |
* VM Testbase keywords: [quick, jpda, jdwp, feature_jdk6_jpda, vm6, monitoring] |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
29 |
* VM Testbase readme: |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
30 |
* DESCRIPTION |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
31 |
* This test performs checking for |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
32 |
* command set: ObjectReference |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
33 |
* command: ReferringObjects |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
34 |
* Test checks that debuggee accept the command packet and |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
35 |
* replies with correct reply packet. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
36 |
* Test consists of two compoments: |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
37 |
* debugger: referringObjects002 |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
38 |
* debuggee: referringObjects002a |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
39 |
* Debuggee contains static field 'testInstance' which initialized with java.lang.Object instance. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
40 |
* Also debuggee contains 6 static fields with names referringObject1, ..., referringObject6, this fields |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
41 |
* are initialized with objects which refer to 'testInstance' and there are no more objects referring to |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
42 |
* the 'testInstance'. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
43 |
* Debugger uses nsk.share support classes to launch debuggee |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
44 |
* and obtain Transport object, that represents JDWP transport channel. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
45 |
* Also communication channel (IOPipe) is established between |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
46 |
* debugger and debuggee to exchange with execution commands. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
47 |
* Debugger obtains objectID for instance assigned to the debuggee's static field 'testInstance'. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
48 |
* Then, debugger creates command packet for ReferringObjects command with the |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
49 |
* found objectID and maxReferrers=0 as an arguments, writes packet to the transport |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
50 |
* channel, and waits for a reply packet. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
51 |
* When reply packet is received, debugger parses the packet structure |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
52 |
* and extracts number of referring objects and referring objects ids. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
53 |
* Debugger checks that number of referring objects is correct - 6. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
54 |
* Debugger obtains objectIDs for object instances stored in debuggee's fields referringObject1, ..., referringObject6 |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
55 |
* and checks that this values and referring objects ids received via JDWP command are identical. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
56 |
* Finally, debugger sends debuggee signal to quit, waits for it exits |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
57 |
* and exits too with the proper exit code. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
58 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
59 |
* @library /vmTestbase /test/hotspot/jtreg/vmTestbase |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
60 |
* /test/lib |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
61 |
* @run driver jdk.test.lib.FileInstaller . . |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
62 |
* @build nsk.jdwp.ObjectReference.ReferringObjects.referringObjects002.referringObjects002 |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
63 |
* @run main/othervm/native PropertyResolvingWrapper |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
64 |
* nsk.jdwp.ObjectReference.ReferringObjects.referringObjects002.referringObjects002 |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
65 |
* -arch=${os.family}-${os.simpleArch} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
66 |
* -verbose |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
67 |
* -waittime=5 |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
68 |
* -debugee.vmkind=java |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
69 |
* -transport.address=dynamic |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
70 |
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
71 |
*/ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
72 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
73 |
package nsk.jdwp.ObjectReference.ReferringObjects.referringObjects002; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
74 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
75 |
import java.io.PrintStream; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
76 |
import nsk.share.Consts; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
77 |
import nsk.share.jdwp.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
78 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
79 |
public class referringObjects002 extends TestDebuggerType1 { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
80 |
protected String getDebugeeClassName() { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
81 |
return nsk.jdwp.ObjectReference.ReferringObjects.referringObjects002.referringObjects002a.class.getName(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
82 |
} |
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 |
public static void main(String argv[]) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
85 |
System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
86 |
} |
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 |
public static int run(String argv[], PrintStream out) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
89 |
return new referringObjects002().runIt(argv, out); |
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 |
private void testCommand() { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
93 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
94 |
int JDWP_COMMAND_ID = JDWP.Command.ObjectReference.ReferringObjects; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
95 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
96 |
long objectID = queryObjectID( |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
97 |
debuggee.getReferenceTypeID(createTypeSignature(getDebugeeClassName())), |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
98 |
"testInstance", |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
99 |
JDWP.Tag.OBJECT); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
100 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
101 |
// create command with maxReferrers=0 (receive all referrers) |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
102 |
log.display("Create command: " + JDWP.commandNames.get(JDWP_COMMAND_ID)); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
103 |
log.display("objectID = " + objectID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
104 |
log.display("maxReferrers = " + 0); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
105 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
106 |
CommandPacket command = new CommandPacket(JDWP_COMMAND_ID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
107 |
command.addObjectID(objectID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
108 |
command.addInt(0); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
109 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
110 |
log.display("Sending command packet:\n" + command); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
111 |
transport.write(command); |
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 |
ReplyPacket reply; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
114 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
115 |
reply = getReply(command); |
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 |
int referringObjects = reply.getInt(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
118 |
log.display("referringObjects = " + referringObjects); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
119 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
120 |
// there are 6 referrers in debuggee |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
121 |
int expectedReferrersCount = 6; |
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 |
if (referringObjects != expectedReferrersCount) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
124 |
log.complain("Unexpected value 'referringObjects': " + referringObjects + " expected is " + expectedReferrersCount); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
125 |
setSuccess(false); |
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 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
128 |
long expectedReferrersID[] = new long[expectedReferrersCount]; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
129 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
130 |
// initialize expected IDs of referrers |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
131 |
for (int i = 0; i < expectedReferrersCount; i++) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
132 |
expectedReferrersID[i] = queryObjectID(debuggee.getReferenceTypeID(createTypeSignature(getDebugeeClassName())), "referringObject" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
133 |
+ (i + 1)); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
134 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
135 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
136 |
long receivedReferrersID[] = new long[referringObjects]; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
137 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
138 |
for (int i = 0; i < referringObjects; i++) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
139 |
JDWP.Value value = reply.getValue(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
140 |
log.display("tagged-ObjectID = " + value); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
141 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
142 |
receivedReferrersID[i] = ((Long) value.getValue()).longValue(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
143 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
144 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
145 |
// check that correct IDs of referrers was received |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
146 |
for (int i = 0; i < referringObjects; i++) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
147 |
boolean isIDExpected = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
148 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
149 |
for (int j = 0; j < expectedReferrersID.length; j++) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
150 |
if (receivedReferrersID[i] == expectedReferrersID[j]) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
151 |
isIDExpected = true; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
152 |
break; |
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 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
155 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
156 |
if (!isIDExpected) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
157 |
setSuccess(false); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
158 |
log.complain("Unexpected 'referrerID' value: " + receivedReferrersID[i]); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
159 |
} |
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 (!getSuccess()) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
163 |
log.complain("Expected IDs:"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
164 |
for (int i = 0; i < expectedReferrersID.length; i++) |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
165 |
log.complain("" + expectedReferrersID[i]); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
166 |
} |
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 |
if (!reply.isParsed()) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
169 |
setSuccess(false); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
170 |
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
|
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 |
setSuccess(false); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
174 |
log.complain("Caught exception while testing JDWP command: " + e); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
175 |
e.printStackTrace(log.getOutStream()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
176 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
177 |
} |
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 |
public void doTest() { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
180 |
testCommand(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
181 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
182 |
} |