a test that hopefully catch the file descriptor leak in the copyTo method if it happens again.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15499 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-02-20 19:54:57 +00:00
1 parent fe73a26c59
commit 9f71682941
1 file changed
+17
@@ -82,4 +82,21 @@ public class FilePathTest extends TestCase {
tmp.delete();
}
/**
* An attempt to reproduce the file descriptor leak.
* If this operation leaks a file descriptor, 2500 should be enough, I think.
*/
public void testCopyTo2() throws Exception {
for (int j=0; j<2500; j++) {
File tmp = File.createTempFile("testCopyTo","");
FilePath f = new FilePath(tmp);
File tmp2 = File.createTempFile("testCopyTo","");
FilePath f2 = new FilePath(british,tmp.getPath());
f.copyTo(f2);
tmp.delete();
tmp2.delete();
}
}
}