LUCENE-5044: save work in various tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1491261 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-06-09 18:41:53 +00:00
parent cd4e6b3231
commit 12dd8014dd
9 changed files with 38 additions and 14 deletions

View File

@ -58,6 +58,9 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
boolean isClose = false;
StackTraceElement[] trace = new Exception().getStackTrace();
for (int i = 0; i < trace.length; i++) {
if (isDoFlush && isClose) {
break;
}
if ("flush".equals(trace[i].getMethodName())) {
isDoFlush = true;
}

View File

@ -339,6 +339,7 @@ public class TestDocumentsWriterStallControl extends LuceneTestCase {
for (Thread thread : threads) {
if (thread.getState() != state) {
done = false;
break;
}
}
if (done) {

View File

@ -539,10 +539,15 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
boolean sawAppend = false;
boolean sawFlush = false;
for (int i = 0; i < trace.length; i++) {
if (FreqProxTermsWriterPerField.class.getName().equals(trace[i].getClassName()) && "flush".equals(trace[i].getMethodName()))
if (sawAppend && sawFlush) {
break;
}
if (FreqProxTermsWriterPerField.class.getName().equals(trace[i].getClassName()) && "flush".equals(trace[i].getMethodName())) {
sawAppend = true;
if ("flush".equals(trace[i].getMethodName()))
}
if ("flush".equals(trace[i].getMethodName())) {
sawFlush = true;
}
}
if (sawAppend && sawFlush && count++ >= 30) {
@ -876,12 +881,18 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
boolean isDelete = false;
boolean isInGlobalFieldMap = false;
for (int i = 0; i < trace.length; i++) {
if (SegmentInfos.class.getName().equals(trace[i].getClassName()) && stage.equals(trace[i].getMethodName()))
if (isCommit && isDelete && isInGlobalFieldMap) {
break;
}
if (SegmentInfos.class.getName().equals(trace[i].getClassName()) && stage.equals(trace[i].getMethodName())) {
isCommit = true;
if (MockDirectoryWrapper.class.getName().equals(trace[i].getClassName()) && "deleteFile".equals(trace[i].getMethodName()))
}
if (MockDirectoryWrapper.class.getName().equals(trace[i].getClassName()) && "deleteFile".equals(trace[i].getMethodName())) {
isDelete = true;
if (SegmentInfos.class.getName().equals(trace[i].getClassName()) && "writeGlobalFieldMap".equals(trace[i].getMethodName()))
}
if (SegmentInfos.class.getName().equals(trace[i].getClassName()) && "writeGlobalFieldMap".equals(trace[i].getMethodName())) {
isInGlobalFieldMap = true;
}
}
if (isInGlobalFieldMap && dontFailDuringGlobalFieldMap) {
@ -1323,6 +1334,7 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
for (int i = 0; i < trace.length; i++) {
if (TermVectorsConsumer.class.getName().equals(trace[i].getClassName()) && stage.equals(trace[i].getMethodName())) {
fail = true;
break;
}
}

View File

@ -358,6 +358,9 @@ public class TestIndexWriterWithThreads extends LuceneTestCase {
boolean sawClose = false;
boolean sawMerge = false;
for (int i = 0; i < trace.length; i++) {
if (sawAbortOrFlushDoc && sawMerge && sawClose) {
break;
}
if ("abort".equals(trace[i].getMethodName()) ||
"finishDocument".equals(trace[i].getMethodName())) {
sawAbortOrFlushDoc = true;
@ -370,8 +373,9 @@ public class TestIndexWriterWithThreads extends LuceneTestCase {
}
}
if (sawAbortOrFlushDoc && !sawClose && !sawMerge) {
if (onlyOnce)
if (onlyOnce) {
doFail = false;
}
//System.out.println(Thread.currentThread().getName() + ": now fail");
//new Throwable().printStackTrace(System.out);
throw new IOException("now failing on purpose");

View File

@ -379,11 +379,11 @@ public class TestPayloadSpans extends LuceneTestCase {
PayloadSpanUtil psu = new PayloadSpanUtil(searcher.getTopReaderContext());
Collection<byte[]> payloads = psu.getPayloadsForQuery(new TermQuery(new Term(PayloadHelper.FIELD, "rr")));
if(VERBOSE)
if(VERBOSE) {
System.out.println("Num payloads:" + payloads.size());
for (final byte [] bytes : payloads) {
if(VERBOSE)
for (final byte [] bytes : payloads) {
System.out.println(new String(bytes, "UTF-8"));
}
}
reader.close();
directory.close();
@ -451,12 +451,12 @@ public class TestPayloadSpans extends LuceneTestCase {
System.out.println("\nSpans Dump --");
if (spans.isPayloadAvailable()) {
Collection<byte[]> payload = spans.getPayload();
if(VERBOSE)
if(VERBOSE) {
System.out.println("payloads for span:" + payload.size());
for (final byte [] bytes : payload) {
if(VERBOSE)
for (final byte [] bytes : payload) {
System.out.println("doc:" + spans.doc() + " s:" + spans.start() + " e:" + spans.end() + " "
+ new String(bytes, "UTF-8"));
}
}
assertEquals(numPayloads[cnt],payload.size());

View File

@ -69,6 +69,7 @@ public class TestFailOnFieldCacheInsanity extends WithNestedTests {
for(Failure f : r.getFailures()) {
if (f.getMessage().indexOf("Insane") != -1) {
insane = true;
break;
}
}
Assert.assertTrue(insane);

View File

@ -121,8 +121,8 @@ public class TestFacetsAccumulatorWithComplement extends FacetTestBase {
// Results are ready, printing them...
int i = 0;
for (FacetResult facetResult : res) {
if (VERBOSE) {
if (VERBOSE) {
for (FacetResult facetResult : res) {
System.out.println("Res "+(i++)+": "+facetResult);
}
}

View File

@ -406,6 +406,7 @@ public class AllGroupHeadsCollectorTest extends LuceneTestCase {
for (int a : actual) {
if (e == a) {
found = true;
break;
}
}

View File

@ -827,12 +827,14 @@ public class TestGrouping extends LuceneTestCase {
for(SortField sf : docSort.getSort()) {
if (sf.getType() == SortField.Type.SCORE) {
getScores = true;
break;
}
}
for(SortField sf : groupSort.getSort()) {
if (sf.getType() == SortField.Type.SCORE) {
getScores = true;
break;
}
}