RFR: 8292250: Create test for co-located JDI MethodEntry, Step, and Breakpoint events [v2]

Alex Menkov amenkov at openjdk.org
Fri Aug 19 23:18:40 UTC 2022


On Thu, 11 Aug 2022 16:45:54 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.
>
> Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix minor typo in output.

test/jdk/com/sun/jdi/CLETest.java line 137:

> 135:         String method;
> 136:         String signature;
> 137:         int lineNumber;

Should be final

test/jdk/com/sun/jdi/CLETest.java line 161:

> 159:         try {
> 160:             List frames = thread.frames();
> 161:             Iterator iter = frames.iterator();

List<StackFrame>, Iterator<StackFrame> and type cast is not needed2 lines below

test/jdk/com/sun/jdi/CLETest.java line 231:

> 229:                 testcaseFailed = false;
> 230:             }
> 231:         }

break missed

test/jdk/com/sun/jdi/CLETest.java line 237:

> 235:                 testcaseFailed = false;
> 236:             }
> 237:         }

break missed

test/jdk/com/sun/jdi/CLETest.java line 243:

> 241:                 testcaseFailed = false;
> 242:             }
> 243:         }

break missed

test/jdk/com/sun/jdi/CLETest.java line 249:

> 247:                 testcaseFailed = false;
> 248:             }
> 249:         }

break missed

test/jdk/com/sun/jdi/CLETest.java line 409:

> 407:             // Setup all breakpoints
> 408:             for (MethodBreakpointData bpData : breakpoints) {
> 409:                 Location loc = findMethodLocation(targetClass, bpData.method,

Specify breakpoints by line number in a method is better than just line number, but did you think about mark them with some tag and parse source file to get line numbers? (like in test/jdk/com/sun/jdi/lib/jdb/JdbTest.java, parseBreakpoints method)

-------------

PR: https://git.openjdk.org/jdk/pull/9840


More information about the serviceability-dev mailing list