6 |
|
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
8 |
|
|
9 |
+ |
/* |
10 |
+ |
* @test |
11 |
+ |
* @summary JSR-166 tck tests |
12 |
+ |
* @modules java.management |
13 |
+ |
* @build * |
14 |
+ |
* @run junit/othervm/timeout=1000 -Djsr166.testImplementationDetails=true JSR166TestCase |
15 |
+ |
*/ |
16 |
+ |
|
17 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
18 |
|
import static java.util.concurrent.TimeUnit.MINUTES; |
19 |
|
import static java.util.concurrent.TimeUnit.NANOSECONDS; |
120 |
|
* methods as there are exceptions the method can throw. Sometimes |
121 |
|
* there are multiple tests per JSR166 method when the different |
122 |
|
* "normal" behaviors differ significantly. And sometimes testcases |
123 |
< |
* cover multiple methods when they cannot be tested in |
116 |
< |
* isolation. |
123 |
> |
* cover multiple methods when they cannot be tested in isolation. |
124 |
|
* |
125 |
|
* <li>The documentation style for testcases is to provide as javadoc |
126 |
|
* a simple sentence or two describing the property that the testcase |
183 |
|
private static final int suiteRuns = |
184 |
|
Integer.getInteger("jsr166.suiteRuns", 1); |
185 |
|
|
186 |
+ |
/** |
187 |
+ |
* The scaling factor to apply to standard delays used in tests. |
188 |
+ |
*/ |
189 |
+ |
private static final int delayFactor = |
190 |
+ |
Integer.getInteger("jsr166.delay.factor", 1); |
191 |
+ |
|
192 |
|
public JSR166TestCase() { super(); } |
193 |
|
public JSR166TestCase(String name) { super(name); } |
194 |
|
|
290 |
|
PithyResultPrinter(java.io.PrintStream writer) { super(writer); } |
291 |
|
long runTime; |
292 |
|
public void startTest(Test test) {} |
293 |
< |
protected void printHeader(long runTime) { |
293 |
> |
protected void printHeader(long runTime) { |
294 |
|
this.runTime = runTime; // defer printing for later |
295 |
< |
} |
296 |
< |
protected void printFooter(TestResult result) { |
295 |
> |
} |
296 |
> |
protected void printFooter(TestResult result) { |
297 |
|
if (result.wasSuccessful()) { |
298 |
|
getWriter().println("OK (" + result.runCount() + " tests)" |
299 |
|
+ " Time: " + elapsedTimeAsString(runTime)); |
562 |
|
public static long LONG_DELAY_MS; |
563 |
|
|
564 |
|
/** |
565 |
< |
* Returns the shortest timed delay. This could |
566 |
< |
* be reimplemented to use for example a Property. |
565 |
> |
* Returns the shortest timed delay. This can be scaled up for |
566 |
> |
* slow machines using the jsr166.delay.factor system property. |
567 |
|
*/ |
568 |
|
protected long getShortDelay() { |
569 |
< |
return 50; |
569 |
> |
return 50 * delayFactor; |
570 |
|
} |
571 |
|
|
572 |
|
/** |