On Thu, 8 Aug 2024 09:11:29 GMT, Jaikiran Pai <[email protected]> wrote:
>> 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
>
> When I proposed the `@clean` option, I had tried it locally and that had
> worked for me and I wasn't able to reproduce that issue anymore locally.
> However, looking at the failed GitHub actions job with the `@clean` option, I
> see this:
>
>
>
> #section:clean
> ----------messages:(5/232)----------
> command: clean jdk.test.lib.util.JavaAgentBuilder
> reason: User specified action: run clean jdk.test.lib.util.JavaAgentBuilder
> started: Thu Aug 08 07:40:24 UTC 2024
> finished: Thu Aug 08 07:40:24 UTC 2024
> elapsed time (seconds): 0.0
> ----------rerun:(2/367)*----------
> cd
> /Users/runner/work/jdk/jdk/build/run-test-prebuilt/test-support/jtreg_test_hotspot_jtreg_tier1_serviceability/scratch/0
> && \\
> rm -f
> /Users/runner/work/jdk/jdk/build/run-test-prebuilt/test-support/jtreg_test_hotspot_jtreg_tier1_serviceability/classes/0/serviceability/jvmti/vthread/TestPinCaseWithCFLH/TestPinCaseWithCFLH.d/jdk/test/lib/util/JavaAgentBuilder.class
> result: Passed. Clean successful
>
> #section:build
> ----------messages:(5/194)----------
> command: build jdk.test.lib.util.JavaAgentBuilder
> reason: Named class compiled on demand
> started: Thu Aug 08 07:40:24 UTC 2024
> finished: Thu Aug 08 07:40:24 UTC 2024
> elapsed time (seconds): 0.0
> result: Passed. All files up to date
>
> So jtreg in its clean action appears to have only deleted the test specific
> work directory:
>
>
> rm -f
> /Users/runner/work/jdk/jdk/build/run-test-prebuilt/test-support/jtreg_test_hotspot_jtreg_tier1_serviceability/classes/0/serviceability/jvmti/vthread/TestPinCaseWithCFLH/TestPinCaseWithCFLH.d/jdk/test/lib/util/JavaAgentBuilder.class
>
> and of course that `JavaAgentBuilder.class` won't be there and is instead
> present in the shared directory at
> `/Users/runner/work/jdk/jdk/build/run-test-prebuilt/test-support/jtreg_test_hotspot_jtreg_tier1_serviceability/classes/0/test/lib`.
> So jtreg didn't clean up the shared directory location and let that class
> stay around which effectively meant the `@clean` ended up being a no-op.
>
> I have run out of ideas to introduce a proper workaround here. The right fix
> of course needs to happen in jtreg, which I will see if there are ways to
> implement it there.
>
> For now, it looks like the `@build jdk.test.lib.Utils` approach you used and
> made the test pass is the only way to make this consistently pass.
Thanks for your help. I changed it back.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20373#discussion_r1709062181