--- jsr166/src/test/tck/JSR166TestCase.java 2015/10/23 17:34:47 1.178
+++ jsr166/src/test/tck/JSR166TestCase.java 2016/01/17 00:07:51 1.182
@@ -6,6 +6,13 @@
* Pat Fisher, Mike Judd.
*/
+/*
+ * @test
+ * @summary JSR-166 tck tests
+ * @build *
+ * @run junit/othervm/timeout=1000 JSR166TestCase
+ */
+
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
@@ -112,8 +119,7 @@ import junit.framework.TestSuite;
* methods as there are exceptions the method can throw. Sometimes
* there are multiple tests per JSR166 method when the different
* "normal" behaviors differ significantly. And sometimes testcases
- * cover multiple methods when they cannot be tested in
- * isolation.
+ * cover multiple methods when they cannot be tested in isolation.
*
*
The documentation style for testcases is to provide as javadoc
* a simple sentence or two describing the property that the testcase
@@ -176,6 +182,12 @@ public class JSR166TestCase extends Test
private static final int suiteRuns =
Integer.getInteger("jsr166.suiteRuns", 1);
+ /**
+ * The scaling factor to apply to standard delays used in tests.
+ */
+ private static final int delayFactor =
+ Integer.getInteger("jsr166.delay.factor", 1);
+
public JSR166TestCase() { super(); }
public JSR166TestCase(String name) { super(name); }
@@ -277,10 +289,10 @@ public class JSR166TestCase extends Test
PithyResultPrinter(java.io.PrintStream writer) { super(writer); }
long runTime;
public void startTest(Test test) {}
- protected void printHeader(long runTime) {
+ protected void printHeader(long runTime) {
this.runTime = runTime; // defer printing for later
- }
- protected void printFooter(TestResult result) {
+ }
+ protected void printFooter(TestResult result) {
if (result.wasSuccessful()) {
getWriter().println("OK (" + result.runCount() + " tests)"
+ " Time: " + elapsedTimeAsString(runTime));
@@ -549,11 +561,11 @@ public class JSR166TestCase extends Test
public static long LONG_DELAY_MS;
/**
- * Returns the shortest timed delay. This could
- * be reimplemented to use for example a Property.
+ * Returns the shortest timed delay. This can be scaled up for
+ * slow machines using the jsr166.delay.factor system property.
*/
protected long getShortDelay() {
- return 50;
+ return 50 * delayFactor;
}
/**