Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8352107

Allow jtreg test cases to query test VM properties

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • None
    • hotspot
    • None

      The class https://github.com/openjdk/jdk/blob/master/test/jtreg-ext/requires/VMProps.java uses WhiteBox to query many internal properties of HotSpot. The properties are currently used only for filtering tests using the "@requires" keyword.

      Many HotSpot tests need to find out internal VM properties. Today they must use the WhiteBox class, which is very cumbersome. For example, many CDS tests need to know if the JVM can use a default CDS archive from JAVA_HOME. They have to resort to this:

      https://github.com/openjdk/jdk/blob/0460978e7c769624cacdb528277a99914b327e30/test/lib/jdk/test/lib/cds/CDSAppTester.java#L257-L268

      This adds a lot of bloat into the "@test" block:

      https://github.com/openjdk/jdk/blob/0460978e7c769624cacdb528277a99914b327e30/test/hotspot/jtreg/runtime/cds/appcds/applications/JavacBench.java#L38-L40

      ======================
      Proposal:

      To simplify the test cases, and make them run faster, we should add a new API VMPropsGetter.get():

      import jdk.test.lib.Asserts;
      import jdk.test.lib.VMPropsGetter;

      public class VMPropsGetterTest {
          public static void main(String[] args) throws Exception {
              String key = "vm.flagless";
              String value = VMPropsGetter.get(key);
              Asserts.assertEQ(value, "true");
          }
      }

            Unassigned Unassigned
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: