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/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java"
(same errors)
With the fix everything above passes.
Tested on linux-aarch64, macos-aarch64 using specific tests + tier1 suite
without additional options.
-------------
Commit messages:
- 8377729: Running jtreg tests with -agent... option causes some tests to fail
due to duplicate -agent options provided to a subprocess
Changes: https://git.openjdk.org/jdk/pull/29684/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29684&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8377729
Stats: 26 lines in 2 files changed: 24 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/29684.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29684/head:pull/29684
PR: https://git.openjdk.org/jdk/pull/29684