On Fri, 6 Nov 2020 12:54:28 GMT, Lin Zang <lz...@openjdk.org> wrote:

> The implementation of jmap tool depends on the implementation of object 
> iteration by different GC heap.
> This patch extend the BasicJMapTest to cover differet GC Heap.

I believe this would fail when some GCs are not available. For example, in 
Minimal/Zero only Serial and Parallel are available. ZGC and Shenandoah are not 
available on all platforms. Plus, specifying another GC with `TEST_VM_OPTS` 
would probably fail with "multiple GCs selected".

You need to split the tests like this, and protect each config with `@requires`:

/*
 * @test
 * @summary Unit test for jmap utility
 * @key intermittent
 * @requires vm.gc.Parallel
 * @library /test/lib
 * @build jdk.test.lib.hprof.*
 * @build jdk.test.lib.hprof.model.*
 * @build jdk.test.lib.hprof.parser.*
 * @build jdk.test.lib.hprof.util.*
 * @run main/othervm/timeout=240 -XX:+UseParallelGC BasicJMapTest
 */

/*
 * @test
 * @summary Unit test for jmap utility
 * @key intermittent
 * @requires vm.gc.G1
 * @library /test/lib
 * @build jdk.test.lib.hprof.*
 * @build jdk.test.lib.hprof.model.*
 * @build jdk.test.lib.hprof.parser.*
 * @build jdk.test.lib.hprof.util.*
 * @run main/othervm/timeout=240 -XX:+UseG1GC BasicJMapTest
 */
...

Maybe there is a way to clean up multiple `@build` tags to make the test config 
less verbose.

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

Changes requested by shade (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1094

Reply via email to