improved error diagnostics in case of a test failure

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@24794 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-12-21 23:28:20 +00:00
1 parent 28a492761b
commit bae1397472
1 file changed
+13 -2
@@ -33,6 +33,8 @@ import hudson.ExtensionList;
import hudson.DescriptorExtensionList;
import hudson.Util;
import hudson.model.Computer;
import hudson.model.Executor;
import hudson.model.Queue.Executable;
import hudson.tools.ToolProperty;
import hudson.remoting.Which;
import hudson.Launcher.LocalLauncher;
@@ -788,8 +790,17 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
if (streak>5) // the system is quiet for a while
return;
if (System.currentTimeMillis()-startTime > timeout)
throw new AssertionError("Hudson is still doing something after "+timeout+"ms");
if (System.currentTimeMillis()-startTime > timeout) {
List<Executable> building = new ArrayList<Executable>();
for (Computer c : hudson.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
}
}
throw new AssertionError(String.format("Hudson is still doing something after %dms: queue=%s building=%s",
timeout, Arrays.asList(hudson.getQueue().getItems()), building));
}
}
}