188 |
|
return (regex == null) ? null : Pattern.compile(regex); |
189 |
|
} |
190 |
|
|
191 |
+ |
// Instrumentation to debug very rare, but very annoying hung test runs. |
192 |
|
static volatile TestCase currentTestCase; |
193 |
+ |
static volatile int currentRun = 0; |
194 |
|
static { |
195 |
|
Runnable checkForWedgedTest = new Runnable() { public void run() { |
196 |
|
// avoid spurious reports with enormous runsPerTest |
199 |
|
try { MINUTES.sleep(timeoutMinutes); } |
200 |
|
catch (InterruptedException unexpected) { break; } |
201 |
|
if (lastTestCase == currentTestCase) { |
202 |
+ |
System.err.printf( |
203 |
+ |
"Looks like we're stuck running test: %s (%d/%d)%n", |
204 |
+ |
lastTestCase, currentRun, runsPerTest); |
205 |
|
System.err.println |
206 |
|
("Looks like we're stuck running test: " |
207 |
< |
+ lastTestCase); |
207 |
> |
+ lastTestCase + " (" + currentRun + "/" + runsPerTest + ")"); |
208 |
|
System.err.println("availableProcessors=" + |
209 |
|
Runtime.getRuntime().availableProcessors()); |
210 |
|
dumpTestThreads(); |
227 |
|
|
228 |
|
protected void runTest() throws Throwable { |
229 |
|
for (int i = 0; i < runsPerTest; i++) { |
230 |
+ |
currentRun = i; |
231 |
|
if (profileTests) |
232 |
|
runTestProfiled(); |
233 |
|
else |