RFR: 7904084: Unset javaOpts and jtregOpts in jtreg.sh [v2]

Christian Stein cstein at openjdk.org
Tue Dec 2 12:03:31 UTC 2025


On Thu, 20 Nov 2025 08:44:56 GMT, SendaoYan <syan at openjdk.org> wrote:

>> Hi all,
>> 
>> In jtreg.sh it will combine all the java options and jtreg options in the `for i in "$@"` loop. SHELL use javaOpts and jtregOpts as global varable by default, this means jtreg.sh will receive the value of javaOpts and jtregOpts outside. I think this unexpected.
>> To avoid this siutation, I think we should unset javaOpts and jtregOpts before use it.
>
> SendaoYan has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'openjdk:master' into jbs7904084
>  - 7904084: Unset javaOpts and jtregOpts in jtreg.sh

Did you see an error when used in combination with another or the same script? If yes, which one(s)?

There's related prior-art in the script for the `DUALCASE` variable. Which is declard and initialized before each use, and `unset` after each use. Would it be possible to the same for `javaOpts` and `jtregOpts`? Or at least `unset` both after use.

Another solution would be to introduce script-`local` variables, right?

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

PR Comment: https://git.openjdk.org/jtreg/pull/291#issuecomment-3601684161


More information about the jtreg-dev mailing list