jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8292250: Create test for co-located JDI MethodEntry, Step, and Breakpoint events

Open plummercj opened this issue 3 years ago • 5 comments

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://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.


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8292250: Create test for co-located JDI MethodEntry, Step, and Breakpoint events

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9840/head:pull/9840
$ git checkout pull/9840

Update a local copy of the PR:
$ git checkout pull/9840
$ git pull https://git.openjdk.org/jdk pull/9840/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9840

View PR using the GUI difftool:
$ git pr show -t 9840

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9840.diff

plummercj avatar Aug 11 '22 16:08 plummercj

:wave: Welcome back cjplummer! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Aug 11 '22 16:08 bridgekeeper[bot]

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@CLEDebugee:75 in thread main} Got BreakpointEvent(1): CLEDebugee.test1:75

EventSet for test case #1: event set, policy:2, count:5 = {[email protected]:521 in thread main, [email protected]$AppClassLoader:180 in thread main, [email protected]:497 in thread main, [email protected]:205 in thread main, [email protected]:205 in thread main} TESTCASE #1 FAILED (ignoring): too many events in EventSet: 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@CLEDebugee:76 in thread main} Got StepEvent: CLEDebugee.test1:76

EventSet for test case #1: event set, policy:2, count:1 = {BreakpointEvent@CLEDebugee:78 in thread main} Got BreakpointEvent(2): CLEDebugee.test2:78

EventSet for test case #2: event set, policy:2, count:5 = {[email protected]:521 in thread main, [email protected]$AppClassLoader:180 in thread main, [email protected]:497 in thread main, [email protected]:205 in thread main, [email protected]:205 in thread main} TESTCASE #2 FAILED (ignoring): too many events in EventSet: 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@t2:44 in thread main} Got StepEvent: t2.foo:44

EventSet for test case #2: event set, policy:2, count:1 = {BreakpointEvent@CLEDebugee:63 in thread main} Got BreakpointEvent(3): CLEDebugee.runTests:63

EventSet for test case #3: event set, policy:2, count:3 = {MethodEntryEvent@CLEDebugee:87 in thread main, StepEvent@CLEDebugee:87 in thread main, BreakpointEvent@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@CLEDebugee:64 in thread main} Got BreakpointEvent(5): CLEDebugee.runTests:64

EventSet for test case #4: event set, policy:2, count:2 = {MethodEntryEvent@CLEDebugee:95 in thread main, BreakpointEvent@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@CLEDebugee:65 in thread main} Got BreakpointEvent(7): CLEDebugee.runTests:65

EventSet for test case #5: event set, policy:2, count:2 = {StepEvent@CLEDebugee:102 in thread main, BreakpointEvent@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@CLEDebugee:66 in thread main} Got BreakpointEvent(9): CLEDebugee.runTests:66

EventSet for test case #6: event set, policy:2, count:2 = {MethodEntryEvent@CLEDebugee:109 in thread main, StepEvent@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}

plummercj avatar Aug 11 '22 16:08 plummercj

@plummercj The following label will be automatically applied to this pull request:

  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Aug 11 '22 16:08 openjdk[bot]

Ping!

plummercj avatar Aug 15 '22 18:08 plummercj

@plummercj This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8292250: Create test for co-located JDI MethodEntry, Step, and Breakpoint events

Reviewed-by: amenkov, kevinw

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 162 new commits pushed to the master branch:

  • e353b572a54edbbf0df1f01afa36067500157603: 8292890: Remove PrintTouchedMethodsAtExit and LogTouchedMethods
  • 95a33fe1502b6f0db2c60fa92b389fda74d94407: 8292314: Cleanup legacy address handling
  • 5d799d80e638b85fa3881904e7330ffb5100764a: 8292304: [REDO] JDK-8289208 Test DrawRotatedStringUsingRotatedFont.java occasionally crashes on MacOS
  • 4f50316a1a985cd06af7eed158d7e1917b86d159: 8292680: Convert Dictionary to ConcurrentHashTable
  • 2fe0ce01485d7b84dc109d3d4f24bdd908c0e7cf: 8292203: AArch64: Represent Registers as values
  • 251bff6beeafcd98824dab60e9831c0175fe0689: 8292877: java/util/concurrent/atomic/Serial.java uses {Double,Long}Accumulator incorrectly
  • f57d34242c9b47936d137589fc75ab794d39a9d1: 8292867: RISC-V: Simplify weak CAS return value handling
  • 88af204027ec51d6e13516fa61e1c217a9445c62: 8292494: Ensure SystemDictionary::set_platform_loader and set_system_loader are called only once
  • 8d3d4397ccbfadab99fe572f0d0a8504d268a0dc: 8292903: enhance round_up_power_of_2 assertion output
  • 054c23f484522881a0879176383d970a8de41201: 8290025: Remove the Sweeper
  • ... and 152 more: https://git.openjdk.org/jdk/compare/a28ab7b62abcfce56425d62d5a8162d8f1623393...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar Aug 24 '22 19:08 openjdk[bot]

I had to undo the last change that checked if the breakpoint was the expected one. There were two issues. The first was that the breakpoints are not in order, so it always threw an exception on the first breakpoint. However, the test still passed. That was because of a pre-existing bug. I declared testFailed locally within the test class. The overrode the one declared in TestScaffold, and which gets set false if there is an exception thrown in the event handler. I got rid of the override, and then test started to properly fail due to the incorrect breakpoint checks, which I have now also removed.

plummercj avatar Aug 25 '22 19:08 plummercj

Thanks!

plummercj avatar Aug 25 '22 22:08 plummercj

/integrate

plummercj avatar Aug 25 '22 22:08 plummercj

Going to push as commit d83faeaf9ab3584de6af23de16aad3738d179c86. Since your change was applied there have been 162 commits pushed to the master branch:

  • e353b572a54edbbf0df1f01afa36067500157603: 8292890: Remove PrintTouchedMethodsAtExit and LogTouchedMethods
  • 95a33fe1502b6f0db2c60fa92b389fda74d94407: 8292314: Cleanup legacy address handling
  • 5d799d80e638b85fa3881904e7330ffb5100764a: 8292304: [REDO] JDK-8289208 Test DrawRotatedStringUsingRotatedFont.java occasionally crashes on MacOS
  • 4f50316a1a985cd06af7eed158d7e1917b86d159: 8292680: Convert Dictionary to ConcurrentHashTable
  • 2fe0ce01485d7b84dc109d3d4f24bdd908c0e7cf: 8292203: AArch64: Represent Registers as values
  • 251bff6beeafcd98824dab60e9831c0175fe0689: 8292877: java/util/concurrent/atomic/Serial.java uses {Double,Long}Accumulator incorrectly
  • f57d34242c9b47936d137589fc75ab794d39a9d1: 8292867: RISC-V: Simplify weak CAS return value handling
  • 88af204027ec51d6e13516fa61e1c217a9445c62: 8292494: Ensure SystemDictionary::set_platform_loader and set_system_loader are called only once
  • 8d3d4397ccbfadab99fe572f0d0a8504d268a0dc: 8292903: enhance round_up_power_of_2 assertion output
  • 054c23f484522881a0879176383d970a8de41201: 8290025: Remove the Sweeper
  • ... and 152 more: https://git.openjdk.org/jdk/compare/a28ab7b62abcfce56425d62d5a8162d8f1623393...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Aug 25 '22 22:08 openjdk[bot]

@plummercj Pushed as commit d83faeaf9ab3584de6af23de16aad3738d179c86.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Aug 25 '22 22:08 openjdk[bot]