On Tue, 2 Jun 2026 23:30:35 GMT, Shiv Shah <[email protected]> wrote:

> The sleeping thread tests had a hardcoded list of jdk methods for checking 
> the stack trace so changes to Thread.sleep often required updating the tests. 
> Now they only require the java.lang.Thread.sleep entry frame and ignore 
> whatever sits above it while the callers below still go through the existing 
> expected methods. Calls to getThreadInfo without an explicit maximum depth 
> return no stack, so those paths skip the frame content check. 
> 
> strace001 samples running threads rather than sleeping threads, so it has no 
> Thread.sleep frame to use as a boundary. Instead, it finds the innermost 
> frame belonging to the test and ignores frames above it. Its stack length 
> check now uses the requested depth plus the expected method count instead of 
> the hardcoded depth + 7 estimate, and an unexpectedly empty snapshot now 
> fails instead of passing accidentally.
> 
> 
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: f11c9fca
Author:    Shiv Shah <[email protected]>
Committer: David Holmes <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/f11c9fca7e45466d3cb6688c053be4ba59eb10f0
Stats:     132 lines in 3 files changed: 73 ins; 54 del; 5 mod

8340088: Stack tracing tests of sleeping thread should be more resilient to 
code changes

Reviewed-by: dholmes, sspitsyn, coleenp

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

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

Reply via email to