diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java index bcde826020f..b964872ccbd 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java @@ -1,4 +1,4 @@ -/** +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -18,6 +18,7 @@ package org.apache.hadoop.hbase; import java.util.concurrent.TimeUnit; + import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.SmallTests; diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java index 343108e08b5..495667c8028 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java @@ -18,6 +18,7 @@ package org.apache.hadoop.hbase; import org.apache.hadoop.hbase.testclassification.SmallTests; +import org.apache.hadoop.hbase.util.Threads; import org.junit.ClassRule; import org.junit.Ignore; import org.junit.Test; @@ -41,6 +42,18 @@ public class TestTimeout { */ @Ignore @Test public void infiniteLoop() { - while (true) {} + // Launch a background non-daemon thread. + Thread t = new Thread("HangingThread") { + public void run() { + synchronized(this) { + while(true) { + } + } + } + }; + t.start(); + while (true) { + // Just hang out too. + } } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java similarity index 98% rename from hbase-server/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java rename to hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java index 5beeace8e57..d5c87f3992e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java @@ -55,12 +55,13 @@ public class TimedOutTestsListener extends RunListener { @Override public void testFailure(Failure failure) throws Exception { - if (failure != null && failure.getMessage() != null + if (failure != null && failure.getMessage() != null && failure.getMessage().startsWith(TEST_TIMED_OUT_PREFIX)) { output.println("====> TEST TIMED OUT. PRINTING THREAD DUMP. <===="); output.println(); output.print(buildThreadDiagnosticString()); } + output.flush(); } public static String buildThreadDiagnosticString() { diff --git a/pom.xml b/pom.xml index b23a9669d94..1cb508291b2 100755 --- a/pom.xml +++ b/pom.xml @@ -677,7 +677,7 @@ listener - org.apache.hadoop.hbase.HBaseClassTestRuleChecker,org.apache.hadoop.hbase.ResourceCheckerJUnitListener + org.apache.hadoop.hbase.TimedOutTestsListener,org.apache.hadoop.hbase.HBaseClassTestRuleChecker,org.apache.hadoop.hbase.ResourceCheckerJUnitListener