Skip to content

Commit d52e9ed

Browse files
committed
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

Lines changed: 28 additions & 3 deletions
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

Lines changed: 16 additions & 1 deletion
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

Lines changed: 23 additions & 5 deletions
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

Lines changed: 19 additions & 3 deletions
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

Lines changed: 24 additions & 5 deletions
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

Lines changed: 18 additions & 3 deletions
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

Lines changed: 23 additions & 5 deletions
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
}

0 commit comments

Comments
 (0)