You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2013/01/31 23:22:34 UTC

svn commit: r1441226 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/test/org/apache/lucene/util/junitcompat/ lucene/test-framework/src/java/org/apache/lucene/util/

Author: dweiss
Date: Thu Jan 31 22:22:34 2013
New Revision: 1441226

URL: http://svn.apache.org/viewvc?rev=1441226&view=rev
Log:
LUCENE-4736: ignore TimerThread zombies on J9.
Merging 1440961 from trunk.



Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
    lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java?rev=1441226&r1=1441225&r2=1441226&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailIfDirectoryNotClosed.java Thu Jan 31 22:22:34 2013
@@ -22,6 +22,7 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.JUnitCore;
 import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
 
 public class TestFailIfDirectoryNotClosed extends WithNestedTests {
   public TestFailIfDirectoryNotClosed() {
@@ -38,6 +39,10 @@ public class TestFailIfDirectoryNotClose
   @Test
   public void testFailIfDirectoryNotClosed() {
     Result r = JUnitCore.runClasses(Nested1.class);
+    for (Failure f : r.getFailures()) {
+      System.out.println("Failure: " + f);
+    }
     Assert.assertEquals(1, r.getFailureCount());
+    Assert.assertTrue(r.getFailures().get(0).toString().contains("Resource in scope SUITE failed to close"));
   }
 }

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java?rev=1441226&r1=1441225&r2=1441226&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java Thu Jan 31 22:22:34 2013
@@ -20,15 +20,20 @@ package org.apache.lucene.util.junitcomp
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
+import java.util.List;
 
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestRuleIgnoreTestSuites;
+import org.apache.lucene.util.TestRuleMarkFailure;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
 
 import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import com.carrotsearch.randomizedtesting.rules.TestRuleAdapter;
 
 /**
  * An abstract test class that prepares nested test classes to run.
@@ -43,7 +48,6 @@ import com.carrotsearch.randomizedtestin
  * cause havoc (static fields).
  */
 public abstract class WithNestedTests {
-
   public static abstract class AbstractNestedTest extends LuceneTestCase 
     implements TestRuleIgnoreTestSuites.NestedTestSuite {
     protected static boolean isRunningNested() {
@@ -66,8 +70,23 @@ public abstract class WithNestedTests {
    * Restore properties after test.
    */
   @Rule
-  public SystemPropertiesRestoreRule restoreProperties = new SystemPropertiesRestoreRule();
-  
+  public final TestRule rules;
+  {
+    final TestRuleMarkFailure marker = new TestRuleMarkFailure();
+    rules = RuleChain
+      .outerRule(new SystemPropertiesRestoreRule())
+      .around(new TestRuleAdapter() {
+        @Override
+        protected void afterAlways(List<Throwable> errors) throws Throwable {
+          if (marker.hadFailures() && suppressOutputStreams) {
+            System.out.println("sysout from nested test: " + getSysOut() + "\n");
+            System.out.println("syserr from nested test: " + getSysErr());
+          }
+        }
+      })
+      .around(marker);
+  }
+      
   @Before
   public final void before() {
     if (suppressOutputStreams) {

Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java?rev=1441226&r1=1441225&r2=1441226&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java Thu Jan 31 22:22:34 2013
@@ -24,23 +24,20 @@ import com.carrotsearch.randomizedtestin
  * TODO: remove when integrated in system filters in rr.
  */
 public class QuickPatchThreadsFilter implements ThreadFilter {
+  static final boolean isJ9;
+  
+  static {
+    isJ9 = System.getProperty("java.vm.info", "<?>").contains("IBM J9");
+  }
+
   @Override
   public boolean reject(Thread t) {
-    // MacOS system thread.
-    if (t.getName().equals("AWT-AppKit")) {
-      return true;
-    }
-
-    // J9 memory pool thread.
-    if (t.getName().equals("MemoryPoolMXBean notification dispatcher")) {
-      return true;
-    }
-    
-    // forked process reaper on Unixish systems
-    if (t.getName().equals("process reaper")) {
-      return true;
+    if (isJ9) {
+      StackTraceElement [] stack = t.getStackTrace();
+      if (stack.length > 0 && stack[stack.length - 1].getClassName().equals("java.util.Timer$TimerImpl")) {
+        return true; // LUCENE-4736
+      }
     }
-
     return false;
   }
 }