RFR(S) 8209927 - Split appcds/sharedStrings/IncompatibleOptions.java into several tests

Ioi Lam ioi.lam at oracle.com
Fri Aug 24 15:00:31 UTC 2018

Hi Coleen, thanks for the review!

On 8/24/18 6:43 AM, coleen.phillimore at oracle.com wrote:
> http://cr.openjdk.java.net/~iklam/jdk12/8209927-split-incompatible-options-test.v01/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_A.java.html 
> Should this only have copyright 2018.
> Is this affected by any global options passed when running the tests? 
> Does it need run/driver instead?

The tests' main class (IncompatibleOptions) is affected by global 
options, because it calls 
sun.hotspot.tools.ctw.Compiler.isGraalEnabled(), which uses WhiteBox to 
call into the VM to inspect internal states. Here, "@run main/othervm" 
is necessary because I have to pass the options to enable WhiteBox:

  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 
-Xbootclasspath/a:. IncompatibleOptions -XX:+UseStringDeduplication

BTW, the main class will (indirectly) use 
jdk.test.lib.process.ProcessTools to create a ProcessBuilder for 
launching a child process, and specifies -XX:+UseStringDeduplication in 
the command-line. ProcessTools basically first copies from the global VM 
options, and then appends -XX:+UseStringDeduplication to it. So even if 
I run with "jtreg -vmoptions:-XX:-UseStringDeduplication 
IncompatibleOptions_B.java", the child process's command-line will end 
up being "... -XX:-UseStringDeduplication ... 
-XX:+UseStringDeduplication", so the test basically overrides any 
options that were specified by -vmoptions.

- Ioi

> Thanks,
> Coleen
> On 8/24/18 1:34 AM, Ioi Lam wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8209927
>> http://cr.openjdk.java.net/~iklam/jdk12/8209927-split-incompatible-options-test.v01/ 
>> We have several CDS tests that spawn a lot of child processes
>> sequentially and could take a long time. We should split them
>> up into several test cases to speed up test execution time when
>> the tests are executed in parallel by jtreg.
>> This also makes the tests less likely to timeout.
>> IncompatibleOptions.java is the first in the batch.
>> I also fixed a bug in the @run command. It used to be:
>>      @run main/othervm -XX:+UseStringDeduplication ....
>> The intention was to pass the -XX option to the child processes, but 
>> this
>> option ended up only impacting the main test process, which is just 
>> like a
>> shell script and doesn't directly touch any functionality that we 
>> want to
>> test.
>> The fix is to pass the -XX option as a command-line argument to the main
>> test, which then passes this option to the child processes via
>> TestCommon.dump/TestCommon.exec.
>> Thanks
>> - Ioi

More information about the hotspot-runtime-dev mailing list