RFR: 8292250: Create test for co-located JDI MethodEntry, Step, and Breakpoint events
Chris Plummer
cjplummer at openjdk.org
Thu Aug 11 16:16:36 UTC 2022
On Thu, 11 Aug 2022 16:03:58 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
> We currently have no tests for co-located MethodEntry, Step, and Breakpoint events. We should make sure they are being properly co-located as described in the JDI spec, and also do special test cases for [JDK-8292217](https://bugs.openjdk.org/browse/JDK-8292217).
>
> https://docs.oracle.com/en/java/javase/17/docs/api/jdk.jdi/com/sun/jdi/event/EventSet.html
>
> And sorry in advance that the logic is a bit hard to follow in this test due to having multiple test cases, and dealing with the async nature of JDI testing. All I can say is that is used to be a lot worse before I did multiple passes to improve it.
Here is output from a test run that might be useful when reviewing the test:
Got main thread: instance of java.lang.Thread(name='main', id=1)
Waiting for events:
EventSet for test case #0: event set, policy:2, count:1 = {BreakpointEvent at CLEDebugee:75 in thread main}
Got BreakpointEvent(1): CLEDebugee.test1:75
EventSet for test case #1: event set, policy:2, count:5 = {MethodEntryEvent at java.lang.ClassLoader:521 in thread main, MethodEntryEvent at jdk.internal.loader.ClassLoaders$AppClassLoader:180 in thread main, MethodEntryEvent at java.lang.System:497 in thread main, MethodEntryEvent at java.lang.System:205 in thread main, MethodExitEvent at java.lang.System:205 in thread main}
TESTCASE #1 FAILED (ignoring): too many events in EventSest: 5
Got MethodEntryEvent: java.lang.ClassLoader.loadClass:521
Got MethodEntryEvent: jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass:180
Got MethodEntryEvent: java.lang.System.getSecurityManager:497
Got MethodEntryEvent: java.lang.System.allowSecurityManager:205
Got MethodExitEvent: java.lang.System.allowSecurityManager:205
EventSet for test case #1: event set, policy:2, count:1 = {StepEvent at CLEDebugee:76 in thread main}
Got StepEvent: CLEDebugee.test1:76
EventSet for test case #1: event set, policy:2, count:1 = {BreakpointEvent at CLEDebugee:78 in thread main}
Got BreakpointEvent(2): CLEDebugee.test2:78
EventSet for test case #2: event set, policy:2, count:5 = {MethodEntryEvent at java.lang.ClassLoader:521 in thread main, MethodEntryEvent at jdk.internal.loader.ClassLoaders$AppClassLoader:180 in thread main, MethodEntryEvent at java.lang.System:497 in thread main, MethodEntryEvent at java.lang.System:205 in thread main, MethodExitEvent at java.lang.System:205 in thread main}
TESTCASE #2 FAILED (ignoring): too many events in EventSest: 5
Got MethodEntryEvent: java.lang.ClassLoader.loadClass:521
Got MethodEntryEvent: jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass:180
Got MethodEntryEvent: java.lang.System.getSecurityManager:497
Got MethodEntryEvent: java.lang.System.allowSecurityManager:205
Got MethodExitEvent: java.lang.System.allowSecurityManager:205
EventSet for test case #2: event set, policy:2, count:1 = {StepEvent at t2:44 in thread main}
Got StepEvent: t2.foo:44
EventSet for test case #2: event set, policy:2, count:1 = {BreakpointEvent at CLEDebugee:63 in thread main}
Got BreakpointEvent(3): CLEDebugee.runTests:63
EventSet for test case #3: event set, policy:2, count:3 = {MethodEntryEvent at CLEDebugee:87 in thread main, StepEvent at CLEDebugee:87 in thread main, BreakpointEvent at CLEDebugee:87 in thread main}
Got MethodEntryEvent: CLEDebugee.test3:87
Got StepEvent: CLEDebugee.test3:87
Got BreakpointEvent(4): CLEDebugee.test3:87
TESTCASE #3 PASSED
EventSet for test case #3: event set, policy:2, count:1 = {BreakpointEvent at CLEDebugee:64 in thread main}
Got BreakpointEvent(5): CLEDebugee.runTests:64
EventSet for test case #4: event set, policy:2, count:2 = {MethodEntryEvent at CLEDebugee:95 in thread main, BreakpointEvent at CLEDebugee:95 in thread main}
Got MethodEntryEvent: CLEDebugee.test4:95
Got BreakpointEvent(6): CLEDebugee.test4:95
TESTCASE #4 PASSED
EventSet for test case #4: event set, policy:2, count:1 = {BreakpointEvent at CLEDebugee:65 in thread main}
Got BreakpointEvent(7): CLEDebugee.runTests:65
EventSet for test case #5: event set, policy:2, count:2 = {StepEvent at CLEDebugee:102 in thread main, BreakpointEvent at CLEDebugee:102 in thread main}
Got StepEvent: CLEDebugee.test5:102
Got BreakpointEvent(8): CLEDebugee.test5:102
TESTCASE #5 PASSED
EventSet for test case #5: event set, policy:2, count:1 = {BreakpointEvent at CLEDebugee:66 in thread main}
Got BreakpointEvent(9): CLEDebugee.runTests:66
EventSet for test case #6: event set, policy:2, count:2 = {MethodEntryEvent at CLEDebugee:109 in thread main, StepEvent at CLEDebugee:109 in thread main}
Got MethodEntryEvent: CLEDebugee.test6:109
Got StepEvent: CLEDebugee.test6:109
TESTCASE #6 PASSED
EventSet for test case #6: event set, policy:2, count:2 = {VMDeathEvent, VMDeathEvent}
All done...
EventSet for test case #6: event set, policy:0, count:1 = {VMDisconnectEvent}
-------------
PR: https://git.openjdk.org/jdk/pull/9840
More information about the serviceability-dev
mailing list