提交 0f859a38 编写于 作者: J Jesse Glick

Automatically disable test timeout when running in a debugger.

(cherry picked from commit abf33593)
上级 03a26f30
...@@ -291,7 +291,7 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { ...@@ -291,7 +291,7 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
/** /**
* Number of seconds until the test times out. * Number of seconds until the test times out.
*/ */
public int timeout = Integer.getInteger("jenkins.test.timeout", 180); public int timeout = Integer.getInteger("jenkins.test.timeout", System.getProperty("maven.surefire.debug") == null ? 180 : 0);
private volatile Timer timeoutTimer; private volatile Timer timeoutTimer;
...@@ -383,8 +383,10 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { ...@@ -383,8 +383,10 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
} }
protected void setUpTimeout() { protected void setUpTimeout() {
if (timeout<=0) return; // no timeout if (timeout <= 0) {
System.out.println("Test timeout disabled.");
return;
}
final Thread testThread = Thread.currentThread(); final Thread testThread = Thread.currentThread();
timeoutTimer = new Timer(); timeoutTimer = new Timer();
timeoutTimer.schedule(new TimerTask() { timeoutTimer.schedule(new TimerTask() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册