284 |
|
static volatile TestCase currentTestCase; |
285 |
|
// static volatile int currentRun = 0; |
286 |
|
static { |
287 |
< |
Runnable checkForWedgedTest = new Runnable() { public void run() { |
287 |
> |
Runnable wedgedTestDetector = new Runnable() { public void run() { |
288 |
|
// Avoid spurious reports with enormous runsPerTest. |
289 |
|
// A single test case run should never take more than 1 second. |
290 |
|
// But let's cap it at the high end too ... |
310 |
|
} |
311 |
|
lastTestCase = currentTestCase; |
312 |
|
}}}; |
313 |
< |
Thread thread = new Thread(checkForWedgedTest, "checkForWedgedTest"); |
313 |
> |
Thread thread = new Thread(wedgedTestDetector, "WedgedTestDetector"); |
314 |
|
thread.setDaemon(true); |
315 |
|
thread.start(); |
316 |
|
} |
1106 |
|
continue; |
1107 |
|
if ("Reference Handler".equals(name) |
1108 |
|
&& (lockName = info.getLockName()) != null |
1109 |
< |
&& lockName.startsWith("java.lang.ref.Reference$Lock")) |
1109 |
> |
&& lockName.startsWith("java.lang.ref")) |
1110 |
|
continue; |
1111 |
< |
if ("Finalizer".equals(name) |
1111 |
> |
if (("Finalizer".equals(name) || "Common-Cleaner".equals(name)) |
1112 |
|
&& (lockName = info.getLockName()) != null |
1113 |
< |
&& lockName.startsWith("java.lang.ref.ReferenceQueue$Lock")) |
1113 |
> |
&& lockName.startsWith("java.lang.ref")) |
1114 |
|
continue; |
1115 |
< |
if ("checkForWedgedTest".equals(name)) |
1115 |
> |
if ("WedgedTestDetector".equals(name)) |
1116 |
|
continue; |
1117 |
|
System.err.print(info); |
1118 |
|
} |
1410 |
|
return NANOSECONDS.toMillis(System.nanoTime() - startNanoTime); |
1411 |
|
} |
1412 |
|
|
1413 |
– |
// void assertTerminatesPromptly(long timeoutMillis, Runnable r) { |
1414 |
– |
// long startTime = System.nanoTime(); |
1415 |
– |
// try { |
1416 |
– |
// r.run(); |
1417 |
– |
// } catch (Throwable fail) { threadUnexpectedException(fail); } |
1418 |
– |
// if (millisElapsedSince(startTime) > timeoutMillis/2) |
1419 |
– |
// throw new AssertionError("did not return promptly"); |
1420 |
– |
// } |
1421 |
– |
|
1422 |
– |
// void assertTerminatesPromptly(Runnable r) { |
1423 |
– |
// assertTerminatesPromptly(LONG_DELAY_MS/2, r); |
1424 |
– |
// } |
1425 |
– |
|
1413 |
|
/** |
1414 |
|
* Checks that timed f.get() returns the expected value, and does not |
1415 |
|
* wait for the timeout to elapse before returning. |
1457 |
|
try { |
1458 |
|
threadFail(detail); |
1459 |
|
} finally { |
1460 |
< |
// Interrupt thread __after__ having reported its stack trace |
1460 |
> |
// Interrupt thread __after__ having reported its stack trace |
1461 |
|
thread.interrupt(); |
1462 |
|
} |
1463 |
|
} |