On Wed, 27 May 2026 04:43:07 GMT, Shiv Shah <[email protected]> wrote:

> Converted 44 shell tests to Java drivers using JavaAgentBuilder and test 
> library utilities
>  
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

test/jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh line 77:

> 75: esac
> 76: 
> 77: "$JAVA" ${TESTVMOPTS} ${TESTJAVAOPTS} -classpath "${TESTCLASSES}" Setup 
> "${TESTCLASSES}" Agent "${CYGWIN}"

Nit: Just to notice that the `${CYGWIN}` parameter to the agent is not 
supported by the `BootClassPathDriver.java`. In fact, I'm not sure if it is 
important or not. At least, it would be nice to understand better if we still 
need it for some Windows-like environments.

test/jdk/java/lang/instrument/MakeJAR4.sh line 46:

> 44: 
> 45: 
> 46: ${JAR} ${TESTTOOLVMOPTS} cvfm ${AGENT}.jar ${AGENT}.mf ${AGENT}*.class 
> ${OTHER}*.java

There is some inconsistency in the `MakeJAR*.sh` replacements. Many tests now 
use `jdk.test.lib.util.JavaAgentBuilder` for `basicAgent.jar`, 
`redefineAgent.jar`, and `retransformAgent.jar`. The problem is that the 
`JavaAgentBuilder` hard-codes both `Can-Redefine-Classes: true` and 
`Can-Retransform-Classes: true` unless explicitly overridden. The old manifests 
were more specific: `basicAgent.mf` had neither flag, `redefineAgent.mf` only 
had `redefine`, and `retransformAgent.mf`
 only had `retransform`. The tests are supposed to exercise a specific manifest 
capabilities.

Q1: Also, please, look at `-g` option which is used for `javac` compilation. Do 
we still compile with `-g`? I'm afraid that some of the tests may depend on 
this option. Just need to double check. Most likely, this is a false alarm.

Q2: The Java replacements use `CompilerUtils.compile()`, which does not carry 
over `TESTJAVACOPTS` / `TESTTOOLVMOPTS`. I'm not sure if it is important or 
not. Better to double check with @lmesnik .

test/jdk/java/lang/instrument/modules/AppendToClassPathModuleTest.java line 30:

> 28:  * @library src /test/lib
> 29:  * @build test/*
> 30:  * @run driver BuildModuleAgent

Q: The line `@run driver BuildModuleAgent` was added, but `BuildModuleAgent` 
was not added to any `@build` line. The test only has the line: `@build 
test/*`. The `BuildModuleAgent.java` is not under `src/test/*` and is not going 
to be compiled. Is it correct?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31288#discussion_r3348281373
PR Review Comment: https://git.openjdk.org/jdk/pull/31288#discussion_r3348237886
PR Review Comment: https://git.openjdk.org/jdk/pull/31288#discussion_r3348170802

Reply via email to