Skip to content

Commit d52e9ed

Browse files
committedSep 20, 2023
8316380: [11u] Backport 8170089: nsk/jdi/EventSet/resume/resume008: ERROR: suspendCounts don't match for : Common-Cleaner
Reviewed-by: mbaesken
1 parent 723c0c0 commit d52e9ed

20 files changed

+526
-192
lines changed
 

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java

+28-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
* To check up on the method, a debugger,
5151
* upon getting new set for ClassPrepareEvent,
5252
* suspends VM with the method VirtualMachine.suspend(),
53-
* gets the List of geduggee's threads calling VM.allThreads(),
53+
* gets the List of debuggee's threads calling VM.allThreads(),
5454
* invokes the method EventSet.resume(), and
55-
* gets another List of geduggee's threads.
55+
* gets another List of debuggee's threads.
5656
* The debugger then compares values of
5757
* each thread's suspendCount from first and second Lists.
5858
*
@@ -63,6 +63,13 @@
6363
* making special clases loaded and prepared to create the Events
6464
* - Upon getting the Events,
6565
* the debugger performs the check required.
66+
* - The debugger informs the debuggee when it completes
67+
* each test case, so it will wait before hitting
68+
* communication breakpoints.
69+
* This prevents the breakpoint SUSPEND_ALL policy
70+
* disrupting the first test case check for
71+
* SUSPEND_NONE, if the debuggee gets ahead of
72+
* the debugger processing.
6673
*/
6774

6875
public class resume001 extends TestDebuggerType1 {
@@ -233,6 +240,7 @@ protected void testRun() {
233240

234241
default: throw new Failure("** default case 1 **");
235242
}
243+
informDebuggeeTestCase(i);
236244
}
237245

238246
display("......--> vm.resume()");
@@ -261,5 +269,22 @@ private ClassPrepareRequest settingClassPrepareRequest ( String testedClass,
261269
throw new Failure("** FAILURE to set up ClassPrepareRequest **");
262270
}
263271
}
264-
272+
/**
273+
* Inform debuggee which thread test the debugger has completed.
274+
* Used for synchronization, so the debuggee does not move too quickly.
275+
* @param testCase index of just completed test
276+
*/
277+
void informDebuggeeTestCase(int testCase) {
278+
try {
279+
((ClassType)debuggeeClass)
280+
.setValue(debuggeeClass.fieldByName("testCase"),
281+
vm.mirrorOf(testCase));
282+
} catch (InvalidTypeException ite) {
283+
throw new Failure("** FAILURE setting testCase **");
284+
} catch (ClassNotLoadedException cnle) {
285+
throw new Failure("** FAILURE notifying debuggee **");
286+
} catch (VMDisconnectedException e) {
287+
throw new Failure("** FAILURE debuggee connection **");
288+
}
289+
}
265290
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
public class resume001a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
3737

