Index: lucene/common-build.xml =================================================================== --- lucene/common-build.xml (revision 1086635) +++ lucene/common-build.xml (working copy) @@ -77,6 +77,7 @@ + @@ -499,6 +500,8 @@ + + Index: lucene/CHANGES.txt =================================================================== --- lucene/CHANGES.txt (revision 1086635) +++ lucene/CHANGES.txt (working copy) @@ -20,6 +20,12 @@ indexes, causing existing deletions to be applied on the incoming indexes as well. (Shai Erera, Mike McCandless) +Test Cases + +* LUCENE-3002: added 'tests.iter.min' to control 'tests.iter' by allowing to + stop iterating if at least 'tests.iter.min' ran and a failure occured. + (Shai Erera, Chris Hostetter) + ======================= Lucene 3.1 (not yet released) ======================= Changes in backwards compatibility policy Index: lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java =================================================================== --- lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java (revision 1086635) +++ lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java (working copy) @@ -141,6 +141,8 @@ public static final String TEST_DIRECTORY = System.getProperty("tests.directory", "random"); /** Get the number of times to run tests */ public static final int TEST_ITER = Integer.parseInt(System.getProperty("tests.iter", "1")); + /** Get the minimum number of times to run tests until a failure happens */ + public static final int TEST_ITER_MIN = Integer.parseInt(System.getProperty("tests.iter.min", Integer.toString(TEST_ITER))); /** Get the random seed for tests */ public static final String TEST_SEED = System.getProperty("tests.seed", "random"); /** whether or not nightly tests should run */ @@ -1069,11 +1071,24 @@ if (VERBOSE) { System.out.println("\nNOTE: running test " + arg0.getName()); } + + // only print iteration info if the user requested more than one iterations + boolean verbose = VERBOSE && TEST_ITER > 1; + int lastIterFailed = -1; for (int i = 0; i < TEST_ITER; i++) { - if (VERBOSE && TEST_ITER > 1) { + 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 !"); + } + break; + } + } } }