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.VirtualMachine.HoldEvents; |
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 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
28 |
import nsk.share.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
29 |
import nsk.share.jpda.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
30 |
import nsk.share.jdwp.*; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
31 |
|
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 |
* Test for JDWP command: VirtualMachine.HoldEvents. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
34 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
35 |
* See holdevents002.README for description of test execution. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
36 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
37 |
* This class represents debugger part of the test. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
38 |
* Test is executed by invoking method runIt(). |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
39 |
* |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
40 |
* @see #runIt() |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
41 |
*/ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
42 |
public class holdevents002 { |
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 |
// exit status constants |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
45 |
static final int JCK_STATUS_BASE = 95; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
46 |
static final int PASSED = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
47 |
static final int FAILED = 2; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
48 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
49 |
// package and classes names constants |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
50 |
static final String PACKAGE_NAME = "nsk.jdwp.VirtualMachine.HoldEvents"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
51 |
static final String TEST_CLASS_NAME = PACKAGE_NAME + "." + "holdevents002"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
52 |
static final String DEBUGEE_CLASS_NAME = TEST_CLASS_NAME + "a"; |
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 |
// tested JDWP command constants |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
55 |
static final String JDWP_COMMAND_NAME = "VirtualMachine.HoldEvents"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
56 |
static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.HoldEvents; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
57 |
static final byte TESTED_EVENT_KIND = JDWP.EventKind.BREAKPOINT; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
58 |
static final byte TESTED_EVENT_SUSPEND_POLICY = JDWP.SuspendPolicy.ALL; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
59 |
static final byte TESTED_EVENT_MODIFIER = JDWP.EventModifierKind.LOCATION_ONLY; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
60 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
61 |
// name and signature of the tested class |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
62 |
static final String TESTED_CLASS_NAME = DEBUGEE_CLASS_NAME + "$" + "TestedClass"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
63 |
static final String TESTED_CLASS_SIGNATURE = "L" + TESTED_CLASS_NAME.replace('.', '/') + ";"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
64 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
65 |
// name of field and method of tested class |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
66 |
static final String TESTED_METHOD_NAME = "run"; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
67 |
static final int BREAKPOINT_LINE = holdevents002a.BREAKPOINT_LINE; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
68 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
69 |
// usual scaffold objects |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
70 |
ArgumentHandler argumentHandler = null; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
71 |
Log log = null; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
72 |
Binder binder = null; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
73 |
Debugee debugee = null; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
74 |
Transport transport = null; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
75 |
int waitTime = 0; // minutes |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
76 |
long timeout = 0; // milliseconds |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
77 |
boolean dead = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
78 |
boolean success = true; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
79 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
80 |
// obtained data |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
81 |
long testedClassID = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
82 |
long testedMethodID = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
83 |
int eventRequestID = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
84 |
|
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 |
|
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 |
* Start test from command line. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
89 |
*/ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
90 |
public static void main(String argv[]) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
91 |
System.exit(run(argv,System.out) + JCK_STATUS_BASE); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
92 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
93 |
|
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 |
* Start test from JCK-compilant environment. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
96 |
*/ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
97 |
public static int run(String argv[], PrintStream out) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
98 |
return new holdevents002().runIt(argv, out); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
99 |
} |
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 |
// ------------------------------------------------------------------- |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
102 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
103 |
/** |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
104 |
* Perform test execution. |
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 |
public int runIt(String argv[], PrintStream out) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
107 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
108 |
// make log for debugger messages |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
109 |
argumentHandler = new ArgumentHandler(argv); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
110 |
log = new Log(out, argumentHandler); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
111 |
waitTime = argumentHandler.getWaitTime(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
112 |
timeout = waitTime * 60 * 1000; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
113 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
114 |
// execute test and display results |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
115 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
116 |
log.display("\n>>> Starting debugee \n"); |
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 |
// launch debuggee |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
119 |
binder = new Binder(argumentHandler, log); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
120 |
log.display("Launching debugee"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
121 |
debugee = binder.bindToDebugee(DEBUGEE_CLASS_NAME); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
122 |
transport = debugee.getTransport(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
123 |
log.display(" ... debugee launched"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
124 |
log.display(""); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
125 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
126 |
// set timeout for debuggee responces |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
127 |
log.display("Setting timeout for debuggee responces: " + waitTime + " minute(s)"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
128 |
transport.setReadTimeout(timeout); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
129 |
log.display(" ... timeout set"); |
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 |
// wait for debuggee started |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
132 |
log.display("Waiting for VM_INIT event"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
133 |
debugee.waitForVMInit(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
134 |
log.display(" ... VM_INIT event received"); |
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 |
// query debugee for VM-dependent ID sizes |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
137 |
log.display("Querying for IDSizes"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
138 |
debugee.queryForIDSizes(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
139 |
log.display(" ... size of VM-dependent types adjusted"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
140 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
141 |
// get debuggee prepared for testing |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
142 |
log.display("\n>>> Get debuggee prepared for testing \n"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
143 |
prepareForTest(); |
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 |
// test JDWP command |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
146 |
log.display("\n>>> Testing JDWP command \n"); |
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("Holding events into debuggee"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
149 |
holdEvents(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
150 |
log.display(" ... events held"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
151 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
152 |
// resume debuggee |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
153 |
log.display("Resuming debuggee"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
154 |
debugee.resume(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
155 |
log.display(" ... debuggee resumed"); |
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 |
// wait for BREAKPOINT event NOT occured |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
158 |
log.display("Waiting for BREAKPOINT event NOT received"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
159 |
waitForBreakpointEvent(); |
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 |
} catch (Failure e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
162 |
log.complain("TEST FAILED: " + e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
163 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
164 |
} catch (Exception e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
165 |
e.printStackTrace(out); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
166 |
log.complain("Caught unexpected exception while running the test:\n\t" + e); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
167 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
168 |
} finally { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
169 |
// quit debugee |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
170 |
log.display("\n>>> Finishing test \n"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
171 |
quitDebugee(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
172 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
173 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
174 |
// check test results |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
175 |
if (!success) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
176 |
log.complain("TEST FAILED"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
177 |
return FAILED; |
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 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
180 |
out.println("TEST PASSED"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
181 |
return PASSED; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
182 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
183 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
184 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
185 |
/** |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
186 |
* Prepare debuggee for testing. |
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 |
void prepareForTest() { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
189 |
// wait for tested class loaded |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
190 |
log.display("Waiting for tested class loaded"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
191 |
testedClassID = debugee.waitForClassLoaded(TESTED_CLASS_NAME, JDWP.SuspendPolicy.ALL); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
192 |
log.display(" ... got classID: " + testedClassID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
193 |
log.display(""); |
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 |
// get methodID for breakpoint method |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
196 |
log.display("Getting breakpoint methodID by name: " + TESTED_METHOD_NAME); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
197 |
testedMethodID = debugee.getMethodID(testedClassID, TESTED_METHOD_NAME, true); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
198 |
log.display(" ... got methodID: " + testedMethodID); |
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 |
// make request for BREAKPOINT event |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
201 |
log.display("Making request for BREAKPOINT event at: " |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
202 |
+ TESTED_METHOD_NAME + ":" + BREAKPOINT_LINE); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
203 |
eventRequestID = debugee.requestBreakpointEvent(JDWP.TypeTag.CLASS, testedClassID, |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
204 |
testedMethodID, BREAKPOINT_LINE, |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
205 |
JDWP.SuspendPolicy.ALL); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
206 |
log.display(" ... got requestID: " + eventRequestID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
207 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
208 |
|
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 |
* Hold events into debuggee. |
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 |
void holdEvents() { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
213 |
CommandPacket command = new CommandPacket(JDWP.Command.VirtualMachine.HoldEvents); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
214 |
ReplyPacket reply = debugee.receiveReplyFor(command); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
215 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
216 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
217 |
/** |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
218 |
* Wait for requested BREAKPOINT event NOT occured. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
219 |
*/ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
220 |
void waitForBreakpointEvent() { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
221 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
222 |
EventPacket eventPacket = new EventPacket(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
223 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
224 |
// receive reply packet from debugee |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
225 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
226 |
log.display("Waiting for event packet"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
227 |
transport.setReadTimeout(timeout); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
228 |
transport.read(eventPacket); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
229 |
log.display(" ... event packet received:\n" + eventPacket); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
230 |
} catch (IOException e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
231 |
log.display("No event packet received for default timeout:\n\t" + e); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
232 |
log.display("Requested BREAKPOINT event is not received after holding events"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
233 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
234 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
235 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
236 |
log.complain("An event received after holding events into debuggee"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
237 |
log.display(""); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
238 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
239 |
// check reply packet header |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
240 |
try{ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
241 |
log.display("Checking header of event packet"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
242 |
eventPacket.checkHeader(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
243 |
log.display(" ... packet header is correct"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
244 |
} catch (BoundException e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
245 |
log.complain("Bad header of received event packet:\n\t" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
246 |
+ e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
247 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
248 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
249 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
250 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
251 |
// start parsing reply packet data |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
252 |
log.display("Parsing event packet:"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
253 |
eventPacket.resetPosition(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
254 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
255 |
// get suspendPolicy value |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
256 |
byte suspendPolicy = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
257 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
258 |
suspendPolicy = eventPacket.getByte(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
259 |
log.display(" suspendPolicy: " + suspendPolicy); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
260 |
} catch (BoundException e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
261 |
log.complain("Unable to get suspendPolicy value from received event packet:\n\t" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
262 |
+ e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
263 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
264 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
265 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
266 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
267 |
// get events count |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
268 |
int events = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
269 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
270 |
events = eventPacket.getInt(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
271 |
log.display(" events: " + events); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
272 |
} catch (BoundException e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
273 |
log.complain("Unable to get events count from received event packet:\n\t" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
274 |
+ e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
275 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
276 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
277 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
278 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
279 |
// check events count |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
280 |
if (events < 0) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
281 |
log.complain("Negative value of events number in received event packet: " + |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
282 |
events + " (expected: " + 1 + ")"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
283 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
284 |
} else if (events != 1) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
285 |
log.complain("Invalid number of events in received event packet: " + |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
286 |
events + " (expected: " + 1 + ")"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
287 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
288 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
289 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
290 |
// extract each event |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
291 |
long eventThreadID = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
292 |
for (int i = 0; i < events; i++) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
293 |
log.display(" event #" + i + ":"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
294 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
295 |
// get eventKind |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
296 |
byte eventKind = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
297 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
298 |
eventKind = eventPacket.getByte(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
299 |
log.display(" eventKind: " + eventKind); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
300 |
} catch (BoundException e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
301 |
log.complain("Unable to get eventKind of event #" + i + " from received event packet:\n\t" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
302 |
+ e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
303 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
304 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
305 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
306 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
307 |
// check eventKind |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
308 |
if (eventKind == JDWP.EventKind.VM_DEATH) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
309 |
log.display("Unexpected VM_DEATH event received intead of BREAKPOINT event"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
310 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
311 |
dead = true; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
312 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
313 |
} else if (eventKind == JDWP.EventKind.BREAKPOINT) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
314 |
log.complain("Hold BREAKPOINT event received in event packet: " + |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
315 |
eventKind + " (expected: " + JDWP.EventKind.BREAKPOINT + ")"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
316 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
317 |
} else { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
318 |
log.complain("Unexpected eventKind of event " + i + " in event packet: " + |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
319 |
eventKind + " (expected: " + JDWP.EventKind.BREAKPOINT + ")"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
320 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
321 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
322 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
323 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
324 |
// get requestID |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
325 |
int requestID = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
326 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
327 |
requestID = eventPacket.getInt(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
328 |
log.display(" requestID: " + requestID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
329 |
} catch (BoundException e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
330 |
log.complain("Unable to get requestID of event #" + i + " from BREAKPOINT event packet:\n\t" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
331 |
+ e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
332 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
333 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
334 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
335 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
336 |
// check requestID |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
337 |
if (requestID != eventRequestID) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
338 |
log.complain("Unexpected requestID of event " + i + " in BREAKPOINT event packet: " + |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
339 |
requestID + " (expected: " + eventRequestID + ")"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
340 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
341 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
342 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
343 |
// get threadID |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
344 |
long threadID = 0; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
345 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
346 |
threadID = eventPacket.getObjectID(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
347 |
log.display(" threadID: " + threadID); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
348 |
} catch (BoundException e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
349 |
log.complain("Unable to get threadID of event #" + i + " from BREAKPOINT event packet:\n\t" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
350 |
+ e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
351 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
352 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
353 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
354 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
355 |
// get location |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
356 |
JDWP.Location location = null; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
357 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
358 |
location = eventPacket.getLocation(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
359 |
log.display(" location: " + location); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
360 |
} catch (BoundException e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
361 |
log.complain("Unable to get location of event #" + i + " from BREAKPOINT event packet:\n\t" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
362 |
+ e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
363 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
364 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
365 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
366 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
367 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
368 |
// check for extra data in event packet |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
369 |
if (!eventPacket.isParsed()) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
370 |
log.complain("Extra trailing bytes found in event packet at: " |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
371 |
+ eventPacket.offsetString()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
372 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
373 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
374 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
375 |
log.display(" ... event packet parsed"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
376 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
377 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
378 |
/** |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
379 |
* Disconnect debuggee and wait for it exited. |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
380 |
*/ |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
381 |
void quitDebugee() { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
382 |
if (debugee == null) |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
383 |
return; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
384 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
385 |
// disconnect debugee if not dead |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
386 |
if (!dead) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
387 |
try { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
388 |
log.display("Disconnecting debuggee"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
389 |
debugee.dispose(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
390 |
log.display(" ... debuggee disconnected"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
391 |
} catch (Failure e) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
392 |
log.display("Failed to finally disconnect debuggee:\n\t" |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
393 |
+ e.getMessage()); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
394 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
395 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
396 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
397 |
// wait for debugee exited |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
398 |
log.display("Waiting for debuggee exit"); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
399 |
int code = debugee.waitFor(); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
400 |
log.display(" ... debuggee exited with exit code: " + code); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
401 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
402 |
// analize debugee exit status code |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
403 |
if (code != JCK_STATUS_BASE + PASSED) { |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
404 |
log.complain("Debuggee FAILED with exit code: " + code); |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
405 |
success = false; |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
406 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
407 |
} |
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
408 |
|
cf71bff5f533
8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff
changeset
|
409 |
} |