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

Use @requires to filter locale specific regression tests

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:

      Description

      There are lots of boilerplate code that restricts the regression tests to run only in a specific locale, e.g., Locale.US., such as
      ```
      Locale orig = Locale.getDefault();
      try {
          Locale.setDefault(Locale.US);
          // test code
      } finally {
          Locale.setDefault(orig);
      }
      ```
      These can be simplified with `@requires` tag, such as:
      ```
      % git diff
      diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT
      index 6b78ca255f5..05fd647e3c6 100644
      --- a/test/jdk/TEST.ROOT
      +++ b/test/jdk/TEST.ROOT
      @@ -64,6 +64,10 @@ requires.properties= \
           vm.jvmci \
           docker.support \
           release.implementor \
      + user.language \
      + user.country \
      + user.script \
      + user.variant \
           jdk.containerized
       
       # Minimum jtreg version
      diff --git a/test/jdk/java/util/Calendar/Bug6902861.java b/test/jdk/java/util/Calendar/Bug6902861.java
      index b1aa86fdbd2..05bbaf16ab0 100644
      --- a/test/jdk/java/util/Calendar/Bug6902861.java
      +++ b/test/jdk/java/util/Calendar/Bug6902861.java
      @@ -25,6 +25,7 @@
        * @test
        * @bug 6902861
        * @summary Test for a workaround when WEEK_OF_YEAR and YEAR are out of sync.
      + * @requires (user.language == "en") & (user.country == "US")
        * @modules jdk.localedata
        */
      ```

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              naoto Naoto Sato
              Reporter:
              naoto Naoto Sato
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: