RFR: 8320750: Allow a testcase to run with muliple -Xlog

Leo Korinth lkorinth at openjdk.org
Wed Nov 29 09:44:09 UTC 2023


On Wed, 29 Nov 2023 06:52:33 GMT, David Holmes <dholmes at openjdk.org> wrote:

> > I have been starting to change test cases to use `createTestJavaProcessBuilder` instead of `createLimitedTestJavaProcessBuilder` because we severely limit our testing when we use `createLimitedTestJavaProcessBuilder`. Before that change there were no way to add `@require` lines for `-X` options. Unfortunately I made a bug when I introduced that functionality.
> 
> Sure but I am trying to understand that previous change. I don't speak "stream" so can't figure out what exactly you have done. What I expected you to do was combine the various flags coming in from jtreg arguments and env vars, that would affect the VM under test, then see if that set of args contains the `-X` one the `@requires` refers to. But the added complexity there if actually checking a particular flag value is that you need to know how to combine multiple occurrences of the same arg, the same way that the launcher and/or VM will.

JTREG does the exclusion of test cases when we tag them with `@require` lines. I have no way to know what the `@require` line is. But I have the power to create an (additional) key->value mapping of properties that JTREG will use. As JTREG does not care to do this for `-X` flags and only for `-XX` flags I have to do it myself.  So I mapped all `-X<flag>` flags to `vm.opt.x.<flag>`. The problem is that when you collect using `Collectors.toMap` it will throw an exception if multiple keys are the same --- and that happens with multiple `-Xlog`. This pull request fixes this by adding a third argument to  `Collectors.toMap`, a merge strategy. I choose to use the second value so that `-Xms2g -Xms4g` will create `vm.opt.x.Xms4g` for example. However, how should we merge the values of `-Xlog` where the second value is not only what matters? One way is to concatenate the strings, but that is also not the truth. I chose to instead add a dummy value so that you can do a check for the existence 
 of `-Xlog`, but not for its contents.

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

PR Comment: https://git.openjdk.org/jdk/pull/16824#issuecomment-1831547587


More information about the hotspot-dev mailing list