--- jsr166/src/test/tck/JSR166TestCase.java 2013/09/17 06:38:36 1.114 +++ jsr166/src/test/tck/JSR166TestCase.java 2014/06/09 18:17:37 1.117 @@ -160,12 +160,13 @@ public class JSR166TestCase extends Test } protected void runTestProfiled() throws Throwable { + // Warmup run, notably to trigger all needed classloading. + super.runTest(); long t0 = System.nanoTime(); try { super.runTest(); } finally { - long elapsedMillis = - (System.nanoTime() - t0) / (1000L * 1000L); + long elapsedMillis = millisElapsedSince(t0); if (elapsedMillis >= profileThreshold) System.out.printf("%n%s: %d%n", toString(), elapsedMillis); } @@ -221,12 +222,17 @@ public class JSR166TestCase extends Test } public static final double JAVA_CLASS_VERSION; + public static final String JAVA_SPECIFICATION_VERSION; static { try { JAVA_CLASS_VERSION = java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { public Double run() { return Double.valueOf(System.getProperty("java.class.version"));}}); + JAVA_SPECIFICATION_VERSION = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public String run() { + return System.getProperty("java.specification.version");}}); } catch (Throwable t) { throw new Error(t); } @@ -235,6 +241,10 @@ public class JSR166TestCase extends Test public static boolean atLeastJava6() { return JAVA_CLASS_VERSION >= 50.0; } public static boolean atLeastJava7() { return JAVA_CLASS_VERSION >= 51.0; } public static boolean atLeastJava8() { return JAVA_CLASS_VERSION >= 52.0; } + public static boolean atLeastJava9() { + // As of 2014-05, java9 still uses 52.0 class file version + return JAVA_SPECIFICATION_VERSION.startsWith("1.9"); + } /** * Collects all JSR166 unit tests as one suite. @@ -327,6 +337,14 @@ public class JSR166TestCase extends Test addNamedTestClasses(suite, java8TestClassNames); } + // Java9+ test classes + if (atLeastJava9()) { + String[] java9TestClassNames = { + "ThreadPoolExecutor9Test", + }; + addNamedTestClasses(suite, java9TestClassNames); + } + return suite; } @@ -884,7 +902,7 @@ public class JSR166TestCase extends Test * startNanoTime, which must have been previously returned from a * call to {@link System.nanoTime()}. */ - long millisElapsedSince(long startNanoTime) { + static long millisElapsedSince(long startNanoTime) { return NANOSECONDS.toMillis(System.nanoTime() - startNanoTime); }