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.190 by jsr166, Sat Mar 26 06:58:47 2016 UTC vs.
Revision 1.196 by jsr166, Fri Jun 17 19:00:48 2016 UTC

# Line 12 | Line 12
12   * @modules java.management
13   * @build *
14   * @run junit/othervm/timeout=1000 -Djsr166.testImplementationDetails=true JSR166TestCase
15 + * @run junit/othervm/timeout=1000 -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 -Djsr166.testImplementationDetails=true JSR166TestCase
16   */
17  
18   import static java.util.concurrent.TimeUnit.MILLISECONDS;
# Line 58 | Line 59 | import java.util.concurrent.RecursiveAct
59   import java.util.concurrent.RecursiveTask;
60   import java.util.concurrent.RejectedExecutionHandler;
61   import java.util.concurrent.Semaphore;
62 + import java.util.concurrent.SynchronousQueue;
63   import java.util.concurrent.ThreadFactory;
64   import java.util.concurrent.ThreadPoolExecutor;
65   import java.util.concurrent.TimeoutException;
# Line 519 | Line 521 | public class JSR166TestCase extends Test
521          // Java9+ test classes
522          if (atLeastJava9()) {
523              String[] java9TestClassNames = {
524 <                // Currently empty, but expecting varhandle tests
524 >                "AtomicBoolean9Test",
525 >                "AtomicInteger9Test",
526 >                "AtomicIntegerArray9Test",
527 >                "AtomicLong9Test",
528 >                "AtomicLongArray9Test",
529 >                "AtomicReference9Test",
530 >                "AtomicReferenceArray9Test",
531 >                "ExecutorCompletionService9Test",
532              };
533              addNamedTestClasses(suite, java9TestClassNames);
534          }
# Line 977 | Line 986 | public class JSR166TestCase extends Test
986       * Uninteresting threads are filtered out.
987       */
988      static void dumpTestThreads() {
989 +        SecurityManager sm = System.getSecurityManager();
990 +        if (sm != null) {
991 +            try {
992 +                System.setSecurityManager(null);
993 +            } catch (SecurityException giveUp) {
994 +                return;
995 +            }
996 +        }
997 +
998          ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
999          System.err.println("------ stacktrace dump start ------");
1000          for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
# Line 994 | Line 1012 | public class JSR166TestCase extends Test
1012              System.err.print(info);
1013          }
1014          System.err.println("------ stacktrace dump end ------");
1015 +
1016 +        if (sm != null) System.setSecurityManager(sm);
1017      }
1018  
1019      /**
# Line 1833 | Line 1853 | public class JSR166TestCase extends Test
1853          } catch (NoSuchElementException success) {}
1854          assertFalse(it.hasNext());
1855      }
1856 +
1857 +    public <T> Callable<T> callableThrowing(final Exception ex) {
1858 +        return new Callable<T>() { public T call() throws Exception { throw ex; }};
1859 +    }
1860 +
1861 +    public Runnable runnableThrowing(final RuntimeException ex) {
1862 +        return new Runnable() { public void run() { throw ex; }};
1863 +    }
1864 +
1865 +    /** A reusable thread pool to be shared by tests. */
1866 +    static final ExecutorService cachedThreadPool =
1867 +        new ThreadPoolExecutor(0, Integer.MAX_VALUE,
1868 +                               1000L, MILLISECONDS,
1869 +                               new SynchronousQueue<Runnable>());
1870 +
1871   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines