test: list index files on failure

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1622693 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-09-05 13:13:44 +00:00
parent ff9e0437de
commit 426a5736d9
1 changed files with 13 additions and 1 deletions

View File

@ -1166,6 +1166,7 @@ public class TestIndexWriter extends LuceneTestCase {
} catch (Throwable t) { } catch (Throwable t) {
log.println("thread " + id + " FAILED; unexpected exception"); log.println("thread " + id + " FAILED; unexpected exception");
t.printStackTrace(log); t.printStackTrace(log);
listIndexFiles(log, dir);
failed = true; failed = true;
break; break;
} }
@ -1194,6 +1195,7 @@ public class TestIndexWriter extends LuceneTestCase {
failed = true; failed = true;
log.println("thread " + id + ": CheckIndex FAILED: unexpected exception"); log.println("thread " + id + ": CheckIndex FAILED: unexpected exception");
e.printStackTrace(log); e.printStackTrace(log);
listIndexFiles(log, dir);
} }
try { try {
IndexReader r = DirectoryReader.open(dir); IndexReader r = DirectoryReader.open(dir);
@ -1203,6 +1205,7 @@ public class TestIndexWriter extends LuceneTestCase {
failed = true; failed = true;
log.println("thread " + id + ": DirectoryReader.open FAILED: unexpected exception"); log.println("thread " + id + ": DirectoryReader.open FAILED: unexpected exception");
e.printStackTrace(log); e.printStackTrace(log);
listIndexFiles(log, dir);
} }
} }
try { try {
@ -1218,6 +1221,16 @@ public class TestIndexWriter extends LuceneTestCase {
throw new RuntimeException("thread " + id, e); throw new RuntimeException("thread " + id, e);
} }
} }
private void listIndexFiles(PrintStream log, Directory dir) {
try {
log.println("index files: " + Arrays.toString(dir.listAll()));
} catch (IOException ioe) {
// Suppress
log.println("failed to index files:");
ioe.printStackTrace(log);
}
}
} }
public void testThreadInterruptDeadlock() throws Exception { public void testThreadInterruptDeadlock() throws Exception {
@ -1730,7 +1743,6 @@ public class TestIndexWriter extends LuceneTestCase {
Arrays.fill(chars, 'x'); Arrays.fill(chars, 'x');
Document doc = new Document(); Document doc = new Document();
final String bigTerm = new String(chars); final String bigTerm = new String(chars);
final BytesRef bigTermBytesRef = new BytesRef(bigTerm);
// This contents produces a too-long term: // This contents produces a too-long term:
String contents = "abc xyz x" + bigTerm + " another term"; String contents = "abc xyz x" + bigTerm + " another term";