This is an automated email from the ASF dual-hosted git repository.
bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push:
new 01bb3e6b6 remove assumption symlinks can only be created on Unix from
tests
01bb3e6b6 is described below
commit 01bb3e6b636f781d713639f8d8e61a6b7238cb0f
Author: Stefan Bodewig <[email protected]>
AuthorDate: Sat Feb 7 15:22:59 2026 +0100
remove assumption symlinks can only be created on Unix from tests
---
src/tests/antunit/taskdefs/copy-test.xml | 3 --
src/tests/antunit/taskdefs/delete-test.xml | 12 +++----
src/tests/antunit/taskdefs/move-test.xml | 3 --
.../taskdefs/optional/unix/symlink-test.xml | 37 ++++++++--------------
.../types/resources/selectors/readwrite-test.xml | 4 ---
.../antunit/types/selectors/readwrite-test.xml | 4 ---
src/tests/antunit/types/selectors/symlink-test.xml | 15 +++------
.../org/apache/tools/ant/taskdefs/CopyTest.java | 4 +--
.../tools/ant/taskdefs/optional/net/FTPTest.java | 5 ++-
.../ant/taskdefs/optional/unix/SymlinkTest.java | 4 +--
10 files changed, 30 insertions(+), 61 deletions(-)
diff --git a/src/tests/antunit/taskdefs/copy-test.xml
b/src/tests/antunit/taskdefs/copy-test.xml
index 14a4bece0..45fd3c4ba 100644
--- a/src/tests/antunit/taskdefs/copy-test.xml
+++ b/src/tests/antunit/taskdefs/copy-test.xml
@@ -304,9 +304,6 @@ public class NullByteStreamResource extends Resource {
<!-- stolen from ../types/readwrite-test.xml - create a read-only file -->
<property name="file" value="testfile"/>
- <condition property="unix">
- <os family="unix"/>
- </condition>
<target name="createTestdir">
<mkdir dir="${output}"/>
<mkdir dir="${input}"/>
diff --git a/src/tests/antunit/taskdefs/delete-test.xml
b/src/tests/antunit/taskdefs/delete-test.xml
index 86ae8cd9d..9229261b6 100644
--- a/src/tests/antunit/taskdefs/delete-test.xml
+++ b/src/tests/antunit/taskdefs/delete-test.xml
@@ -67,13 +67,12 @@
</target>
- <target name="checkOs">
- <condition property="unix">
- <os family="unix" />
- </condition>
+ <target name="checkCanCreateSymlink">
+ <condition property="canCreateSymlink"><canCreateSymlink/></condition>
</target>
- <target name="testDanglingSymlinkInDir" if="unix" depends="checkOs,init">
+ <target name="testDanglingSymlinkInDir" if="canCreateSymlink"
+ depends="checkCanCreateSymlink,init">
<touch file="${output}/foo"/>
<symlink link="${existing.dir}/link"
resource="${output}/foo"/>
@@ -82,7 +81,8 @@
<au:assertFileDoesntExist file="${existing.dir}" />
</target>
- <target name="testDanglingSymlink" if="unix" depends="checkOs,init">
+ <target name="testDanglingSymlink" if="canCreateSymlink"
+ depends="checkCanCreateSymlink,init">
<touch file="${output}/foo"/>
<symlink link="${output}/link"
resource="${output}/foo"/>
diff --git a/src/tests/antunit/taskdefs/move-test.xml
b/src/tests/antunit/taskdefs/move-test.xml
index 01c98073a..e0cecf8ed 100644
--- a/src/tests/antunit/taskdefs/move-test.xml
+++ b/src/tests/antunit/taskdefs/move-test.xml
@@ -126,9 +126,6 @@
<!-- stolen from ../types/readwrite-test.xml - create a read-only file -->
<property name="file" value="testfile"/>
- <condition property="unix">
- <os family="unix"/>
- </condition>
<target name="createTestdir">
<mkdir dir="${output}"/>
<mkdir dir="${input}"/>
diff --git a/src/tests/antunit/taskdefs/optional/unix/symlink-test.xml
b/src/tests/antunit/taskdefs/optional/unix/symlink-test.xml
index de2bdec82..190f9df0c 100644
--- a/src/tests/antunit/taskdefs/optional/unix/symlink-test.xml
+++ b/src/tests/antunit/taskdefs/optional/unix/symlink-test.xml
@@ -20,9 +20,12 @@
<import file="../../../antunit-base.xml"/>
<target name="setUp">
- <condition property="isUnix">
- <os family="unix" />
- </condition>
+ <condition property="canCreateSymlink"><canCreateSymlink/></condition>
+ <mkdir dir="${output}" />
+ <property name="file_ref"
+ location="${output}/file"/>
+ <property name="hanging_ref"
+ location="${output}/hanging_ref"/>
</target>
<target name="tearDown" depends="antunit-base.tearDown"
@@ -31,23 +34,11 @@
<delete dir="${chmod.tmp}"/>
</target>
- <target name="os">
-
- <mkdir dir="${output}" />
- <condition property="unix">
- <os family="unix" />
- </condition>
- <property name="file_ref"
- location="${output}/file"/>
- <property name="hanging_ref"
- location="${output}/hanging_ref"/>
- </target>
-
- <target name="init" depends="os" if="unix">
+ <target name="init" depends="setUp" if="canCreateSymlink">
<touch file="${file_ref}" />
</target>
- <target name="testCreateDouble" depends="init" if="unix">
+ <target name="testCreateDouble" depends="init" if="canCreateSymlink">
<symlink overwrite="true" link="${output}/link"
resource="${file_ref}"/>
<symlink overwrite="true" link="${output}/link"
@@ -55,34 +46,34 @@
</target>
- <target name="testCreateDoubleHanging" depends="init" if="unix">
+ <target name="testCreateDoubleHanging" depends="init" if="canCreateSymlink">
<symlink overwrite="true" link="${output}/link2"
resource="${hanging_ref}"/>
<symlink overwrite="true" link="${output}/link2"
resource="${hanging_ref}"/>
</target>
- <target name="testCreateOverFile" depends="init" if="unix">
+ <target name="testCreateOverFile" depends="init" if="canCreateSymlink">
<touch file="${output}/link3" />
<symlink overwrite="true" link="${output}/link3"
resource="${file_ref}"/>
</target>
- <target name="testDeleteOfBrokenLink" depends="init" if="unix">
+ <target name="testDeleteOfBrokenLink" depends="init" if="canCreateSymlink">
<symlink link="${output}/link" resource="${file_ref}"/>
<delete file="${file_ref}"/>
<symlink link="${output}/link" action="delete"/>
<au:assertFileDoesntExist file="${output}/link"/>
</target>
- <target name="testDeleteLinkToParent" depends="init" if="unix">
+ <target name="testDeleteLinkToParent" depends="init" if="canCreateSymlink">
<symlink link="${output}/link" resource="${output}"/>
<symlink link="${output}/link" action="delete"/>
<au:assertFileDoesntExist file="${output}/link"/>
</target>
<target name="testDeleteWithNoPermissionToRenameTarget"
- depends="init" if="unix">
+ depends="init" if="canCreateSymlink">
<!-- must be outside of ${output} or "base" tearDown will fail -->
<property name="chmod.tmp" location="${output}/../ant-symlink-test"/>
<mkdir dir="${chmod.tmp}/A"/>
@@ -92,7 +83,7 @@
<au:assertFileDoesntExist file="${output}/link"/>
</target>
- <target name="testDeleteLinkInSameDirAsBuildFile" depends="setUp" if="isUnix"
+ <target name="testDeleteLinkInSameDirAsBuildFile" depends="setUp"
if="canCreateSymlink"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49137">
<mkdir dir="${output}/Templates"/>
<mkdir dir="${output}/project1"/>
diff --git a/src/tests/antunit/types/resources/selectors/readwrite-test.xml
b/src/tests/antunit/types/resources/selectors/readwrite-test.xml
index 073adb2aa..2423eebf2 100644
--- a/src/tests/antunit/types/resources/selectors/readwrite-test.xml
+++ b/src/tests/antunit/types/resources/selectors/readwrite-test.xml
@@ -23,10 +23,6 @@
<property name="dir" location="testdir"/>
<property name="file" value="testfile"/>
- <condition property="unix">
- <os family="unix"/>
- </condition>
-
<target name="createTestdir">
<mkdir dir="${output}"/>
<touch file="${output}/${file}"/>
diff --git a/src/tests/antunit/types/selectors/readwrite-test.xml
b/src/tests/antunit/types/selectors/readwrite-test.xml
index fcc07fae2..208e36b93 100644
--- a/src/tests/antunit/types/selectors/readwrite-test.xml
+++ b/src/tests/antunit/types/selectors/readwrite-test.xml
@@ -21,10 +21,6 @@
<property name="file" value="testfile"/>
- <condition property="unix">
- <os family="unix"/>
- </condition>
-
<target name="createTestdir">
<mkdir dir="${output}"/>
<touch file="${output}/${file}"/>
diff --git a/src/tests/antunit/types/selectors/symlink-test.xml
b/src/tests/antunit/types/selectors/symlink-test.xml
index 41fb69a3c..ad751154d 100644
--- a/src/tests/antunit/types/selectors/symlink-test.xml
+++ b/src/tests/antunit/types/selectors/symlink-test.xml
@@ -22,16 +22,14 @@
<property name="file" value="testfile"/>
<property name="link" value="testlink"/>
- <condition property="unix">
- <os family="unix"/>
- </condition>
+ <condition property="canCreateSymlink"><canCreateSymlink/></condition>
<target name="createTestdir">
<mkdir dir="${output}"/>
<touch file="${output}/${file}"/>
</target>
- <target name="testSymlink" depends="makeSymlink" if="unix">
+ <target name="testSymlink" depends="makeSymlink" if="canCreateSymlink">
<au:assertTrue>
<resourcecount when="equal" count="1">
<fileset dir="${output}">
@@ -48,14 +46,9 @@
</au:assertTrue>
</target>
- <target name="makeSymlink"
- depends="createTestdir,makeSymlink-Unix,makeSymlink-Windows"/>
- <target name="makeSymlink-Unix" if="unix">
+ <target name="makeSymlink" depends="createTestdir" if="canCreateSymlink">
<symlink link="${output}/${link}" resource="${output}/${file}"/>
</target>
- <target name="makeSymlink-Windows" unless="unix">
- <!-- no idea how to do this -->
- </target>
<target name="testNoSymlink" depends="createTestdir">
<au:assertTrue>
@@ -75,7 +68,7 @@
</au:assertFalse>
</target>
- <target name="testAsTrueConditions" depends="makeSymlink" if="unix">
+ <target name="testAsTrueConditions" depends="makeSymlink"
if="canCreateSymlink">
<au:assertTrue>
<isfileselected file="${output}/${link}">
<symlink/>
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
b/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
index 64173f4fa..d885e4dd5 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
@@ -21,7 +21,7 @@ package org.apache.tools.ant.taskdefs;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.FileUtilities;
-import org.apache.tools.ant.taskdefs.condition.Os;
+import org.apache.tools.ant.taskdefs.condition.CanCreateSymbolicLink;
import org.apache.tools.ant.util.FileUtils;
import org.junit.Before;
import org.junit.Ignore;
@@ -275,7 +275,7 @@ public class CopyTest {
@Test
public void testCopyToSymlinkedSelf() throws Exception {
// we are only going to test against systems that support symlinks
- assumeTrue("Symlinks not supported on this operating system",
Os.isFamily(Os.FAMILY_UNIX));
+ assumeTrue("Symlinks not supported on current system", new
CanCreateSymbolicLink().eval());
// setup the source files to run copying against
buildRule.executeTarget("setupSelfCopyTesting");
diff --git
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
index d33d48bfe..e19f8f5cc 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
@@ -37,7 +37,7 @@ import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.condition.Os;
+import org.apache.tools.ant.taskdefs.condition.CanCreateSymbolicLink;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.util.RetryHandler;
import org.apache.tools.ant.util.Retryable;
@@ -54,8 +54,7 @@ public class FTPTest {
@Rule
public BuildFileRule buildRule = new BuildFileRule();
- // keep track of what operating systems are supported here.
- private boolean supportsSymlinks = Os.isFamily("unix");
+ private boolean supportsSymlinks = new CanCreateSymbolicLink().eval();
private FTPClient ftp;
diff --git
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
index 8d3b574af..ed0bb6fa8 100644
---
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
+++
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
@@ -30,7 +30,7 @@
package org.apache.tools.ant.taskdefs.optional.unix;
import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.taskdefs.condition.Os;
+import org.apache.tools.ant.taskdefs.condition.CanCreateSymbolicLink;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.util.SymbolicLinkUtils;
@@ -67,7 +67,7 @@ public class SymlinkTest {
@Before
public void setUp() {
- assumeTrue("Symlinks not supported on current operating system",
Os.isFamily("unix"));
+ assumeTrue("Symlinks not supported on current system", new
CanCreateSymbolicLink().eval());
buildRule.configureProject("src/etc/testcases/taskdefs/optional/unix/symlink.xml");
buildRule.executeTarget("setUp");
}