ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/JSR166TestCase.java
(Generate patch)

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.249 by jsr166, Sat Nov 24 21:41:20 2018 UTC vs.
Revision 1.256 by jsr166, Sun Aug 11 22:29:26 2019 UTC

# Line 288 | Line 288 | public class JSR166TestCase extends Test
288              // Avoid spurious reports with enormous runsPerTest.
289              // A single test case run should never take more than 1 second.
290              // But let's cap it at the high end too ...
291 <            final int timeoutMinutes =
292 <                Math.min(15, Math.max(runsPerTest / 60, 1));
291 >            final int timeoutMinutesMin = Math.max(runsPerTest / 60, 1)
292 >                * Math.max((int) delayFactor, 1);
293 >            final int timeoutMinutes = Math.min(15, timeoutMinutesMin);
294              for (TestCase lastTestCase = currentTestCase;;) {
295                  try { MINUTES.sleep(timeoutMinutes); }
296                  catch (InterruptedException unexpected) { break; }
# Line 460 | Line 461 | public class JSR166TestCase extends Test
461      public static boolean atLeastJava9()  { return JAVA_CLASS_VERSION >= 53.0; }
462      public static boolean atLeastJava10() { return JAVA_CLASS_VERSION >= 54.0; }
463      public static boolean atLeastJava11() { return JAVA_CLASS_VERSION >= 55.0; }
464 +    public static boolean atLeastJava12() { return JAVA_CLASS_VERSION >= 56.0; }
465 +    public static boolean atLeastJava13() { return JAVA_CLASS_VERSION >= 57.0; }
466 +    public static boolean atLeastJava14() { return JAVA_CLASS_VERSION >= 58.0; }
467 +    public static boolean atLeastJava15() { return JAVA_CLASS_VERSION >= 59.0; }
468 +    public static boolean atLeastJava16() { return JAVA_CLASS_VERSION >= 60.0; }
469 +    public static boolean atLeastJava17() { return JAVA_CLASS_VERSION >= 61.0; }
470  
471      /**
472       * Collects all JSR166 unit tests as one suite.
# Line 511 | Line 518 | public class JSR166TestCase extends Test
518              ExecutorsTest.suite(),
519              ExecutorCompletionServiceTest.suite(),
520              FutureTaskTest.suite(),
521 +            HashtableTest.suite(),
522              LinkedBlockingDequeTest.suite(),
523              LinkedBlockingQueueTest.suite(),
524              LinkedListTest.suite(),
# Line 550 | Line 558 | public class JSR166TestCase extends Test
558                  "HashMapTest",
559                  "LinkedBlockingDeque8Test",
560                  "LinkedBlockingQueue8Test",
561 +                "LinkedHashMapTest",
562                  "LongAccumulatorTest",
563                  "LongAdderTest",
564                  "SplittableRandomTest",
# Line 676 | Line 685 | public class JSR166TestCase extends Test
685      static TimeUnit randomTimeUnit() { return RANDOM_TIMEUNIT; }
686  
687      /**
688 +     * Returns a random boolean; a "coin flip".
689 +     */
690 +    static boolean randomBoolean() {
691 +        return ThreadLocalRandom.current().nextBoolean();
692 +    }
693 +
694 +    /**
695       * Returns the shortest timed delay. This can be scaled up for
696       * slow machines using the jsr166.delay.factor system property,
697       * or via jtreg's -timeoutFactor: flag.
# Line 1305 | Line 1321 | public class JSR166TestCase extends Test
1321                                         Callable<Boolean> waitingForGodot) {
1322          for (long startTime = 0L;;) {
1323              switch (thread.getState()) {
1324 +            default: break;
1325              case BLOCKED: case WAITING: case TIMED_WAITING:
1326                  try {
1327                      if (waitingForGodot == null || waitingForGodot.call())
# Line 1742 | Line 1759 | public class JSR166TestCase extends Test
1759          }
1760      }
1761  
1762 <    void assertImmutable(final Object o) {
1762 >    void assertImmutable(Object o) {
1763          if (o instanceof Collection) {
1764              assertThrows(
1765                  UnsupportedOperationException.class,
1766 <                new Runnable() { public void run() {
1750 <                        ((Collection) o).add(null);}});
1766 >                () -> ((Collection) o).add(null));
1767          }
1768      }
1769  
# Line 1807 | Line 1823 | public class JSR166TestCase extends Test
1823      }
1824  
1825      public void assertThrows(Class<? extends Throwable> expectedExceptionClass,
1826 <                             Runnable... throwingActions) {
1827 <        for (Runnable throwingAction : throwingActions) {
1826 >                             Action... throwingActions) {
1827 >        for (Action throwingAction : throwingActions) {
1828              boolean threw = false;
1829              try { throwingAction.run(); }
1830              catch (Throwable t) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines