--- jsr166/src/test/tck/JSR166TestCase.java 2016/02/22 23:16:06 1.188 +++ jsr166/src/test/tck/JSR166TestCase.java 2016/03/04 21:00:45 1.189 @@ -184,10 +184,13 @@ public class JSR166TestCase extends Test private static final int suiteRuns = Integer.getInteger("jsr166.suiteRuns", 1); - private static float systemPropertyValue(String name, float defaultValue) { + /** + * Returns the value of the system property, or NaN if not defined. + */ + private static float systemPropertyValue(String name) { String floatString = System.getProperty(name); if (floatString == null) - return defaultValue; + return Float.NaN; try { return Float.parseFloat(floatString); } catch (NumberFormatException ex) { @@ -199,16 +202,25 @@ public class JSR166TestCase extends Test /** * The scaling factor to apply to standard delays used in tests. + * May be initialized from any of: + * - the "jsr166.delay.factor" system property + * - the "test.timeout.factor" system property (as used by jtreg) + * See: http://openjdk.java.net/jtreg/tag-spec.html + * - hard-coded fuzz factor when using a known slowpoke VM */ - private static final float delayFactor = - systemPropertyValue("jsr166.delay.factor", 1.0f); + private static final float delayFactor = delayFactor(); - /** - * The timeout factor as used in the jtreg test harness. - * See: http://openjdk.java.net/jtreg/tag-spec.html - */ - private static final float jtregTestTimeoutFactor - = systemPropertyValue("test.timeout.factor", 1.0f); + private static float delayFactor() { + float x; + if (!Float.isNaN(x = systemPropertyValue("jsr166.delay.factor"))) + return x; + if (!Float.isNaN(x = systemPropertyValue("test.timeout.factor"))) + return x; + String prop = System.getProperty("java.vm.version"); + if (prop != null && prop.matches(".*debug.*")) + return 4.0f; // How much slower is fastdebug than product?! + return 1.0f; + } public JSR166TestCase() { super(); } public JSR166TestCase(String name) { super(name); } @@ -589,7 +601,7 @@ public class JSR166TestCase extends Test * http://openjdk.java.net/jtreg/command-help.html */ protected long getShortDelay() { - return (long) (50 * delayFactor * jtregTestTimeoutFactor); + return (long) (50 * delayFactor); } /**