mirror of https://github.com/apache/lucene.git
Test thread's name reflects the current seed.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1294514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d6fa94970f
commit
4d401ca87d
|
@ -560,14 +560,19 @@ public abstract class LuceneTestCase extends Assert {
|
|||
* @see LuceneTestCase#testCaseThread
|
||||
*/
|
||||
private class RememberThreadRule implements TestRule {
|
||||
private String previousName;
|
||||
|
||||
@Override
|
||||
public Statement apply(final Statement base, Description description) {
|
||||
return new Statement() {
|
||||
public void evaluate() throws Throwable {
|
||||
try {
|
||||
LuceneTestCase.this.testCaseThread = Thread.currentThread();
|
||||
Thread current = Thread.currentThread();
|
||||
previousName = current.getName();
|
||||
LuceneTestCase.this.testCaseThread = current;
|
||||
base.evaluate();
|
||||
} finally {
|
||||
LuceneTestCase.this.testCaseThread.setName(previousName);
|
||||
LuceneTestCase.this.testCaseThread = null;
|
||||
}
|
||||
}
|
||||
|
@ -617,6 +622,9 @@ public abstract class LuceneTestCase extends Assert {
|
|||
seed = "random".equals(TEST_SEED) ? seedRand.nextLong() : ThreeLongs.fromString(TEST_SEED).l2;
|
||||
random.setSeed(seed);
|
||||
|
||||
Thread.currentThread().setName("LTC-main#seed=" +
|
||||
new ThreeLongs(staticSeed, seed, LuceneTestCaseRunner.runnerSeed));
|
||||
|
||||
savedUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
|
|
Loading…
Reference in New Issue