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.114 by jsr166, Tue Sep 17 06:38:36 2013 UTC vs.
Revision 1.117 by jsr166, Mon Jun 9 18:17:37 2014 UTC

# Line 160 | Line 160 | public class JSR166TestCase extends Test
160      }
161  
162      protected void runTestProfiled() throws Throwable {
163 +        // Warmup run, notably to trigger all needed classloading.
164 +        super.runTest();
165          long t0 = System.nanoTime();
166          try {
167              super.runTest();
168          } finally {
169 <            long elapsedMillis =
168 <                (System.nanoTime() - t0) / (1000L * 1000L);
169 >            long elapsedMillis = millisElapsedSince(t0);
170              if (elapsedMillis >= profileThreshold)
171                  System.out.printf("%n%s: %d%n", toString(), elapsedMillis);
172          }
# Line 221 | Line 222 | public class JSR166TestCase extends Test
222      }
223  
224      public static final double JAVA_CLASS_VERSION;
225 +    public static final String JAVA_SPECIFICATION_VERSION;
226      static {
227          try {
228              JAVA_CLASS_VERSION = java.security.AccessController.doPrivileged(
229                  new java.security.PrivilegedAction<Double>() {
230                  public Double run() {
231                      return Double.valueOf(System.getProperty("java.class.version"));}});
232 +            JAVA_SPECIFICATION_VERSION = java.security.AccessController.doPrivileged(
233 +                new java.security.PrivilegedAction<String>() {
234 +                public String run() {
235 +                    return System.getProperty("java.specification.version");}});
236          } catch (Throwable t) {
237              throw new Error(t);
238          }
# Line 235 | Line 241 | public class JSR166TestCase extends Test
241      public static boolean atLeastJava6() { return JAVA_CLASS_VERSION >= 50.0; }
242      public static boolean atLeastJava7() { return JAVA_CLASS_VERSION >= 51.0; }
243      public static boolean atLeastJava8() { return JAVA_CLASS_VERSION >= 52.0; }
244 +    public static boolean atLeastJava9() {
245 +        // As of 2014-05, java9 still uses 52.0 class file version
246 +        return JAVA_SPECIFICATION_VERSION.startsWith("1.9");
247 +    }
248  
249      /**
250       * Collects all JSR166 unit tests as one suite.
# Line 327 | Line 337 | public class JSR166TestCase extends Test
337              addNamedTestClasses(suite, java8TestClassNames);
338          }
339  
340 +        // Java9+ test classes
341 +        if (atLeastJava9()) {
342 +            String[] java9TestClassNames = {
343 +                "ThreadPoolExecutor9Test",
344 +            };
345 +            addNamedTestClasses(suite, java9TestClassNames);
346 +        }
347 +
348          return suite;
349      }
350  
# Line 884 | Line 902 | public class JSR166TestCase extends Test
902       * startNanoTime, which must have been previously returned from a
903       * call to {@link System.nanoTime()}.
904       */
905 <    long millisElapsedSince(long startNanoTime) {
905 >    static long millisElapsedSince(long startNanoTime) {
906          return NANOSECONDS.toMillis(System.nanoTime() - startNanoTime);
907      }
908  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines