RFR: 8377729: Running jtreg tests with -agent... option causes some tests to fail due to duplicate -agent options provided to a subprocess [v2]

Leonid Mesnik lmesnik at openjdk.org
Sat Feb 14 22:29:01 UTC 2026


On Sat, 14 Feb 2026 02:37:25 GMT, Kirill Shirokov <kshiroko at openjdk.org> wrote:

>> The fix removes duplicate `-agent...` and `-javaagent:...` options from test subprocess command line, thus allowing to run jtreg tests with agents that should be specified only once.
>> 
>> The fix tested manually:
>> 
>> 
>> $ make test JTREG="VERBOSE=summary,fail,error" TEST="test/jdk/sun/tools/jstack/DeadlockDetectionTest.java test/hotspot/jtreg/compiler/jvmci/events/JvmciShutdownEventTest.java test/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java"
>> 
>> ==============================
>> Test summary
>> ==============================
>>    TEST                                              TOTAL  PASS  FAIL ERROR  SKIP
>>    jtreg:test/jdk/sun/tools/jstack/DeadlockDetectionTest.java
>>                                                          1     1     0     0     0
>>    jtreg:test/hotspot/jtreg/compiler/jvmci/events/JvmciShutdownEventTest.java
>>                                                          1     1     0     0     0
>>    jtreg:test/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java
>>                                                          1     1     0     0     0
>> ==============================
>> TEST SUCCESS
>> 
>> $ make test JTREG="VERBOSE=summary,fail,error;JAVA_OPTIONS=-agentpath.../async-profiler-binaries/lib/libasyncProfiler.dylib=start,event=cpu,cstack=vm,loglevel=none,flat,file=/dev/null" TEST="test/jdk/sun/tools/jstack/DeadlockDetectionTest.java test/hotspot/jtreg/compiler/jvmci/events/JvmciShutdownEventTest.java test/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java"
>> 
>> ==============================
>> Test summary
>> ==============================
>>    TEST                                              TOTAL  PASS  FAIL ERROR  SKIP
>>    jtreg:test/jdk/sun/tools/jstack/DeadlockDetectionTest.java
>>>>                                                       1     0     1     0     0 <<
>>    jtreg:test/hotspot/jtreg/compiler/jvmci/events/JvmciShutdownEventTest.java
>>>>                                                       1     0     1     0     0 <<
>>    jtreg:test/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java
>>>>                                                       1     0     1     0     0 <<
>> ==============================
>> TEST FAILURE
>> 
>> $ make test JTREG="VERBOSE=summary,fail,error;VM_OPTIONS=-agentpath:.../async-profiler-binaries/lib/libasyncProfiler.dylib=start,event=cpu,cstack=vm,loglevel=none,flat,file=/dev/null" TEST="test/jdk/sun/tools/jstack/DeadlockDetectionTest.java test/hotspot/jtreg/compiler/jvmci/events/JvmciShutdownEventTest.java test/...
>
> Kirill Shirokov has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Remove trailing whitespace
>  - Removed duplicate VM options from test/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java, test/jdk/sun/tools/jstack/DeadlockDetectionTest.java, test/lib/jdk/test/lib/apps/LingeredApp.java, test/lib/jdk/test/lib/cli/CommandLineOptionTest.java. Added duplicate agent options warning to ProcessTools-spawned subprocesses and LingeredApp

@kirill-shirokov Just reminder: any non-trivial hotspot-related fix requires at least 2 reviews. Only one of them might be from 'R'eviewer. So I'll wait for second review before sponsoring the fix.
Also, we have rule to wait at least 24 hours before pushing non-trivial fixes. (Totally fine for this fix.)

Trivial fixes require only one review from 'R'eviewer and could be pushed immediately.  
The trivial fix is a simple fix or clean backout, for which author and reviewer explicitly confirm it's 'triviality'.

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

PR Comment: https://git.openjdk.org/jdk/pull/29684#issuecomment-3902673191


More information about the serviceability-dev mailing list