On Wed, 31 May 2023 10:30:22 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:

>> The VM option EnableDynamicAgentLoading was added in JDK 9, default true, to 
>> allow deployment to choose whether to allow agents to be loaded/started in 
>> the VM. The VM option does the right thing for tools using the Attach API 
>> but jcmd JVMTI.agent_load was missed. This should be fixed to disallow 
>> loading JVMTI agents when the EnableDynamicAgentLoading is false.
>> 
>> The CSR is:
>> [JDK-8309250](https://bugs.openjdk.org/browse/JDK-8309250): jcmd 
>> JVMTI.agent_load should obey EnableDynamicAgentLoading
>> 
>> Testing:
>>  - run new test `test/jdk/sun/tools/jcmd/TestJcmdNoAgentLoad.java`
>>  - TBD: submit mach5 tiers 1-5 to make sure no new regressions are introduced
>
> Serguei Spitsyn has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   minor renaming in new test TestJcmdNoAgentLoad.java

test/jdk/sun/tools/jcmd/TestJcmdNoAgentLoad.java line 68:

> 66:                 System.out.println("Found output line with the expected 
> error message:\n" + line);
> 67:             }
> 68:         }

Why not just use  `OutputAnalyzer.shouldContain()`?

test/jdk/sun/tools/jcmd/TestJcmdNoAgentLoad.java line 70:

> 68:         }
> 69:         if (!seenPattern) {
> 70:             throw new RuntimeException("Not found expected error message 
> in output");

"Not found" -> "Did not find"

Also, you should include the expected error message in the output.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14244#discussion_r1212367038
PR Review Comment: https://git.openjdk.org/jdk/pull/14244#discussion_r1212367594

Reply via email to