JDK 9 RFR of Update to RegEx test to use random number library

Joseph D. Darcy joe.darcy at oracle.com
Tue May 5 21:53:31 UTC 2015


Hello,

The regression test

     test/java/util/regex/RegExTest.java

has been observed to intermittently fail. As the test uses randomness, 
I'd like to update to the test to use the random number testing library 
to better identify the cause of any future failures.

Please review the patch below:

diff -r 207c1b0356ea test/java/util/regex/RegExTest.java
--- a/test/java/util/regex/RegExTest.java    Tue May 05 17:55:16 2015 +0100
+++ b/test/java/util/regex/RegExTest.java    Tue May 05 14:50:10 2015 -0700
@@ -23,7 +23,7 @@

  /**
   * @test
- * @summary tests RegExp framework
+ * @summary tests RegExp framework (use -Dseed=X to set PRNG seed)
   * @author Mike McCloskey
   * @bug 4481568 4482696 4495089 4504687 4527731 4599621 4631553 4619345
   * 4630911 4672616 4711773 4727935 4750573 4792284 4803197 4757029 4808962
@@ -33,6 +33,9 @@
   * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
   * 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
   * 8027645 8035076 8039124 8035975 8074678
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run main RegExTest
   * @key randomness
   */

@@ -50,7 +53,7 @@
   */
  public class RegExTest {

-    private static Random generator = new Random();
+    private static Random generator = RandomFactory.getRandom();
      private static boolean failure = false;
      private static int failCount = 0;
      private static String firstFailure = null;

Thanks,

-Joe



More information about the core-libs-dev mailing list