3838
static final int PASSED = 0;
3939
static final int FAILED = 2;
@@ -57,6 +57,7 @@ private static void logErr(String message) {
5757

5858
static int exitCode = PASSED;
5959

60+
static int testCase = -1;
6061
static int instruction = 1;
6162
static int end = 0;
6263
// static int quit = 0;
@@ -100,6 +101,10 @@ public static void main (String argv[]) {
100101

101102
case 0:
102103
TestClass2 obj2 = new TestClass2();
104+
// Wait for debugger to complete the first test case
105+
// before advancing to the first breakpoint
106+
waitForTestCase(0);
107+
103108
break;
104109

105110
case 1:
@@ -119,6 +124,16 @@ public static void main (String argv[]) {
119124
log1("debuggee exits");
120125
System.exit(exitCode + PASS_BASE);
121126
}
127+
// Synchronize with debugger progression.
128+
static void waitForTestCase(int t) {
129+
while (testCase < t) {
130+
try {
131+
Thread.sleep(100);
132+
} catch (InterruptedException e) {
133+
// ignored
134+
}
135+
}
136+
}
122137
}
123138

124139
class TestClass2 {

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java

+23-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
* To check up on the method, a debugger, <BR>
4949
* upon getting new set for the EventSet, <BR>
5050
* suspends VM with the method VirtualMachine.suspend(), <BR>
51-
* gets the List of geduggee's threads calling VM.allThreads(), <BR>
51+
* gets the List of debuggee's threads calling VM.allThreads(), <BR>
5252
* invokes the method EventSet.resume(), and <BR>
53-
* gets another List of geduggee's threads. <BR>
53+
* gets another List of debuggee's threads. <BR>
5454
* The debugger then compares values of <BR>
5555
* each thread's suspendCount from first and second Lists. <BR>
5656
* <BR>
@@ -87,12 +87,12 @@
8787

8888
public class resume002 {
8989

90-
//----------------------------------------------------- templete section
90+
//----------------------------------------------------- template section
9191
static final int PASSED = 0;
9292
static final int FAILED = 2;
9393
static final int PASS_BASE = 95;
9494

95-
//----------------------------------------------------- templete parameters
95+
//----------------------------------------------------- template parameters
9696
static final String
9797
sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume002 ",
9898
sHeader2 = "--> debugger: ",
@@ -503,6 +503,7 @@ private void testRun()
503503

504504
log2("......--> vm.resume()");
505505
vm.resume();
506+
informDebuggeeTestCase(i);
506507
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
507508
}
508509
log1(" TESTING ENDS");
@@ -642,5 +643,22 @@ private AccessWatchpointRequest settingAccessWatchpointRequest (
642643
throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **");
643644
}
644645
}
645-
646+
/**
647+
* Inform debuggee which thread test the debugger has completed.
648+
* Used for synchronization, so the debuggee does not move too quickly.
649+
* @param testCase index of just completed test
650+
*/
651+
void informDebuggeeTestCase(int testCase) {
652+
try {
653+
((ClassType)debuggeeClass)
654+
.setValue(debuggeeClass.fieldByName("testCase"),
655+
vm.mirrorOf(testCase));
656+
} catch (InvalidTypeException ite) {
657+
throw new Failure("** FAILURE setting testCase **");
658+
} catch (ClassNotLoadedException cnle) {
659+
throw new Failure("** FAILURE notifying debuggee **");
660+
} catch (VMDisconnectedException e) {
661+
throw new Failure("** FAILURE debuggee connection **");
662+
}
663+
}
646664
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java

+19-3
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333

3434
public class resume002a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
3737

3838
static final int PASSED = 0;
3939
static final int FAILED = 2;
4040
static final int PASS_BASE = 95;
4141

4242
static ArgumentHandler argHandler;
4343
static Log log;
44+
static int testCase = -1;
4445

4546
//-------------------------------------------------- log procedures
4647

@@ -98,8 +99,12 @@ public static void main (String argv[]) {
9899

99100
//------------------------------------------------------ section tested
100101

101-
case 0: resume002aTestClass.method();
102-
break;
102+
case 0:
103+
resume002aTestClass.method();
104+
// Wait for debugger to complete the first test case
105+
// before advancing to the first breakpoint
106+
waitForTestCase(0);
107+
break;
103108

104109
case 1: resume002aTestClass.method();
105110
break;
@@ -118,6 +123,17 @@ public static void main (String argv[]) {
118123
log1("debuggee exits");
119124
System.exit(exitCode + PASS_BASE);
120125
}
126+
// Synchronize with debugger progression.
127+
static void waitForTestCase(int t) {
128+
while (testCase < t) {
129+
try {
130+
Thread.sleep(100);
131+
} catch (InterruptedException e) {
132+
// ignored
133+
}
134+
}
135+
}
136+
121137
}
122138

123139
class resume002aTestClass {

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java

+24-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
* To check up on the method, a debugger, <BR>
4949
* upon getting new set for the EventSet, <BR>
5050
* suspends VM with the method VirtualMachine.suspend(), <BR>
51-
* gets the List of geduggee's threads calling VM.allThreads(), <BR>
51+
* gets the List of debuggee's threads calling VM.allThreads(), <BR>
5252
* invokes the method EventSet.resume(), and <BR>
53-
* gets another List of geduggee's threads. <BR>
53+
* gets another List of debuggee's threads. <BR>
5454
* The debugger then compares values of <BR>
5555
* each thread's suspendCount from first and second Lists. <BR>
5656
* <BR>
@@ -87,12 +87,12 @@
8787

8888
public class resume003 {
8989

90-
//----------------------------------------------------- templete section
90+
//----------------------------------------------------- template section
9191
static final int PASSED = 0;
9292
static final int FAILED = 2;
9393
static final int PASS_BASE = 95;
9494

95-
//----------------------------------------------------- templete parameters
95+
//----------------------------------------------------- template parameters
9696
static final String
9797
sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume003 ",
9898
sHeader2 = "--> debugger: ",
@@ -503,6 +503,8 @@ private void testRun()
503503

504504
log2("......--> vm.resume()");
505505
vm.resume();
506+
informDebuggeeTestCase(i);
507+
506508
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
507509
}
508510
log1(" TESTING ENDS");
@@ -642,5 +644,22 @@ private ModificationWatchpointRequest settingModificationWatchpointRequest (
642644
throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **");
643645
}
644646
}
645-
647+
/**
648+
* Inform debuggee which thread test the debugger has completed.
649+
* Used for synchronization, so the debuggee does not move too quickly.
650+
* @param testCase index of just completed test
651+
*/
652+
void informDebuggeeTestCase(int testCase) {
653+
try {
654+
((ClassType)debuggeeClass)
655+
.setValue(debuggeeClass.fieldByName("testCase"),
656+
vm.mirrorOf(testCase));
657+
} catch (InvalidTypeException ite) {
658+
throw new Failure("** FAILURE setting testCase **");
659+
} catch (ClassNotLoadedException cnle) {
660+
throw new Failure("** FAILURE notifying debuggee **");
661+
} catch (VMDisconnectedException e) {
662+
throw new Failure("** FAILURE debuggee connection **");
663+
}
664+
}
646665
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java

+18-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333

3434
public class resume003a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
37+
static int testCase = -1;
3738

3839
static final int PASSED = 0;
3940
static final int FAILED = 2;
@@ -98,8 +99,12 @@ public static void main (String argv[]) {
9899

99100
//------------------------------------------------------ section tested
100101

101-
case 0: resume003aTestClass.method();
102-
break;
102+
case 0:
103+
resume003aTestClass.method();
104+
// Wait for debugger to complete the first test case
105+
// before advancing to the first breakpoint
106+
waitForTestCase(0);
107+
break;
103108

104109
case 1: resume003aTestClass.method();
105110
break;
@@ -118,6 +123,16 @@ public static void main (String argv[]) {
118123
log1("debuggee exits");
119124
System.exit(exitCode + PASS_BASE);
120125
}
126+
// Synchronize with debugger progression.
127+
static void waitForTestCase(int t) {
128+
while (testCase < t) {
129+
try {
130+
Thread.sleep(100);
131+
} catch (InterruptedException e) {
132+
// ignored
133+
}
134+
}
135+
}
121136
}
122137

123138
class resume003aTestClass {

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java

+23-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
* To check up on the method, a debugger, <BR>
4949
* upon getting new set for the EventSet, <BR>
5050
* suspends VM with the method VirtualMachine.suspend(), <BR>
51-
* gets the List of geduggee's threads calling VM.allThreads(), <BR>
51+
* gets the List of debuggee's threads calling VM.allThreads(), <BR>
5252
* invokes the method EventSet.resume(), and <BR>
53-
* gets another List of geduggee's threads. <BR>
53+
* gets another List of debuggee's threads. <BR>
5454
* The debugger then compares values of <BR>
5555
* each thread's suspendCount from first and second Lists. <BR>
5656
* <BR>
@@ -87,12 +87,12 @@
8787

8888
public class resume004 {
8989

90-
//----------------------------------------------------- templete section
90+
//----------------------------------------------------- template section
9191
static final int PASSED = 0;
9292
static final int FAILED = 2;
9393
static final int PASS_BASE = 95;
9494

95-
//----------------------------------------------------- templete parameters
95+
//----------------------------------------------------- template parameters
9696
static final String
9797
sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume004 ",
9898
sHeader2 = "--> debugger: ",
@@ -493,6 +493,7 @@ private void testRun()
493493

494494
default: throw new JDITestRuntimeException("** default case 1 **");
495495
}
496+
informDebuggeeTestCase(i);
496497
}
497498

498499
log2("......--> vm.resume()");
@@ -638,5 +639,22 @@ private BreakpointRequest settingBreakpointRequest ( ThreadReference thread,
638639
throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **");
639640
}
640641
}
641-
642+
/**
643+
* Inform debuggee which thread test the debugger has completed.
644+
* Used for synchronization, so the debuggee does not move too quickly.
645+
* @param testCase index of just completed test
646+
*/
647+
void informDebuggeeTestCase(int testCase) {
648+
try {
649+
((ClassType)debuggeeClass)
650+
.setValue(debuggeeClass.fieldByName("testCase"),
651+
vm.mirrorOf(testCase));
652+
} catch (InvalidTypeException ite) {
653+
throw new Failure("** FAILURE setting testCase **");
654+
} catch (ClassNotLoadedException cnle) {
655+
throw new Failure("** FAILURE notifying debuggee **");
656+
} catch (VMDisconnectedException e) {
657+
throw new Failure("** FAILURE debuggee connection **");
658+
}
659+
}
642660
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java

+16-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333

3434
public class resume004a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
37+
static int testCase = -1;
3738

3839
static final int PASSED = 0;
3940
static final int FAILED = 2;
@@ -98,8 +99,10 @@ public static void main (String argv[]) {
9899

99100
//------------------------------------------------------ section tested
100101

101-
case 0: resume004aTestClass.method();
102-
break;
102+
case 0:
103+
resume004aTestClass.method();
104+
waitForTestCase(0);
105+
break;
103106

104107
case 1: resume004aTestClass.method();
105108
break;
@@ -118,6 +121,16 @@ public static void main (String argv[]) {
118121
log1("debuggee exits");
119122
System.exit(exitCode + PASS_BASE);
120123
}
124+
// Synchronize with debugger progression.
125+
static void waitForTestCase(int t) {
126+
while (testCase < t) {
127+
try {
128+
Thread.sleep(100);
129+
} catch (InterruptedException e) {
130+
// ignored
131+
}
132+
}
133+
}
121134
}
122135

123136
class resume004aTestClass {

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java

+23-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
* To check up on the method, a debugger, <BR>
4949
* upon getting new set for the EventSet, <BR>
5050
* suspends VM with the method VirtualMachine.suspend(), <BR>
51-
* gets the List of geduggee's threads calling VM.allThreads(), <BR>
51+
* gets the List of debuggee's threads calling VM.allThreads(), <BR>
5252
* invokes the method EventSet.resume(), and <BR>
53-
* gets another List of geduggee's threads. <BR>
53+
* gets another List of debuggee's threads. <BR>
5454
* The debugger then compares values of <BR>
5555
* each thread's suspendCount from first and second Lists. <BR>
5656
* <BR>
@@ -87,12 +87,12 @@
8787

8888
public class resume005 {
8989

90-
//----------------------------------------------------- templete section
90+
//----------------------------------------------------- template section
9191
static final int PASSED = 0;
9292
static final int FAILED = 2;
9393
static final int PASS_BASE = 95;
9494

95-
//----------------------------------------------------- templete parameters
95+
//----------------------------------------------------- template parameters
9696
static final String
9797
sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume005 ",
9898
sHeader2 = "--> debugger: ",
@@ -493,6 +493,7 @@ private void testRun()
493493

494494
default: throw new JDITestRuntimeException("** default case 1 **");
495495
}
496+
informDebuggeeTestCase(i);
496497
}
497498

498499
log2("......--> vm.resume()");
@@ -634,5 +635,22 @@ private ExceptionRequest settingExceptionRequest ( ThreadReference thread,
634635
throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **");
635636
}
636637
}
637-
638+
/**
639+
* Inform debuggee which thread test the debugger has completed.
640+
* Used for synchronization, so the debuggee does not move too quickly.
641+
* @param testCase index of just completed test
642+
*/
643+
void informDebuggeeTestCase(int testCase) {
644+
try {
645+
((ClassType)debuggeeClass)
646+
.setValue(debuggeeClass.fieldByName("testCase"),
647+
vm.mirrorOf(testCase));
648+
} catch (InvalidTypeException ite) {
649+
throw new Failure("** FAILURE setting testCase **");
650+
} catch (ClassNotLoadedException cnle) {
651+
throw new Failure("** FAILURE notifying debuggee **");
652+
} catch (VMDisconnectedException e) {
653+
throw new Failure("** FAILURE debuggee connection **");
654+
}
655+
}
638656
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java

+16-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333

3434
public class resume005a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
37+
static int testCase = -1;
3738

