On Sun, 8 Sep 2024 15:30:21 GMT, SendaoYan <[email protected]> wrote:

> Hi all,
>   The newly added testcase 
> `serviceability/jvmti/vthread/TestPinCaseWithCFLH/TestPinCaseWithCFLH.java` 
> fails with `-Xcomp` jvm option. The jvm option `-Xcomp` will make 
> `BackgroundCompilation` false. In this test, disable `BackgroundCompilation` 
> will make `instrumentation` in `premain` throw 
> `java.util.MissingResourceException` in some test  environments. If I add 
> `Thread.sleep(1000)` before `instrumentation.addTransformer`, this test also 
> passed with `-Xcomp`.
>    So, I think it's necessary add `-XX:+BackgroundCompilation` option for 
> this test to make this test more robustness, to make this test run passed 
> with `-Xcomp` option.
>   Test-fix only, no risk.

If I add `Thread.sleep(1000)` before `instrumentation.addTransformer`, this 
test also passed with `-Xcomp`.


diff --git 
a/test/hotspot/jtreg/serviceability/jvmti/vthread/TestPinCaseWithCFLH/TestPinCaseWithCFLH.java
 
b/test/hotspot/jtreg/serviceability/jvmti/vthread/TestPinCaseWithCFLH/TestPinCaseWithCFLH.java
index 02755a0289f..71ac861d98b 100644
--- 
a/test/hotspot/jtreg/serviceability/jvmti/vthread/TestPinCaseWithCFLH/TestPinCaseWithCFLH.java
+++ 
b/test/hotspot/jtreg/serviceability/jvmti/vthread/TestPinCaseWithCFLH/TestPinCaseWithCFLH.java
@@ -53,6 +53,7 @@ public byte[] transform(ClassLoader loader, String className, 
Class<?> classBein
 
     // Called when agent is loaded at startup
     public static void premain(String agentArgs, Instrumentation 
instrumentation) throws Exception {
+        Thread.sleep(1000);
         instrumentation.addTransformer(new TestClassFileTransformer());
     }
 
@@ -74,4 +75,4 @@ public static void main(String[] args) throws Exception{
         t1.join();
     }

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

PR Comment: https://git.openjdk.org/jdk/pull/20906#issuecomment-2337515194

Reply via email to