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); + } } /**