3839
static final int PASSED = 0;
3940
static final int FAILED = 2;
@@ -98,8 +99,10 @@ public static void main (String argv[]) {
9899

99100
//------------------------------------------------------ section tested
100101

101-
case 0: resume005aTestClass.method();
102-
break;
102+
case 0:
103+
resume005aTestClass.method();
104+
waitForTestCase(0);
105+
break;
103106

104107
case 1: resume005aTestClass.method();
105108
break;
@@ -122,7 +125,16 @@ public static void main (String argv[]) {
122125
public static void nullMethod() {
123126
throw new NullPointerException("test");
124127
}
125-
128+
// Synchronize with debugger progression.
129+
static void waitForTestCase(int t) {
130+
while (testCase < t) {
131+
try {
132+
Thread.sleep(100);
133+
} catch (InterruptedException e) {
134+
// ignored
135+
}
136+
}
137+
}
126138
}
127139

128140
class resume005aTestClass {

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java

+23-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
* To check up on the method, a debugger, <BR>
4949
* upon getting new set for the EventSet, <BR>
5050
* suspends VM with the method VirtualMachine.suspend(), <BR>
51-
* gets the List of geduggee's threads calling VM.allThreads(), <BR>
51+
* gets the List of debuggee's threads calling VM.allThreads(), <BR>
5252
* invokes the method EventSet.resume(), and <BR>
53-
* gets another List of geduggee's threads. <BR>
53+
* gets another List of debuggee's threads. <BR>
5454
* The debugger then compares values of <BR>
5555
* each thread's suspendCount from first and second Lists. <BR>
5656
* <BR>
@@ -87,12 +87,12 @@
8787

8888
public class resume006 {
8989

90-
//----------------------------------------------------- templete section
90+
//----------------------------------------------------- template section
9191
static final int PASSED = 0;
9292
static final int FAILED = 2;
9393
static final int PASS_BASE = 95;
9494

95-
//----------------------------------------------------- templete parameters
95+
//----------------------------------------------------- template parameters
9696
static final String
9797
sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume006 ",
9898
sHeader2 = "--> debugger: ",
@@ -495,6 +495,7 @@ private void testRun()
495495

496496
log2("......--> vm.resume()");
497497
vm.resume();
498+
informDebuggeeTestCase(i);
498499
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
499500
}
500501
log1(" TESTING ENDS");
@@ -632,5 +633,22 @@ private MethodEntryRequest settingMethodEntryRequest ( ThreadReference thread,
632633
throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **");
633634
}
634635
}
635-
636+
/**
637+
* Inform debuggee which thread test the debugger has completed.
638+
* Used for synchronization, so the debuggee does not move too quickly.
639+
* @param testCase index of just completed test
640+
*/
641+
void informDebuggeeTestCase(int testCase) {
642+
try {
643+
((ClassType)debuggeeClass)
644+
.setValue(debuggeeClass.fieldByName("testCase"),
645+
vm.mirrorOf(testCase));
646+
} catch (InvalidTypeException ite) {
647+
throw new Failure("** FAILURE setting testCase **");
648+
} catch (ClassNotLoadedException cnle) {
649+
throw new Failure("** FAILURE notifying debuggee **");
650+
} catch (VMDisconnectedException e) {
651+
throw new Failure("** FAILURE debuggee connection **");
652+
}
653+
}
636654
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java

+18-4
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333

3434
public class resume006a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
3737

3838
static final int PASSED = 0;
3939
static final int FAILED = 2;
4040
static final int PASS_BASE = 95;
4141

4242
static ArgumentHandler argHandler;
4343
static Log log;
44+
static int testCase = -1;
4445

4546
//-------------------------------------------------- log procedures
4647

@@ -98,8 +99,12 @@ public static void main (String argv[]) {
9899

99100
//------------------------------------------------------ section tested
100101

101-
case 0: resume006aTestClass.method();
102-
break;
102+
case 0:
103+
resume006aTestClass.method();
104+
// Wait for debugger to complete the first test case
105+
// before advancing to the next breakpoint
106+
waitForTestCase(0);
107+
break;
103108

104109
case 1: resume006aTestClass.method();
105110
break;
@@ -118,7 +123,16 @@ public static void main (String argv[]) {
118123
log1("debuggee exits");
119124
System.exit(exitCode + PASS_BASE);
120125
}
121-
126+
// Synchronize with debugger progression.
127+
static void waitForTestCase(int t) {
128+
while (testCase < t) {
129+
try {
130+
Thread.sleep(100);
131+
} catch (InterruptedException e) {
132+
// ignored
133+
}
134+
}
135+
}
122136
}
123137

124138
class resume006aTestClass {

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java

+23-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
* To check up on the method, a debugger, <BR>
4949
* upon getting new set for the EventSet, <BR>
5050
* suspends VM with the method VirtualMachine.suspend(), <BR>
51-
* gets the List of geduggee's threads calling VM.allThreads(), <BR>
51+
* gets the List of debuggee's threads calling VM.allThreads(), <BR>
5252
* invokes the method EventSet.resume(), and <BR>
53-
* gets another List of geduggee's threads. <BR>
53+
* gets another List of debuggee's threads. <BR>
5454
* The debugger then compares values of <BR>
5555
* each thread's suspendCount from first and second Lists. <BR>
5656
* <BR>
@@ -87,12 +87,12 @@
8787

8888
public class resume007 {
8989

90-
//----------------------------------------------------- templete section
90+
//----------------------------------------------------- template section
9191
static final int PASSED = Consts.TEST_PASSED;
9292
static final int FAILED = Consts.TEST_FAILED;
9393
static final int PASS_BASE = Consts.JCK_STATUS_BASE;
9494

95-
//----------------------------------------------------- templete parameters
95+
//----------------------------------------------------- template parameters
9696
static final String
9797
sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume007 ",
9898
sHeader2 = "--> debugger: ",
@@ -490,6 +490,7 @@ private void testRun()
490490

491491
default: throw new JDITestRuntimeException("** default case 1 **");
492492
}
493+
informDebuggeeTestCase(i);
493494
}
494495

495496
log2("......--> vm.resume()");
@@ -631,5 +632,22 @@ private MethodExitRequest settingMethodExitRequest ( ThreadReference thread,
631632
throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **");
632633
}
633634
}
634-
635+
/**
636+
* Inform debuggee which thread test the debugger has completed.
637+
* Used for synchronization, so the debuggee does not move too quickly.
638+
* @param testCase index of just completed test
639+
*/
640+
void informDebuggeeTestCase(int testCase) {
641+
try {
642+
((ClassType)debuggeeClass)
643+
.setValue(debuggeeClass.fieldByName("testCase"),
644+
vm.mirrorOf(testCase));
645+
} catch (InvalidTypeException ite) {
646+
throw new Failure("** FAILURE setting testCase **");
647+
} catch (ClassNotLoadedException cnle) {
648+
throw new Failure("** FAILURE notifying debuggee **");
649+
} catch (VMDisconnectedException e) {
650+
throw new Failure("** FAILURE debuggee connection **");
651+
}
652+
}
635653
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java

