HBASE-19986 If HBaseTestClassRule timesout a test, thread dump
This commit is contained in:
parent
00f8877323
commit
c2ee82c909
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ public class TimedOutTestsListener extends RunListener {
|
|||
output.println();
|
||||
output.print(buildThreadDiagnosticString());
|
||||
}
|
||||
output.flush();
|
||||
}
|
||||
|
||||
public static String buildThreadDiagnosticString() {
|
2
pom.xml
2
pom.xml
|
@ -677,7 +677,7 @@
|
|||
<properties>
|
||||
<property>
|
||||
<name>listener</name>
|
||||
<value>org.apache.hadoop.hbase.HBaseClassTestRuleChecker,org.apache.hadoop.hbase.ResourceCheckerJUnitListener</value>
|
||||
<value>org.apache.hadoop.hbase.TimedOutTestsListener,org.apache.hadoop.hbase.HBaseClassTestRuleChecker,org.apache.hadoop.hbase.ResourceCheckerJUnitListener</value>
|
||||
</property>
|
||||
</properties>
|
||||
</configuration>
|
||||
|
|
Loading…
Reference in New Issue