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.113 by dl, Sun Sep 8 23:00:36 2013 UTC vs.
Revision 1.115 by jsr166, Wed May 14 21:06:38 2014 UTC

# Line 26 | Line 26 | import java.util.concurrent.atomic.Atomi
26   import java.util.concurrent.atomic.AtomicReference;
27   import static java.util.concurrent.TimeUnit.MILLISECONDS;
28   import static java.util.concurrent.TimeUnit.NANOSECONDS;
29 + import java.util.regex.Pattern;
30   import java.security.CodeSource;
31   import java.security.Permission;
32   import java.security.PermissionCollection;
# Line 134 | Line 135 | public class JSR166TestCase extends Test
135      private static final int runsPerTest =
136          Integer.getInteger("jsr166.runsPerTest", 1);
137  
138 +    /**
139 +     * A filter for tests to run, matching strings of the form
140 +     * methodName(className), e.g. "testInvokeAll5(ForkJoinPoolTest)"
141 +     * Usefully combined with jsr166.runsPerTest.
142 +     */
143 +    private static final Pattern methodFilter = methodFilter();
144 +
145 +    private static Pattern methodFilter() {
146 +        String regex = System.getProperty("jsr166.methodFilter");
147 +        return (regex == null) ? null : Pattern.compile(regex);
148 +    }
149 +
150      protected void runTest() throws Throwable {
151 <        for (int i = 0; i < runsPerTest; i++) {
152 <            if (profileTests)
153 <                runTestProfiled();
154 <            else
155 <                super.runTest();
151 >        if (methodFilter == null
152 >            || methodFilter.matcher(toString()).find()) {
153 >            for (int i = 0; i < runsPerTest; i++) {
154 >                if (profileTests)
155 >                    runTestProfiled();
156 >                else
157 >                    super.runTest();
158 >            }
159          }
160      }
161  
# Line 205 | Line 221 | public class JSR166TestCase extends Test
221      }
222  
223      public static final double JAVA_CLASS_VERSION;
224 +    public static final String JAVA_SPECIFICATION_VERSION;
225      static {
226          try {
227              JAVA_CLASS_VERSION = java.security.AccessController.doPrivileged(
228                  new java.security.PrivilegedAction<Double>() {
229                  public Double run() {
230                      return Double.valueOf(System.getProperty("java.class.version"));}});
231 +            JAVA_SPECIFICATION_VERSION = java.security.AccessController.doPrivileged(
232 +                new java.security.PrivilegedAction<String>() {
233 +                public String run() {
234 +                    return System.getProperty("java.specification.version");}});
235          } catch (Throwable t) {
236              throw new Error(t);
237          }
# Line 219 | Line 240 | public class JSR166TestCase extends Test
240      public static boolean atLeastJava6() { return JAVA_CLASS_VERSION >= 50.0; }
241      public static boolean atLeastJava7() { return JAVA_CLASS_VERSION >= 51.0; }
242      public static boolean atLeastJava8() { return JAVA_CLASS_VERSION >= 52.0; }
243 +    public static boolean atLeastJava9() {
244 +        // As of 2014-05, java9 still uses 52.0 class file version
245 +        return JAVA_SPECIFICATION_VERSION.startsWith("1.9");
246 +    }
247  
248      /**
249       * Collects all JSR166 unit tests as one suite.
# Line 311 | Line 336 | public class JSR166TestCase extends Test
336              addNamedTestClasses(suite, java8TestClassNames);
337          }
338  
339 +        // Java9+ test classes
340 +        if (atLeastJava9()) {
341 +            String[] java9TestClassNames = {
342 +                "ThreadPoolExecutor9Test",
343 +            };
344 +            addNamedTestClasses(suite, java9TestClassNames);
345 +        }
346 +
347          return suite;
348      }
349  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines