No test calls ThreadStartRequest.addPlatformThreadsOnlyFilter() directly. This 
adds one.

The debuggee starts two platform and two virtual threads itself, joins them and 
hits a breakpoint. The debugger has a filtered start request and a plain one 
enabled side by side. The filtered one must see each platform thread once and 
neither virtual thread. The plain one must see all four, otherwise the zero on 
the filtered side proves nothing. After that the plain requests are deleted and 
a second set of threads runs with only the filtered requests on.

Same checks for ThreadDeathRequest in the same test, it has the same method.

Carrier threads start in the middle of this and land on the filtered requests 
too. Those are not counted, the test only checks that none of them is virtual.

It creates its own threads, it does the same with and without the virtual 
thread factory. No existing test is touched. Not covered: the filter combined 
with a thread filter or count filter, and calling it on an enabled or deleted 
request.

Checked that it can fail. With the two filter calls removed it does.

---

Testing:
- [x] the new test on linux x64, linux aarch64, windows x64 and macos aarch64, 
debug and product, with and without the virtual thread factory, plus -Xcomp and 
ZGC on the debug builds. jdk_jdi with the virtual thread factory on linux x64 
and aarch64. tier1-3 on linux x64 and aarch64, the only failures there also 
fail in mainline CI.



---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - 8372536: Add testing of JDI 
ThreadStartRequest.addPlatformThreadsOnlyFilter() API

Changes: https://git.openjdk.org/jdk/pull/34069/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=34069&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372536
  Stats: 247 lines in 1 file changed: 247 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/34069.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/34069/head:pull/34069

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

Reply via email to