Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-02-21 09:58:25 +0000
committerMatthias Sohn2016-02-21 15:43:01 +0000
commit37062233f82dfa764bdef6b1cd706c6d74d3dd34 (patch)
tree769737dcbe112685ad0323fdfccade09ced0b102 /org.eclipse.egit.core.test
parentfb572c34715624163d1ee5e74cd87b020bf3d295 (diff)
downloadegit-37062233f82dfa764bdef6b1cd706c6d74d3dd34.tar.gz
egit-37062233f82dfa764bdef6b1cd706c6d74d3dd34.tar.xz
egit-37062233f82dfa764bdef6b1cd706c6d74d3dd34.zip
Test stability investigation: GitSubscriberMergeContextTest
I can't get that test to fail locally; neither on native OS X nor on a Linux (Ubuntu 15.04) VM. Yet it fails frequently on Hudson. I don't see anything wrong with the test either. Let's include a lot of debug output in an attempt to figure out what's going on. I suggest we do actually merge this, so that we have the extra info the next time it fails. Hopefully that'll give some hints. I couldn't find a thread dump method anywhere, so I wrote my own. Change-Id: Icdd054c5b7f878771046706f615746e3f47e9b4f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.core.test')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/synchronize/GitSubscriberMergeContextTest.java18
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestUtils.java34
2 files changed, 52 insertions, 0 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/synchronize/GitSubscriberMergeContextTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/synchronize/GitSubscriberMergeContextTest.java
index e92e41d701..e2e8cc7786 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/synchronize/GitSubscriberMergeContextTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/synchronize/GitSubscriberMergeContextTest.java
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.util.LinkedHashSet;
@@ -381,6 +382,23 @@ public class GitSubscriberMergeContextTest extends ModelTestCase {
iProject.refreshLocal(IResource.DEPTH_INFINITE,
new NullProgressMonitor());
TestUtils.waitForJobs(500, 5000, null);
+ if (!iFile2.exists()) {
+ // Debug output to track down sporadically failing test
+ System.out.println(iFile2 + " is synchronized? " + Boolean
+ .toString(iFile2.isSynchronized(IResource.DEPTH_ZERO)));
+ System.out.println(TestUtils.dumpThreads());
+ System.out.println("***** WARNING: IFile reported as not existing");
+ System.out.println(iProject + " is open? "
+ + Boolean.toString(iProject.isOpen()));
+ System.out.println(file2.getPath() + " exists? "
+ + Boolean.toString(file2.exists()));
+ System.out.println(iFile2 + " exists now? "
+ + Boolean.toString(iFile2.exists()));
+ iFile2 = iProject.getFile(iFile2.getName());
+ System.out.println(iFile2 + " exists now? "
+ + Boolean.toString(iFile2.exists()));
+ fail(iFile2 + " reported not to exist");
+ }
assertTrue(iFile2.exists());
final String masterChanges = "some changes\n";
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestUtils.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestUtils.java
index a6abb1c098..e5d564b852 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestUtils.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestUtils.java
@@ -19,6 +19,10 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
+import java.lang.management.LockInfo;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -364,4 +368,34 @@ public class TestUtils {
return map;
}
+ public static String dumpThreads() {
+ final StringBuilder dump = new StringBuilder();
+ final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+ final ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(
+ threadMXBean.isObjectMonitorUsageSupported(),
+ threadMXBean.isSynchronizerUsageSupported());
+ for (ThreadInfo threadInfo : threadInfos) {
+ dump.append("Thread ").append(threadInfo.getThreadId()).append(' ')
+ .append(threadInfo.getThreadName()).append(' ')
+ .append(threadInfo.getThreadState()).append('\n');
+ LockInfo blocked = threadInfo.getLockInfo();
+ if (blocked != null) {
+ dump.append(" Waiting for ").append(blocked);
+ String lockOwner = threadInfo.getLockOwnerName();
+ if (lockOwner != null && !lockOwner.isEmpty()) {
+ dump.append(" held by ").append(lockOwner).append("(id=")
+ .append(threadInfo.getLockOwnerId()).append(')');
+ }
+ dump.append('\n');
+ }
+ for (LockInfo lock : threadInfo.getLockedSynchronizers()) {
+ dump.append(" Holding ").append(lock).append('\n');
+ }
+ for (StackTraceElement s : threadInfo.getStackTrace()) {
+ dump.append(" at ").append(s).append('\n');
+ }
+ }
+ return dump.toString();
+ }
+
}

Back to the top