RFR: 8269032: Stringdedup tests are failing if the ergonomically select GC does not support it

Per Liden pliden at openjdk.java.net
Wed Jun 30 10:14:04 UTC 2021


On Wed, 30 Jun 2021 07:28:40 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationAgeThreshold.java line 44:
>> 
>>> 42:  * @bug 8029075
>>> 43:  * @requires vm.gc == "null" & vm.gc.G1
>>> 44:  * @library /test/lib
>> 
>> ... and same here, this should be `@requires vm.gc.Shenandoah` and it should pass `-XX:+UseShenandoahGC`to the test, which it appends to the list of arguments for the JVM that will be spawned.
>> 
>> Of course, same comments apply to all tests.
>
> I think the eventual goal should probably be that these are all driver
> tests, and just have `@requires vm.gc != "Epsilon"` with a "driver" test,
> but we're not there yet.
> 
> Until then, what I'm attempting to do is get good test coverage without
> wasting a lot of testing resources. Driver tests are preferred to othervm
> tests where that's possible, for better resource utilization. Driver tests
> can't use VM options.
> 
> Most of the string deduplication implementation is entirely GC-agnostic. So
> ideally we would run these tests with a given GC as part of focused testing
> of that GC, and not when testing some other GC. Hence the use of `@requires`
> for specific GC options (vm.gc == "XXX").
> 
> But that doesn't provide any testing for the case where the GC is being
> selected ergonomically. The new `@test` clauses to test with G1 are not
> entirely ideal, since they won't run if someone builds a VM that excludes G1
> but does include some other GC that supports string deduplication. But I
> couldn't come up with a way to address that without having to deal with
> WhiteBox.
> 
> I'm not sure exactly what you are proposing and how it might relate to the
> above considerations.  I'm not enamored of what I've proposed, but haven't
> come up with something I like better.  Maybe if you could be more explicit
> about the diffs you think should be made for one of the tests?

Sorry, let me be more specific. I was proposing you do this (in all these tests):

```diff --git a/test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationFullGC.java b/test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationFullGC.java
index 66d58a6e580..6a358ae54f3 100644
--- a/test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationFullGC.java
+++ b/test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationFullGC.java
@@ -27,26 +27,26 @@ package gc.stringdedup;
  * @test TestStringDeduplicationFullGC
  * @summary Test string deduplication during full GC
  * @bug 8029075
- * @requires vm.gc == "G1" | vm.gc == "Shenandoah"
+ * @requires vm.gc.G1
  * @library /test/lib
  * @library /
  * @modules java.base/jdk.internal.misc:open
  * @modules java.base/java.lang:open
  *          java.management
- * @run driver gc.stringdedup.TestStringDeduplicationFullGC
+ * @run driver gc.stringdedup.TestStringDeduplicationFullGC G1
  */
 
 /*
  * @test TestStringDeduplicationFullGC
  * @summary Test string deduplication during full GC
  * @bug 8029075
- * @requires vm.gc == "null" & vm.gc.G1
+ * @requires vm.gc.Shenandoah
  * @library /test/lib
  * @library /
  * @modules java.base/jdk.internal.misc:open
  * @modules java.base/java.lang:open
  *          java.management
- * @run driver gc.stringdedup.TestStringDeduplicationFullGC G1
+ * @run driver gc.stringdedup.TestStringDeduplicationFullGC Shenandoah
  */
 
 public class TestStringDeduplicationFullGC {

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

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



More information about the hotspot-gc-dev mailing list