Skip to content
Permalink
Browse files
[JENKINS-16089] needs a separator here
And since it's now a symlink that points to another symlink that then
points to the real stuff, we need recursive onion peeling.
  • Loading branch information
kohsuke committed Mar 14, 2013
1 parent b82d944 commit 4d0def46ccf9e97074b3f4b4e66ebfe9ead9b74b
@@ -483,7 +483,7 @@ private void createSymlink(TaskListener listener, String name, Permalink target)
if (getProject().getBuildDir().equals(new File(getProject().getRootDir(), "builds"))) {
targetDir = "builds/" + target.getId();
} else {
targetDir = getProject().getBuildDir()+target.getId();
targetDir = getProject().getBuildDir()+"/"+target.getId();
}
Util.createSymlink(getProject().getRootDir(), targetDir, name, listener);
}
@@ -343,17 +343,25 @@ public void testExternalBuildDirectorySymlinks() throws Exception {
FreeStyleBuild b1 = p.scheduleBuild2(0).get();
File link = new File(p.getRootDir(), "lastStable");
assertTrue(link.exists());
assertEquals(b1.getRootDir().getAbsolutePath(), Util.resolveSymlink(link));
assertEquals(b1.getRootDir().getAbsolutePath(), resolveAll(link).getAbsolutePath());
FreeStyleBuild b2 = p.scheduleBuild2(0).get();
assertTrue(link.exists());
assertEquals(b2.getRootDir().getAbsolutePath(), Util.resolveSymlink(link));
assertEquals(b2.getRootDir().getAbsolutePath(), resolveAll(link).getAbsolutePath());
b2.delete();
assertTrue(link.exists());
assertEquals(b1.getRootDir().getAbsolutePath(), Util.resolveSymlink(link));
assertEquals(b1.getRootDir().getAbsolutePath(), resolveAll(link).getAbsolutePath());
b1.delete();
assertFalse(link.exists());
}

private File resolveAll(File link) throws InterruptedException, IOException {
while (true) {
File f = Util.resolveSymlinkToFile(link);
if (f==null) return link;
link = f;
}
}

@Bug(17138)
public void testExternalBuildDirectoryRenameDelete() throws Exception {
HtmlForm form = new WebClient().goTo("configure").getFormByName("config");

0 comments on commit 4d0def4

Please sign in to comment.