Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2021-02-07 18:16:19 +0000
committerThomas Wolf2021-02-07 18:41:24 +0000
commitbe22c0f14070bf483b46d74a13b8dfa52e565c38 (patch)
tree7fa57e6d425af002971fb128b58dc882c6048e9e
parent3f3348398180202b59185fbd11f55a8320e8f76b (diff)
downloadegit-be22c0f14070bf483b46d74a13b8dfa52e565c38.tar.gz
egit-be22c0f14070bf483b46d74a13b8dfa52e565c38.tar.xz
egit-be22c0f14070bf483b46d74a13b8dfa52e565c38.zip
Try to stabilize core tests
Looks like the asynchronous file timestamp resolution determination is sometimes still trying to determine the resolution when a test finishes and wants to delete the git repository. Avoid this by forcing this to run synchronously. Add a lot of debug output when deleting the git directory at the end of a test fails. Change-Id: Id79b423ec85eaa0d7d3820ddc79d8d9e24949d50 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/GitTestCase.java12
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java1
2 files changed, 11 insertions, 2 deletions
diff --git a/org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/GitTestCase.java
index 074b7dcf40..3304afbc94 100644
--- a/org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/GitTestCase.java
+++ b/org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/GitTestCase.java
@@ -54,6 +54,7 @@ public abstract class GitTestCase {
.getPluginId());
p.putBoolean(GitCorePreferences.core_autoIgnoreDerivedResources, false);
p.putBoolean(GitCorePreferences.core_autoShareProjects, false);
+ FS.FileStoreAttributes.setBackground(false);
}
@Before
@@ -93,8 +94,15 @@ public abstract class GitTestCase {
public void tearDown() throws Exception {
project.dispose();
Activator.getDefault().getRepositoryCache().clear();
- if (gitDir.exists())
- FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY);
+ if (gitDir.exists()) {
+ try {
+ FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY);
+ } catch (Exception e) {
+ System.err.println(TestUtils.dumpThreads());
+ TestUtils.listDirectory(gitDir, true);
+ throw e;
+ }
+ }
SystemReader.setInstance(null);
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
index 2b2e6f65cf..57d01a541c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
@@ -255,6 +255,7 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
@BeforeClass
public static void beforeClassBase() throws Exception {
+ FS.FileStoreAttributes.setBackground(false);
// suppress auto-ignoring and auto-sharing to avoid interference
IEclipsePreferences corePrefs = InstanceScope.INSTANCE
.getNode(org.eclipse.egit.core.Activator.getPluginId());

Back to the top