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

commit 2ee5e68383a94c915c75858b92cd457bee514592
Author: Stefan Bodewig <[email protected]>
AuthorDate: Sun Feb 8 08:27:31 2026 +0100

    how many ways to create and check symlinks have we created?
---
 src/etc/testcases/taskdefs/import/import.xml                  |  3 +++
 src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java | 11 ++++-------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/etc/testcases/taskdefs/import/import.xml 
b/src/etc/testcases/taskdefs/import/import.xml
index 2070c6723..cc4f43668 100644
--- a/src/etc/testcases/taskdefs/import/import.xml
+++ b/src/etc/testcases/taskdefs/import/import.xml
@@ -30,5 +30,8 @@
     <echo message="In main"/>
   </target>
 
+  <target name="prepare-symlink-test">
+    <symlink link="${basedir}/symlinks/d3b" 
resource="${basedir}/symlinks/d3a"/>
+  </target>
 
 </project>
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
index b87403301..50bb32f51 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
@@ -31,6 +31,7 @@ import java.io.File;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.condition.CanCreateSymbolicLink;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
@@ -119,15 +120,11 @@ public class ImportTest {
 
     @Test
     public void testSymlinkedImports() throws Exception {
-        String ln = "/usr/bin/ln";
-        if (!new File(ln).exists()) {
-            ln = "/bin/ln";
-        }
-        assumeTrue("Current system does not support Symlinks", new 
File(ln).exists());
+        boolean supportsSymlinks = new CanCreateSymbolicLink().eval();
+        assumeTrue("Current system does not support Symlinks", 
supportsSymlinks);
         
buildRule.configureProject("src/etc/testcases/taskdefs/import/import.xml");
         File symlinkFile = buildRule.getProject().resolveFile("symlinks/d3b");
-        assertEquals("'" + ln + " -s d3a " + symlinkFile.getAbsolutePath() + 
"' failed",
-                Runtime.getRuntime().exec(new String[] {ln, "-s", "d3a", 
symlinkFile.getAbsolutePath()}).waitFor(), 0);
+        buildRule.executeTarget("prepare-symlink-test");
         try {
             
buildRule.configureProject("src/etc/testcases/taskdefs/import/symlinks/d1/p1.xml");
             assertEquals(buildRule.getProject().getProperty("ant.file.p2"),

Reply via email to