+16-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333

3434
public class resume007a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
37+
static int testCase = -1;
3738

3839
static final int PASSED = 0;
3940
static final int FAILED = 2;
@@ -98,8 +99,10 @@ public static void main (String argv[]) {
9899

99100
//------------------------------------------------------ section tested
100101

101-
case 0: resume007aTestClass.method();
102-
break;
102+
case 0:
103+
resume007aTestClass.method();
104+
waitForTestCase(0);
105+
break;
103106

104107
case 1: resume007aTestClass.method();
105108
break;
@@ -118,7 +121,16 @@ public static void main (String argv[]) {
118121
log1("debuggee exits");
119122
System.exit(exitCode + PASS_BASE);
120123
}
121-
124+
// Synchronize with debugger progression.
125+
static void waitForTestCase(int t) {
126+
while (testCase < t) {
127+
try {
128+
Thread.sleep(100);
129+
} catch (InterruptedException e) {
130+
// ignored
131+
}
132+
}
133+
}
122134
}
123135

124136
class resume007aTestClass {

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java

+112-78
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
* To check up on the method, a debugger,
5151
* upon getting new set for the EventSet,
5252
* suspends VM with the method VirtualMachine.suspend(),
53-
* gets the List of geduggee's threads calling VM.allThreads(),
53+
* gets the List of debuggee's threads calling VM.allThreads(),
5454
* invokes the method EventSet.resume(), and
55-
* gets another List of geduggee's threads.
55+
* gets another List of debuggee's threads.
5656
* The debugger then compares values of
5757
* each thread's suspendCount from first and second Lists.
5858
*
@@ -63,6 +63,13 @@
6363
* to be resulting in the event.
6464
* - Upon getting new event, the debugger
6565
* performs the check corresponding to the event.
66+
* - The debugger informs the debuggee when it completes
67+
* each test case, so it will wait before hitting
68+
* communication breakpoints.
69+
* This prevents the breakpoint SUSPEND_ALL policy
70+
* disrupting the first test case check for
71+
* SUSPEND_NONE, if the debuggee gets ahead of
72+
* the debugger processing.
6673
*/
6774

6875
public class resume008 extends TestDebuggerType1 {
@@ -124,7 +131,9 @@ protected void testRun() {
124131
}
125132

126133
display("......waiting for new ThreadStartEvent : " + i);
127-
EventSet eventSet = eventHandler.waitForRequestedEventSet(new EventRequest[]{eventRequest}, waitTime, true);
134+
EventSet eventSet = eventHandler
135+
.waitForRequestedEventSet(new EventRequest[]{eventRequest},
136+
waitTime, true);
128137

129138
EventIterator eventIterator = eventSet.eventIterator();
130139
Event newEvent = eventIterator.nextEvent();
@@ -134,7 +143,8 @@ protected void testRun() {
134143
} else {
135144

136145
String property = (String) newEvent.request().getProperty("number");
137-
display(" got new ThreadStartEvent with propety 'number' == " + property);
146+
display(" got new ThreadStartEvent with propety 'number' == "
147+
+ property);
138148

139149
display("......checking up on EventSet.resume()");
140150
display("......--> vm.suspend();");
@@ -144,7 +154,8 @@ protected void testRun() {
144154

145155
Map<String, Integer> suspendsCounts1 = new HashMap<String, Integer>();
146156
for (ThreadReference threadReference : vm.allThreads()) {
147-
suspendsCounts1.put(threadReference.name(), threadReference.suspendCount());
157+
suspendsCounts1.put(threadReference.name(),
158+
threadReference.suspendCount());
148159
}
149160
display(suspendsCounts1.toString());
150161

@@ -154,7 +165,8 @@ protected void testRun() {
154165
display(" getting : Map<String, Integer> suspendsCounts2");
155166
Map<String, Integer> suspendsCounts2 = new HashMap<String, Integer>();
156167
for (ThreadReference threadReference : vm.allThreads()) {
157-
suspendsCounts2.put(threadReference.name(), threadReference.suspendCount());
168+
suspendsCounts2.put(threadReference.name(),
169+
threadReference.suspendCount());
158170
}
159171
display(suspendsCounts2.toString());
160172

@@ -163,85 +175,90 @@ protected void testRun() {
163175

164176
switch (policy) {
165177

166-
case SUSPEND_NONE :
167-
display(" case SUSPEND_NONE");
168-
for (String threadName : suspendsCounts1.keySet()) {
169-
display(" checking " + threadName);
170-
if (!suspendsCounts2.containsKey(threadName)) {
171-
complain("ERROR: couldn't get ThreadReference for " + threadName);
172-
testExitCode = TEST_FAILED;
173-
break;
174-
}
175-
int count1 = suspendsCounts1.get(threadName);
176-
int count2 = suspendsCounts2.get(threadName);
177-
if (count1 != count2) {
178-
complain("ERROR: suspendCounts don't match for : " + threadName);
179-
complain("before resuming : " + count1);
180-
complain("after resuming : " + count2);
181-
testExitCode = TEST_FAILED;
182-
break;
183-
}
184-
}
185-
break;
186-
187-
case SUSPEND_THREAD :
188-
display(" case SUSPEND_THREAD");
189-
for (String threadName : suspendsCounts1.keySet()) {
190-
display("checking " + threadName);
191-
if (!suspendsCounts2.containsKey(threadName)) {
192-
complain("ERROR: couldn't get ThreadReference for " + threadName);
193-
testExitCode = TEST_FAILED;
194-
break;
195-
}
196-
int count1 = suspendsCounts1.get(threadName);
197-
int count2 = suspendsCounts2.get(threadName);
198-
String eventThreadName = ((ThreadStartEvent)newEvent).thread().name();
199-
int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0);
200-
if (count1 != expectedValue) {
201-
complain("ERROR: suspendCounts don't match for : " + threadName);
202-
complain("before resuming : " + count1);
203-
complain("after resuming : " + count2);
204-
testExitCode = TEST_FAILED;
205-
break;
206-
}
207-
}
208-
break;
209-
210-
case SUSPEND_ALL :
211-
212-
display(" case SUSPEND_ALL");
213-
for (String threadName : suspendsCounts1.keySet()) {
214-
display("checking " + threadName);
215-
216-
if (!newEvent.request().equals(eventRequest))
217-
break;
218-
if (!suspendsCounts2.containsKey(threadName)) {
219-
complain("ERROR: couldn't get ThreadReference for " + threadName);
220-
testExitCode = TEST_FAILED;
221-
break;
222-
}
223-
int count1 = suspendsCounts1.get(threadName);
224-
int count2 = suspendsCounts2.get(threadName);
225-
if (count1 != count2 + 1) {
226-
complain("ERROR: suspendCounts don't match for : " + threadName);
227-
complain("before resuming : " + count1);
228-
complain("after resuming : " + count2);
229-
testExitCode = TEST_FAILED;
230-
break;
231-
}
178+
case SUSPEND_NONE :
179+
display(" case SUSPEND_NONE");
180+
for (String threadName : suspendsCounts1.keySet()) {
181+
display(" checking " + threadName);
182+
if (!suspendsCounts2.containsKey(threadName)) {
183+
complain("ERROR: couldn't get ThreadReference for "
184+
+ threadName);
185+
testExitCode = TEST_FAILED;
186+
break;
232187
}
233-
break;
234-
235-
default: throw new Failure("** default case 1 **");
188+
int count1 = suspendsCounts1.get(threadName);
189+
int count2 = suspendsCounts2.get(threadName);
190+
if (count1 != count2) {
191+
complain("ERROR: suspendCounts don't match for : "
192+
+ threadName);
193+
complain("before resuming : " + count1);
194+
complain("after resuming : " + count2);
195+
testExitCode = TEST_FAILED;
196+
break;
197+
}
198+
}
199+
break;
200+
201+
case SUSPEND_THREAD :
202+
display(" case SUSPEND_THREAD");
203+
for (String threadName : suspendsCounts1.keySet()) {
204+
display("checking " + threadName);
205+
if (!suspendsCounts2.containsKey(threadName)) {
206+
complain("ERROR: couldn't get ThreadReference for "
207+
+ threadName);
208+
testExitCode = TEST_FAILED;
209+
break;
210+
}
211+
int count1 = suspendsCounts1.get(threadName);
212+
int count2 = suspendsCounts2.get(threadName);
213+
String eventThreadName = ((ThreadStartEvent)newEvent)
214+
.thread().name();
215+
int expectedValue = count2 +
216+
(eventThreadName.equals(threadName) ? 1 : 0);
217+
if (count1 != expectedValue) {
218+
complain("ERROR: suspendCounts don't match for : "
219+
+ threadName);
220+
complain("before resuming : " + count1);
221+
complain("after resuming : " + count2);
222+
testExitCode = TEST_FAILED;
223+
break;
224+
}
225+
}
226+
break;
227+
228+
case SUSPEND_ALL :
229+
display(" case SUSPEND_ALL");
230+
for (String threadName : suspendsCounts1.keySet()) {
231+
display("checking " + threadName);
232+
if (!newEvent.request().equals(eventRequest))
233+
break;
234+
if (!suspendsCounts2.containsKey(threadName)) {
235+
complain("ERROR: couldn't get ThreadReference for "
236+
+ threadName);
237+
testExitCode = TEST_FAILED;
238+
break;
239+
}
240+
int count1 = suspendsCounts1.get(threadName);
241+
int count2 = suspendsCounts2.get(threadName);
242+
if (count1 != count2 + 1) {
243+
complain("ERROR: suspendCounts don't match for : "
244+
+ threadName);
245+
complain("before resuming : " + count1);
246+
complain("after resuming : " + count2);
247+
testExitCode = TEST_FAILED;
248+
break;
249+
}
250+
}
251+
break;
252+
default: throw new Failure("** default case 1 **");
236253
}
237-
}
254+
informDebuggeeTestCase(i);
238255

256+
}
239257
display("......--> vm.resume()");
240258
vm.resume();
241259
}
242260
return;
243261
}
244-
245262
private ThreadStartRequest settingThreadStartRequest(int suspendPolicy,
246263
String property) {
247264
try {
@@ -254,5 +271,22 @@ private ThreadStartRequest settingThreadStartRequest(int suspendPolicy,
254271
throw new Failure("** FAILURE to set up ThreadStartRequest **");
255272
}
256273
}
257-
274+
/**
275+
* Inform debuggee which thread test the debugger has completed.
276+
* Used for synchronization, so the debuggee does not move too quickly.
277+
* @param testCase index of just completed test
278+
*/
279+
void informDebuggeeTestCase(int testCase) {
280+
try {
281+
((ClassType)debuggeeClass)
282+
.setValue(debuggeeClass.fieldByName("testCase"),
283+
vm.mirrorOf(testCase));
284+
} catch (InvalidTypeException ite) {
285+
throw new Failure("** FAILURE setting testCase **");
286+
} catch (ClassNotLoadedException cnle) {
287+
throw new Failure("** FAILURE notifying debuggee **");
288+
} catch (VMDisconnectedException e) {
289+
throw new Failure("** FAILURE debuggee connection **");
290+
}
291+
}
258292
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java

+44-46
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
public class resume008a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
3737

3838
static final int PASSED = 0;
3939
static final int FAILED = 2;
@@ -62,6 +62,7 @@ private static void logErr(String message) {
6262

6363
static int exitCode = PASSED;
6464

65+
static int testCase = -1;
6566
static int instruction = 1;
6667
static int end = 0;
6768
// static int quit = 0;
@@ -70,6 +71,7 @@ private static void logErr(String message) {
7071

7172
static int lineForComm = 2;
7273

74+
// Debugger sets a breakpoint here to track debuggee
7375
private static void methodForCommunication() {
7476
int i1 = instruction;
7577
int i2 = i1;
@@ -85,47 +87,38 @@ public static void main (String argv[]) {
8587
log1("debuggee started!");
8688

8789
label0:
88-
for (int i = 0; ; i++) {
89-
90-
if (instruction > maxInstr) {
91-
logErr("ERROR: unexpected instruction: " + instruction);
92-
exitCode = FAILED;
93-
break ;
94-
}
95-
96-
switch (i) {
97-
90+
for (int i = 0; ; i++) {
91+
if (instruction > maxInstr) {
92+
logErr("ERROR: unexpected instruction: " + instruction);
93+
exitCode = FAILED;
94+
break ;
95+
}
96+
switch (i) {
9897
//------------------------------------------------------ section tested
99-
100-
case 0:
101-
thread0 = new Threadresume008a("thread0");
102-
methodForCommunication();
103-
104-
threadStart(thread0);
105-
106-
thread1 = new Threadresume008a("thread1");
107-
methodForCommunication();
108-
break;
109-
110-
case 1:
111-
threadStart(thread1);
112-
113-
thread2 = new Threadresume008a("thread2");
114-
methodForCommunication();
115-
break;
116-
117-
case 2:
118-
threadStart(thread2);
119-
120-
//------------------------------------------------- standard end section
121-
122-
default:
123-
instruction = end;
124-
methodForCommunication();
125-
break label0;
126-
}
98+
case 0:
99+
thread0 = new Threadresume008a("thread0");
100+
methodForCommunication();
101+
threadStart(thread0);
102+
thread1 = new Threadresume008a("thread1");
103+
// Wait for debugger to complete the first test case
104+
// before advancing to the first breakpoint
105+
waitForTestCase(0);
106+
methodForCommunication();
107+
break;
108+
case 1:
109+
threadStart(thread1);
110+
thread2 = new Threadresume008a("thread2");
111+
methodForCommunication();
112+
break;
113+
case 2:
114+
threadStart(thread2);
115+
//------------------------------------------------- standard end section
116+
default:
117+
instruction = end;
118+
methodForCommunication();
119+
break label0;
127120
}
128-
121+
}
129122
log1("debuggee exits");
130123
System.exit(exitCode + PASS_BASE);
131124
}
@@ -145,24 +138,29 @@ static int threadStart(Thread t) {
145138
}
146139
return PASSED;
147140
}
148-
141+
// Synchronize with debugger progression.
142+
static void waitForTestCase(int t) {
143+
while (testCase < t) {
144+
try {
145+
Thread.sleep(100);
146+
} catch (InterruptedException e) {
147+
// ignored
148+
}
149+
}
150+
}
149151
static class Threadresume008a extends Thread {
150-
151152
String tName = null;
152-
153153
public Threadresume008a(String threadName) {
154154
super(threadName);
155155
tName = threadName;
156156
}
157-
158157
public void run() {
159158
log1(" 'run': enter :: threadName == " + tName);
160159
synchronized (waitnotifyObj) {
161-
waitnotifyObj.notify();
160+
waitnotifyObj.notify();
162161
}
163162
log1(" 'run': exit :: threadName == " + tName);
164163
return;
165164
}
166165
}
167-
168166
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java

+28-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
* To check up on the method, a debugger,
5151
* upon getting new set for the EventSet,
5252
* suspends VM with the method VirtualMachine.suspend(),
53-
* gets the List of geduggee's threads calling VM.allThreads(),
53+
* gets the List of debuggee's threads calling VM.allThreads(),
5454
* invokes the method EventSet.resume(), and
55-
* gets another List of geduggee's threads.
55+
* gets another List of debuggee's threads.
5656
* The debugger then compares values of
5757
* each thread's suspendCount from first and second Lists.
5858
*
@@ -63,6 +63,13 @@
6363
* to be resulting in the event.
6464
* - Upon getting new event, the debugger
6565
* performs the check corresponding to the event.
66+
* - The debugger informs the debuggee when it completes
67+
* each test case, so it will wait before hitting
68+
* communication breakpoints.
69+
* This prevents the breakpoint SUSPEND_ALL policy
70+
* disrupting the first test case check for
71+
* SUSPEND_NONE, if the debuggee gets ahead of
72+
* the debugger processing.
6673
*/
6774

6875
public class resume009 extends TestDebuggerType1 {
@@ -233,6 +240,7 @@ protected void testRun() {
233240

234241
default: throw new Failure("** default case 1 **");
235242
}
243+
informDebuggeeTestCase(i);
236244
}
237245

238246
display("......--> vm.resume()");
@@ -253,5 +261,22 @@ private ThreadDeathRequest settingThreadDeathRequest(int suspendPolicy,
253261
throw new Failure("** FAILURE to set up ThreadDeathRequest **");
254262
}
255263
}
256-
264+
/**
265+
* Inform debuggee which thread test the debugger has completed.
266+
* Used for synchronization, so the debuggee does not move too quickly.
267+
* @param testCase index of just completed test
268+
*/
269+
void informDebuggeeTestCase(int testCase) {
270+
try {
271+
((ClassType)debuggeeClass)
272+
.setValue(debuggeeClass.fieldByName("testCase"),
273+
vm.mirrorOf(testCase));
274+
} catch (InvalidTypeException ite) {
275+
throw new Failure("** FAILURE setting testCase **");
276+
} catch (ClassNotLoadedException cnle) {
277+
throw new Failure("** FAILURE notifying debuggee **");
278+
} catch (VMDisconnectedException e) {
279+
throw new Failure("** FAILURE debuggee connection **");
280+
}
281+
}
257282
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
public class resume009a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
3737

3838
static final int PASSED = 0;
3939
static final int FAILED = 2;
@@ -62,6 +62,7 @@ private static void logErr(String message) {
6262

6363
static int exitCode = PASSED;
6464

65+
static int testCase = -1;
6566
static int instruction = 1;
6667
static int end = 0;
6768
// static int quit = 0;
@@ -104,6 +105,9 @@ public static void main (String argv[]) {
104105
threadRun(thread0);
105106

106107
thread1 = new Threadresume009a("thread1");
108+
// Wait for debugger to complete the first test case
109+
// before advancing to the first breakpoint
110+
waitForTestCase(0);
107111
methodForCommunication();
108112
break;
109113

@@ -152,6 +156,16 @@ static int threadRun(Thread t) {
152156
}
153157
return PASSED;
154158
}
159+
// Synchronize with debugger progression.
160+
static void waitForTestCase(int t) {
161+
while (testCase < t) {
162+
try {
163+
Thread.sleep(100);
164+
} catch (InterruptedException e) {
165+
// ignored
166+
}
167+
}
168+
}
155169

156170
static class Threadresume009a extends Thread {
157171

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java

+23-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
* To check up on the method, a debugger, <BR>
4949
* upon getting new set for the EventSet, <BR>
5050
* suspends VM with the method VirtualMachine.suspend(), <BR>
51-
* gets the List of geduggee's threads calling VM.allThreads(), <BR>
51+
* gets the List of debuggee's threads calling VM.allThreads(), <BR>
5252
* invokes the method EventSet.resume(), and <BR>
53-
* gets another List of geduggee's threads. <BR>
53+
* gets another List of debuggee's threads. <BR>
5454
* The debugger then compares values of <BR>
5555
* each thread's suspendCount from first and second Lists. <BR>
5656
* <BR>
@@ -87,12 +87,12 @@
8787

8888
public class resume010 {
8989

90-
//----------------------------------------------------- templete section
90+
//----------------------------------------------------- template section
9191
static final int PASSED = 0;
9292
static final int FAILED = 2;
9393
static final int PASS_BASE = 95;
9494

95-
//----------------------------------------------------- templete parameters
95+
//----------------------------------------------------- template parameters
9696
static final String
9797
sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume010 ",
9898
sHeader2 = "--> debugger: ",
@@ -488,6 +488,7 @@ private void testRun()
488488
default:
489489
throw new JDITestRuntimeException("** default case 1 **");
490490
}
491+
informDebuggeeTestCase(i);
491492
}
492493

493494
log2("......--> vm.resume()");
@@ -627,5 +628,22 @@ private StepRequest settingStepRequest ( ThreadReference thread,
627628
throw new JDITestRuntimeException("** FAILURE to set up StepRequest **");
628629
}
629630
}
630-
631+
/**
632+
* Inform debuggee which thread test the debugger has completed.
633+
* Used for synchronization, so the debuggee does not move too quickly.
634+
* @param testCase index of just completed test
635+
*/
636+
void informDebuggeeTestCase(int testCase) {
637+
try {
638+
((ClassType)debuggeeClass)
639+
.setValue(debuggeeClass.fieldByName("testCase"),
640+
vm.mirrorOf(testCase));
641+
} catch (InvalidTypeException ite) {
642+
throw new Failure("** FAILURE setting testCase **");
643+
} catch (ClassNotLoadedException cnle) {
644+
throw new Failure("** FAILURE notifying debuggee **");
645+
} catch (VMDisconnectedException e) {
646+
throw new Failure("** FAILURE debuggee connection **");
647+
}
648+
}
631649
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java

+18-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
public class resume010a {
3535

36-
//----------------------------------------------------- templete section
36+
//----------------------------------------------------- template section
3737

3838
static final int PASSED = 0;
3939
static final int FAILED = 2;
@@ -60,6 +60,7 @@ private static void logErr(String message) {
6060

6161
static int exitCode = PASSED;
6262

63+
static int testCase = -1;
6364
static int instruction = 1;
6465
static int end = 0;
6566
// static int quit = 0;
@@ -98,8 +99,12 @@ public static void main (String argv[]) {
9899

99100
//------------------------------------------------------ section tested
100101

101-
case 0: resume010aTestClass.method();
102-
break;
102+
case 0:
103+
resume010aTestClass.method();
104+
// Wait for debugger to complete the first test case
105+
// before advancing to the first breakpoint
106+
waitForTestCase(0);
107+
break;
103108

104109
case 1: resume010aTestClass.method();
105110
break;
@@ -117,7 +122,16 @@ public static void main (String argv[]) {
117122

118123
System.exit(exitCode + PASS_BASE);
119124
}
120-
125+
// Synchronize with debugger progression.
126+
static void waitForTestCase(int t) {
127+
while (testCase < t) {
128+
try {
129+
Thread.sleep(100);
130+
} catch (InterruptedException e) {
131+
// ignored
132+
}
133+
}
134+
}
121135
}
122136
class resume010aTestClass {
123137

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Sep 20, 2023

@openjdk-notifier[bot]
Please sign in to comment.