1 /* |
1 /* |
2 * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 package nsk.jdi.EventQueue.remove_l; |
24 package nsk.jdi.EventQueue.remove_l; |
25 |
25 |
|
26 import jdk.test.lib.Utils; |
26 import nsk.share.*; |
27 import nsk.share.*; |
27 import nsk.share.jpda.*; |
28 import nsk.share.jpda.*; |
28 import nsk.share.jdi.*; |
29 import nsk.share.jdi.*; |
29 |
30 |
30 import com.sun.jdi.*; |
31 import com.sun.jdi.*; |
31 import com.sun.jdi.event.*; |
32 import com.sun.jdi.event.*; |
32 import com.sun.jdi.request.*; |
33 import com.sun.jdi.request.*; |
33 |
|
34 import java.util.*; |
34 import java.util.*; |
35 import java.io.*; |
35 import java.io.*; |
36 |
36 |
37 /** |
37 /** |
38 * The test for the implementation of an object of the type <BR> |
38 * The test for the implementation of an object of the type <BR> |
61 * the debugger resumes the debuggee and waits for the BreakpointEvent.<BR> |
61 * the debugger resumes the debuggee and waits for the BreakpointEvent.<BR> |
62 * The debuggee firstly invokes the methodForCommunication <BR> |
62 * The debuggee firstly invokes the methodForCommunication <BR> |
63 * to be suspended and to inform the debugger with the event. <BR> |
63 * to be suspended and to inform the debugger with the event. <BR> |
64 * The case for testing consists of of two steps. <BR> |
64 * The case for testing consists of of two steps. <BR> |
65 * In the first one the first assertion is checked up on as follows: <BR> |
65 * In the first one the first assertion is checked up on as follows: <BR> |
66 * the debugger sleeps for "WAITTIME * 90 sec"; <BR> |
66 * the debugger sleeps for some time; <BR> |
67 * hence, no event is expected in the debugger within WAITTINE, and <BR> |
67 * hence, no event is expected in the debugger within WAITTIME, and <BR> |
68 * debugger's method breakpointForCommunication() should get null. <BR> |
68 * debugger's method breakpointForCommunication() should get null. <BR> |
69 * After WAITTIME, the debugger just expects to get normal breakpoint event.<BR> |
69 * After WAITTIME, the debugger just expects to get normal breakpoint event.<BR> |
70 */ |
70 */ |
71 |
71 |
72 public class remove_l004 { |
72 public class remove_l004 { |
124 //------------------------------------------------------ common section |
124 //------------------------------------------------------ common section |
125 |
125 |
126 static Debugee debuggee; |
126 static Debugee debuggee; |
127 static ArgumentHandler argsHandler; |
127 static ArgumentHandler argsHandler; |
128 |
128 |
129 static int waitTime; |
129 static long waitTime; |
130 |
130 |
131 static VirtualMachine vm = null; |
131 static VirtualMachine vm = null; |
132 static EventRequestManager eventRManager = null; |
132 static EventRequestManager eventRManager = null; |
133 static EventQueue eventQueue = null; |
133 static EventQueue eventQueue = null; |
134 static EventSet eventSet = null; |
134 static EventSet eventSet = null; |
135 static EventIterator eventIterator = null; |
135 static EventIterator eventIterator = null; |
136 |
136 |
137 static ReferenceType debuggeeClass = null; |
137 static ReferenceType debuggeeClass = null; |
138 |
138 |
|
139 static Value trueValue; |
|
140 |
139 static int testExitCode = PASSED; |
141 static int testExitCode = PASSED; |
140 |
142 |
141 class JDITestRuntimeException extends RuntimeException { |
143 class JDITestRuntimeException extends RuntimeException { |
142 JDITestRuntimeException(String str) { |
144 JDITestRuntimeException(String str) { |
143 super("JDITestRuntimeException : " + str); |
145 super("JDITestRuntimeException : " + str); |
150 |
152 |
151 argsHandler = new ArgumentHandler(argv); |
153 argsHandler = new ArgumentHandler(argv); |
152 logHandler = new Log(out, argsHandler); |
154 logHandler = new Log(out, argsHandler); |
153 Binder binder = new Binder(argsHandler, logHandler); |
155 Binder binder = new Binder(argsHandler, logHandler); |
154 |
156 |
155 waitTime = argsHandler.getWaitTime() * 60000; |
157 waitTime = Utils.adjustTimeout(argsHandler.getWaitTime() * 1000); |
156 |
158 |
157 try { |
159 try { |
158 log2("launching a debuggee :"); |
160 log2("launching a debuggee :"); |
159 log2(" " + debuggeeName); |
161 log2(" " + debuggeeName); |
160 if (argsHandler.verbose()) { |
162 if (argsHandler.verbose()) { |
279 debuggeeClass = event.referenceType(); |
281 debuggeeClass = event.referenceType(); |
280 |
282 |
281 if (!debuggeeClass.name().equals(debuggeeName)) |
283 if (!debuggeeClass.name().equals(debuggeeName)) |
282 throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); |
284 throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); |
283 |
285 |
|
286 trueValue = debuggeeClass.getValue(debuggeeClass.fieldByName("BOOLEAN_TRUE_VALUE")); |
|
287 |
284 log2(" received: ClassPrepareEvent for debuggeeClass"); |
288 log2(" received: ClassPrepareEvent for debuggeeClass"); |
285 |
289 |
286 String bPointMethod = "methodForCommunication"; |
290 String bPointMethod = "methodForCommunication"; |
287 String lineForComm = "lineForComm"; |
291 String lineForComm = "lineForComm"; |
288 BreakpointRequest bpRequest; |
292 BreakpointRequest bpRequest; |
324 if (str.lastIndexOf("TIMEOUT") <0) { |
328 if (str.lastIndexOf("TIMEOUT") <0) { |
325 log3("ERROR: no TIMEOUT"); |
329 log3("ERROR: no TIMEOUT"); |
326 testExitCode = FAILED; |
330 testExitCode = FAILED; |
327 throw new JDITestRuntimeException("** unexpected Exception **"); |
331 throw new JDITestRuntimeException("** unexpected Exception **"); |
328 } |
332 } |
|
333 |
|
334 // Signal to debuggee to stop sleeping |
|
335 ((ClassType) debuggeeClass).setValue(debuggeeClass.fieldByName("stopSleeping"), |
|
336 trueValue); |
|
337 |
329 } |
338 } |
330 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
339 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
331 |
340 |
332 log2("...... waiting for breakpoint event"); |
341 log2("...... waiting for breakpoint event"); |
333 |
342 |