On Thu, 13 Aug 2026 04:51:36 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).
>
> Shiv Shah has updated the pull request with a new target base due to a merge 
> or a rebase. The incremental webrev excludes the unrelated changes brought in 
> by the merge/rebase. The pull request contains three additional commits since 
> the last revision:
> 
>  - Require the Thread.sleep entry frame instead of accepting any JDK frame
>  - Merge branch 'master' into JDK-8340088-v2
>  - 8340088: Stack tracing tests of sleeping thread should be more resilient 
> to code changes

test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/SleepingThread.java 
line 110:

> 108:                 log.info("No java.lang.Thread.sleep frame in stack trace 
> for: " + this);
> 109:                 return false;
> 110:         }

I don't know why you had to add this.  Doesn't checkStackTraceElement with the 
limited expectedMethods only check for java.lang.Thread.
I feel like this test infrastructure is overly complicated and should be 
reduced at every opportunity.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31357#discussion_r3843879526

Reply via email to