You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2011/05/22 18:15:03 UTC
svn commit: r1126029 - in /lucene/dev/branches/branch_3x: ./ lucene/
lucene/backwards/
lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java solr/
Author: mikemccand
Date: Sun May 22 16:15:02 2011
New Revision: 1126029
URL: http://svn.apache.org/viewvc?rev=1126029&view=rev
Log:
test fix: LuceneTestCase was reporting the wrong iter that failed
Modified:
lucene/dev/branches/branch_3x/ (props changed)
lucene/dev/branches/branch_3x/lucene/ (props changed)
lucene/dev/branches/branch_3x/lucene/backwards/ (props changed)
lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
lucene/dev/branches/branch_3x/solr/ (props changed)
Modified: lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java?rev=1126029&r1=1126028&r2=1126029&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java Sun May 22 16:15:02 2011
@@ -69,6 +69,8 @@ import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runner.manipulation.Filter;
import org.junit.runner.manipulation.NoTestsRemainException;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
@@ -1019,6 +1021,7 @@ public abstract class LuceneTestCase ext
* with one that returns null for getSequentialSubReaders.
*/
public static IndexSearcher newSearcher(IndexReader r, boolean maybeWrap) throws IOException {
+
if (random.nextBoolean()) {
if (maybeWrap && random.nextBoolean()) {
return new IndexSearcher(new SlowMultiReaderWrapper(r));
@@ -1169,19 +1172,25 @@ public abstract class LuceneTestCase ext
}
// only print iteration info if the user requested more than one iterations
- boolean verbose = VERBOSE && TEST_ITER > 1;
- int lastIterFailed = -1;
+ final boolean verbose = VERBOSE && TEST_ITER > 1;
+
+ final int currentIter[] = new int[1];
+ arg1.addListener(new RunListener() {
+ @Override
+ public void testFailure(Failure failure) throws Exception {
+ if (verbose) {
+ System.out.println("\nNOTE: iteration " + currentIter[0] + " failed! ");
+ }
+ }
+ });
for (int i = 0; i < TEST_ITER; i++) {
+ currentIter[0] = i;
if (verbose) {
System.out.println("\nNOTE: running iter=" + (1+i) + " of " + TEST_ITER);
}
super.runChild(arg0, arg1);
if (testsFailed) {
- lastIterFailed = i;
- if (i == TEST_ITER_MIN - 1) {
- if (verbose) {
- System.out.println("\nNOTE: iteration " + lastIterFailed + " failed !");
- }
+ if (i >= TEST_ITER_MIN - 1) { // XXX is this still off-by-one?
break;
}
}