LUCENE-2710: reproduce-with on test failure isnt right if you manually override things

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1023250 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-10-16 11:27:54 +00:00
parent 5870f2f0d7
commit fb57fd149a
2 changed files with 14 additions and 2 deletions

View File

@ -43,7 +43,7 @@ import org.apache.lucene.util.LuceneTestCase;
public class TestDemo extends LuceneTestCase { public class TestDemo extends LuceneTestCase {
public void testDemo() throws IOException, ParseException { public void testDemo() throws IOException, ParseException {
fail();
Analyzer analyzer = new MockAnalyzer(); Analyzer analyzer = new MockAnalyzer();
// Store the index in memory: // Store the index in memory:

View File

@ -759,7 +759,19 @@ public abstract class LuceneTestCase extends Assert {
// We get here from InterceptTestCaseEvents on the 'failed' event.... // We get here from InterceptTestCaseEvents on the 'failed' event....
public void reportAdditionalFailureInfo() { public void reportAdditionalFailureInfo() {
System.out.println("NOTE: reproduce with: ant test -Dtestcase=" + getClass().getSimpleName() 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 // recorded seed: for beforeClass