Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2014-07-23 14:01:18 +0000
committerAndrey Loskutov2016-07-13 09:33:28 +0000
commitbdafe367923e4772e7193d3c9a6767a95b0dd8af (patch)
tree3c274636ed329ba6edb99a86fa049dec1b06c89e /org.eclipse.egit.ui.test
parentda310749c6c8721e448d81a6317b19be27e30ea9 (diff)
downloadegit-bdafe367923e4772e7193d3c9a6767a95b0dd8af.tar.gz
egit-bdafe367923e4772e7193d3c9a6767a95b0dd8af.tar.xz
egit-bdafe367923e4772e7193d3c9a6767a95b0dd8af.zip
Try to recover after deleting opened files on NFS
Fixes various LocalRepositoryTestCase based tests, which were failing if executed on NFS mount, see Bug 440182. The current workaround doesn't really checks for NFS (have no idea how to do this in Java) but allows tests running on "/home" to run "delete" cleanup twice (second "delete" round deletes unexpected nfs zombie files). The assumption is that this workaround should at least help *nix users with their NFS mounted home directories. Ideally the tests should be fixed to properly cleanup opened .pack file handles, but I've spent one day hunting the root cause on one single test without success, due the asynchronous nature of the resources creation/cleanup. Bug: 440182 Change-Id: I5e879daed954aa35de197d8e1ea43c9fbccca7d4 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java10
1 files changed, 10 insertions, 0 deletions
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 bd77fb072f..b930b0b8aa 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
@@ -236,6 +236,16 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
@AfterClass
public static void afterClassBase() throws Exception {
+ File tempDir = testUtils.getBaseTempDir();
+ if (tempDir.toString().startsWith("/home") && tempDir.exists()) {
+ // see bug 440182: if test has left opened file streams on NFS
+ // mounted directories "delete" will fail because the directory
+ // would contain "stolen NFS file handles"
+ // (something like .nfs* files)
+ // so the "first round" of delete can ignore failures.
+ FileUtils.delete(tempDir, FileUtils.IGNORE_ERRORS
+ | FileUtils.RECURSIVE | FileUtils.RETRY);
+ }
testUtils.deleteTempDirs();
}

Back to the top