lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwe...@apache.org
Subject svn commit: r1525815 - in /lucene/dev/trunk/lucene: core/src/test/org/apache/lucene/util/junitcompat/ test-framework/src/java/org/apache/lucene/util/
Date Tue, 24 Sep 2013 08:28:00 GMT
Author: dweiss
Date: Tue Sep 24 08:28:00 2013
New Revision: 1525815

URL: http://svn.apache.org/r1525815
Log:
LUCENE-5238: Fix junitcompat tests (so that they're not triggered when previous errors occur).

Modified:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfUnreferencedFiles.java
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreTestSuites.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java?rev=1525815&r1=1525814&r2=1525815&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java
(original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java
Tue Sep 24 08:28:00 2013
@@ -24,6 +24,8 @@ import org.junit.runner.JUnitCore;
 import org.junit.runner.Result;
 import org.junit.runner.notification.Failure;
 
+import com.carrotsearch.randomizedtesting.RandomizedTest;
+
 public class TestFailIfDirectoryNotClosed extends WithNestedTests {
   public TestFailIfDirectoryNotClosed() {
     super(true);
@@ -39,6 +41,9 @@ public class TestFailIfDirectoryNotClose
   @Test
   public void testFailIfDirectoryNotClosed() {
     Result r = JUnitCore.runClasses(Nested1.class);
+    RandomizedTest.assumeTrue("Ignoring nested test, very likely zombie threads present.",

+        r.getIgnoreCount() == 0);
+
     for (Failure f : r.getFailures()) {
       System.out.println("Failure: " + f);
     }

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfUnreferencedFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfUnreferencedFiles.java?rev=1525815&r1=1525814&r2=1525815&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfUnreferencedFiles.java
(original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfUnreferencedFiles.java
Tue Sep 24 08:28:00 2013
@@ -29,6 +29,9 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.JUnitCore;
 import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+import com.carrotsearch.randomizedtesting.RandomizedTest;
 
 // LUCENE-4456: Test that we fail if there are unreferenced files
 public class TestFailIfUnreferencedFiles extends WithNestedTests {
@@ -53,6 +56,17 @@ public class TestFailIfUnreferencedFiles
   @Test
   public void testFailIfUnreferencedFiles() {
     Result r = JUnitCore.runClasses(Nested1.class);
-    Assert.assertEquals(1, r.getFailureCount());
+    RandomizedTest.assumeTrue("Ignoring nested test, very likely zombie threads present.",

+        r.getIgnoreCount() == 0);
+
+    // We are suppressing output anyway so dump the failures.
+    for (Failure f : r.getFailures()) {
+      System.out.println(f.getTrace());
+    }
+
+    Assert.assertEquals("Expected exactly one failure.", 
+        1, r.getFailureCount());
+    Assert.assertTrue("Expected unreferenced files assertion.", 
+        r.getFailures().get(0).getTrace().contains("unreferenced files:"));
   }
 }

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreTestSuites.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreTestSuites.java?rev=1525815&r1=1525814&r2=1525815&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreTestSuites.java
(original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreTestSuites.java
Tue Sep 24 08:28:00 2013
@@ -49,7 +49,7 @@ public final class TestRuleIgnoreTestSui
       @Override
       public void evaluate() throws Throwable {
         if (NestedTestSuite.class.isAssignableFrom(d.getTestClass())) {
-          LuceneTestCase.assumeTrue("Nested suite class ignored (started as stand-along).",
+          LuceneTestCase.assumeTrue("Nested suite class ignored (started as stand-alone).",
               isRunningNested());
         }
         s.evaluate();



Mime
View raw message