JENKINS-15418 take shares int account, ignore short paths

This commit is contained in:
Erik Lindblad authored and Erik Lindblad committed 2012-10-25 17:18:07 +02:00
1 parent edbe2aedca
commit f66e19c072
2 files changed
+44 -2

No files matched your search

+28 -1
View File
@@ -474,5 +474,32 @@ public class FilePathTest extends ChannelTestCase {
Util.deleteRecursive(tmp);
}
}
@Bug(15418)
public void testDeleteLongPathOnWindows() throws Exception {
File tmp = Util.createTempDir();
try {
FilePath d = new FilePath(french, tmp.getPath());
// construct a very long path
StringBuilder sb = new StringBuilder();
while(sb.length() + tmp.getPath().length() < 260 - "very/".length()) {
sb.append("very/");
}
sb.append("pivot/very/very/long/path");
FilePath longPath = d.child(sb.toString());
longPath.mkdirs();
FilePath childInLongPath = longPath.child("file.txt");
childInLongPath.touch(0);
File firstDirectory = new File(tmp.getAbsolutePath() + "/very");
Util.deleteRecursive(firstDirectory);
assertFalse("Could not delete directory!", firstDirectory.exists());
} finally {
Util.deleteRecursive(tmp);
}
}
}