RFR: JDK-8310191: com/sun/tools/attach/warnings/DynamicLoadWarningTest.java second failure on AIX

Alan Bateman alanb at openjdk.org
Fri Jun 16 11:33:58 UTC 2023


On Fri, 16 Jun 2023 10:44:47 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> After push of [JDK-8307478](https://bugs.openjdk.org/browse/JDK-8307478) , the following test started to fail on AIX :
> com/sun/tools/attach/warnings/DynamicLoadWarningTest.java ; failure output :
> 
> java.lang.RuntimeException: 'WARNING: A JVM TI agent has been loaded dynamically' found in stderr
> at jdk.test.lib.process.OutputAnalyzer.stderrShouldNotContain(OutputAnalyzer.java:320)
> at DynamicLoadWarningTest$AppRunner.stderrShouldNotContain(DynamicLoadWarningTest.java:308)
> at DynamicLoadWarningTest.testLoadOneJvmtiAgent(DynamicLoadWarningTest.java:138)
> at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
> at java.base/java.lang.reflect.Method.invoke(Method.java:580)
> 
> Should be handled in a similar way to [JDK-8309549](https://bugs.openjdk.org/browse/JDK-8309549) .

Yes, same issue as JDK-8309549.

Would you mind grouping the two tests that load the same agent library twice? That would mean the isAIX check is in one place, e.g.



diff --git a/test/jdk/com/sun/tools/attach/warnings/DynamicLoadWarningTest.java b/test/jdk/com/sun/tools/attach/warnings/DynamicLoadWarningTest.java
index 4e341b4e274..970bade3530 100644
--- a/test/jdk/com/sun/tools/attach/warnings/DynamicLoadWarningTest.java
+++ b/test/jdk/com/sun/tools/attach/warnings/DynamicLoadWarningTest.java
@@ -119,23 +119,23 @@ class DynamicLoadWarningTest {
         test().whenRunning(loadJvmtiAgent1)
                 .stderrShouldContain(JVMTI_AGENT_WARNING);
 
-        // dynamically load loadJvmtiAgent1 twice, should be one warning on platforms
-        // that can detect if an agent library was previously loaded
-        if (!Platform.isAix()) {
-            test().whenRunning(loadJvmtiAgent1)
-                    .whenRunning(loadJvmtiAgent1)
-                    .stderrShouldContain(JVMTI_AGENT_WARNING, 1);
-        }
-
         // opt-in via command line option to allow dynamic loading of agents
         test().withOpts("-XX:+EnableDynamicAgentLoading")
                 .whenRunning(loadJvmtiAgent1)
                 .stderrShouldNotContain(JVMTI_AGENT_WARNING);
 
-        // start loadJvmtiAgent1 via the command line, then dynamically load loadJvmtiAgent1
-        test().withOpts("-agentpath:" + jvmtiAgentPath1)
-                .whenRunning(loadJvmtiAgent1)
-                .stderrShouldNotContain(JVMTI_AGENT_WARNING);
+        // test behavior on platforms that can detect if an agent library was previously loaded
+        if (!Platform.isAix()) {
+            // start loadJvmtiAgent1 via the command line, then dynamically load loadJvmtiAgent1
+            test().withOpts("-agentpath:" + jvmtiAgentPath1)
+                    .whenRunning(loadJvmtiAgent1)
+                    .stderrShouldNotContain(JVMTI_AGENT_WARNING);
+
+            // dynamically load loadJvmtiAgent1 twice, should be one warning
+            test().whenRunning(loadJvmtiAgent1)
+                    .whenRunning(loadJvmtiAgent1)
+                    .stderrShouldContain(JVMTI_AGENT_WARNING, 1);
+        }
     }

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

PR Comment: https://git.openjdk.org/jdk/pull/14515#issuecomment-1594532957


More information about the core-libs-dev mailing list