lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwe...@apache.org
Subject svn commit: r1294514 - in /lucene/dev/trunk: lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java modules/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternReplaceCharFilter.java
Date Tue, 28 Feb 2012 08:04:43 GMT
Author: dweiss
Date: Tue Feb 28 08:04:42 2012
New Revision: 1294514

URL: http://svn.apache.org/viewvc?rev=1294514&view=rev
Log:
Test thread's name reflects the current seed.

Modified:
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternReplaceCharFilter.java

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1294514&r1=1294513&r2=1294514&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Tue Feb 28 08:04:42 2012
@@ -560,14 +560,19 @@ public abstract class LuceneTestCase ext
    * @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 ext
     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) {

Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternReplaceCharFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternReplaceCharFilter.java?rev=1294514&r1=1294513&r2=1294514&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternReplaceCharFilter.java
(original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternReplaceCharFilter.java
Tue Feb 28 08:04:42 2012
@@ -296,7 +296,7 @@ public class TestPatternReplaceCharFilte
           return new PatternReplaceCharFilter(p, replacement, CharReader.get(reader));
         }
       };
-      checkRandomData(random, a, 1000*RANDOM_MULTIPLIER, true); // only ascii
+      checkRandomData(random, a, 1000 * RANDOM_MULTIPLIER, true); // only ascii
     }
   }
   



Mime
View raw message