Apache Lucene open-source search software
LUCENE-2710: reproduce-with on test failure isnt right if you manually override things
Robert Muirfb57fd149ac7
diff --git a/lucene/src/test/org/apache/lucene/TestDemo.java b/lucene/src/test/org/apache/lucene/TestDemo.javaindex b865efb17ca..9ae2329c7ea 100644--- a/lucene/src/test/org/apache/lucene/TestDemo.java+++ b/lucene/src/test/org/apache/lucene/TestDemo.java@@ -43,7 +43,7 @@ import org.apache.lucene.util.LuceneTestCase;public class TestDemo extends LuceneTestCase {public void testDemo() throws IOException, ParseException {-+ fail();Analyzer analyzer = new MockAnalyzer();// Store the index in memory:diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.javaindex 92590b5bdfc..21ebe8f63a8 100644--- a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java@@ -759,7 +759,19 @@ public abstract class LuceneTestCase extends Assert {// We get here from InterceptTestCaseEvents on the 'failed' event....public void reportAdditionalFailureInfo() {System.out.println("NOTE: reproduce with: ant test -Dtestcase=" + getClass().getSimpleName()- + " -Dtestmethod=" + getName() + " -Dtests.seed=" + new TwoLongs(staticSeed, seed));+ + " -Dtestmethod=" + getName() + " -Dtests.seed=" + new TwoLongs(staticSeed, seed)+ + reproduceWithExtraParams());+ }++ // extra params that were overridden needed to reproduce the command+ private String reproduceWithExtraParams() {+ StringBuilder sb = new StringBuilder();+ if (!TEST_CODEC.equals("random")) sb.append(" -Dtests.codec=").append(TEST_CODEC);+ if (!TEST_LOCALE.equals("random")) sb.append(" -Dtests.locale=").append(TEST_LOCALE);+ if (!TEST_TIMEZONE.equals("random")) sb.append(" -Dtests.timezone=").append(TEST_TIMEZONE);+ if (!TEST_DIRECTORY.equals("random")) sb.append(" -Dtests.directory=").append(TEST_DIRECTORY);+ if (RANDOM_MULTIPLIER > 1) sb.append(" -Dtests.multiplier=").append(RANDOM_MULTIPLIER);+ return sb.toString();}// recorded seed: for beforeClass