lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1495290 - in /lucene/dev/trunk: ./ lucene/ lucene/core/ lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java lucene/test-framework/ lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
Date Fri, 21 Jun 2013 04:25:03 GMT
Author: rmuir
Date: Fri Jun 21 04:25:03 2013
New Revision: 1495290

URL: http://svn.apache.org/r1495290
Log:
LUCENE-5066: fix TestFieldsReader OOM (test bug)

Modified:
    lucene/dev/trunk/   (props changed)
    lucene/dev/trunk/lucene/   (props changed)
    lucene/dev/trunk/lucene/core/   (props changed)
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java
    lucene/dev/trunk/lucene/test-framework/   (props changed)
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=1495290&r1=1495289&r2=1495290&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java Fri
Jun 21 04:25:03 2013
@@ -170,12 +170,11 @@ public class TestFieldsReader extends Lu
     @Override
     public void readInternal(byte[] b, int offset, int length) throws IOException {
       simOutage();
+      delegate.seek(getFilePointer());
       delegate.readBytes(b, offset, length);
     }
     @Override
     public void seekInternal(long pos) throws IOException {
-      //simOutage();
-      delegate.seek(pos);
     }
     @Override
     public long length() {
@@ -187,7 +186,14 @@ public class TestFieldsReader extends Lu
     }
     @Override
     public FaultyIndexInput clone() {
-      return new FaultyIndexInput(delegate.clone());
+      FaultyIndexInput i = new FaultyIndexInput(delegate.clone());
+      // seek the clone to our current position
+      try {
+        i.seek(getFilePointer());
+      } catch (IOException e) {
+        throw new RuntimeException();
+      }
+      return i;
     }
   }
 
@@ -197,8 +203,9 @@ public class TestFieldsReader extends Lu
 
     try {
       Directory dir = new FaultyFSDirectory(indexDir);
-      IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( 
-          TEST_VERSION_CURRENT, new MockAnalyzer(random())).setOpenMode(OpenMode.CREATE));
+      IndexWriterConfig iwc = newIndexWriterConfig( 
+          TEST_VERSION_CURRENT, new MockAnalyzer(random())).setOpenMode(OpenMode.CREATE);
+      IndexWriter writer = new IndexWriter(dir, iwc);
       for(int i=0;i<2;i++)
         writer.addDocument(testDoc);
       writer.forceMerge(1);

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java?rev=1495290&r1=1495289&r2=1495290&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
(original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
Fri Jun 21 04:25:03 2013
@@ -84,6 +84,9 @@ final class TestRuleSetupAndRestoreClass
 
     @Override
     public void message(String component, String message) {
+      if ("TP".equals(component)) {
+        return; // ignore test points!
+      }
       final String name;
       if (Thread.currentThread().getName().startsWith("TEST-")) {
         // The name of the main thread is way too



Mime
View raw message