On Thu, 8 Aug 2024 08:39:34 GMT, Jiawei Tang <jwt...@openjdk.org> wrote:

>> Building a test library class not actually used by the test is certainly 
>> somewhat odd. I wasn't aware of the `@clean` workaround but I see a lot of 
>> vmTestbase tests use it, so please try the `@clean` as Jai suggested. Thanks
>
> `@clean jdk.test.lib.util.JavaAgentBuilder` cannot solve the problem. 
> I find that the reason why `AgentWithVThreadTest.java` can pass is that when 
> compiling `AgentWithVThread.java`, it uses jdk.test.lib.Utils through 
> `import` (`import jdk.test.lib.process.ProcessTools;`, `import 
> jdk.test.lib.Utils;` is in the ProcessTools.java), so the test dir contains 
> jdk.test.lib.Utils. However, my new testcase doesn't use it. 
> <img 
> src=https://github.com/user-attachments/assets/cd80f76e-24b4-463b-bcfd-4b4ba32374cd
>  width=300 />
> 
> I tryed add `import jdk.test.lib.Utils;` in my testcase, it can pass.
> <img 
> src=https://github.com/user-attachments/assets/cfb10e17-23ae-47f4-b0da-e107fe06c711
>  width=400 />
> 
> 
> If I only run the new testcase, it can pass and the work dir look like this:
> <img 
> src=https://github.com/user-attachments/assets/ade018b0-c0b0-4675-b3a0-784b4ef82b78
>  width=300 />
> 
> If I run `AgentWithVThread.java` and then `TestPinCaseWithCFLH.java`, the 
> Utils.class is missed in test/lib/jdk/test/lib:
> <img 
> src=https://github.com/user-attachments/assets/83dd910c-ff61-4c06-9ccc-256b2d0ccf1f
>  width=300 />

A stable way to reproduce the problem: run AgentWithVThread.java and then 
TestPinCaseWithCFLH.java.


jtreg -v:error,fail -jdk:{JDKPATH} 
./test/hotspot/jtreg/serviceability/jvmti/vthread/premain/AgentWithVThreadTest.java
jtreg -v:error,fail -jdk:{JDKPATH} 
./test/hotspot/jtreg/serviceability/jvmti/vthread/TestPinCaseWithCFLH/TestPinCaseWithCFLH.java

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20373#discussion_r1708991727

Reply via email to