ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [2/2] ant git commit: disable a few tests on Windows
Date Mon, 16 May 2016 12:31:57 GMT
disable a few tests on Windows


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/8e87ef9e
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/8e87ef9e
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/8e87ef9e

Branch: refs/heads/master
Commit: 8e87ef9e6bb5038070caff96d69b6f6451b6dad5
Parents: 2d21d26
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Mon May 16 14:31:30 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Mon May 16 14:31:30 2016 +0200

----------------------------------------------------------------------
 src/tests/antunit/types/selectors/ownedby-test.xml        | 10 +++++++---
 .../tools/ant/types/selectors/OwnedBySelectorTest.java    |  4 ++++
 .../org/apache/tools/ant/util/PermissionUtilsTest.java    |  5 +++++
 3 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/8e87ef9e/src/tests/antunit/types/selectors/ownedby-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/types/selectors/ownedby-test.xml b/src/tests/antunit/types/selectors/ownedby-test.xml
index 7949c41..5ec4381 100644
--- a/src/tests/antunit/types/selectors/ownedby-test.xml
+++ b/src/tests/antunit/types/selectors/ownedby-test.xml
@@ -21,6 +21,10 @@
 
   <property name="file" value="testfile"/>
 
+  <condition property="unix">
+    <os family="unix"/>
+  </condition>
+
   <target name="createTestdir">
     <mkdir dir="${output}"/>
     <touch file="${output}/${file}"/>
@@ -36,8 +40,8 @@
     </au:expectfailure>
   </target>
 
-  <!-- not sure whether this works on Windows, Jenkins will tell us -->
-  <target name="testOwnedBy" depends="createTestdir">
+  <!-- at least on Jenkins the file is owned by BUILTIN\Administrators -->
+  <target name="testOwnedBy" depends="createTestdir" if="unix">
     <au:assertTrue>
       <resourcecount when="equal" count="1">
         <fileset dir="${output}">
@@ -54,7 +58,7 @@
     </au:assertTrue>
   </target>
 
-  <target name="testAsTrueConditions" depends="createTestdir">
+  <target name="testAsTrueConditions" depends="createTestdir" if="unix">
     <au:assertTrue>
       <isfileselected file="${output}/${file}">
         <ownedBy owner="${user.name}"/>

http://git-wip-us.apache.org/repos/asf/ant/blob/8e87ef9e/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
b/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
index a6dddcf..389923f 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
@@ -25,6 +25,8 @@ import java.io.File;
 import java.nio.file.Files;
 import java.nio.file.attribute.UserPrincipal;
 
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.junit.Assume;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
@@ -36,6 +38,8 @@ public class OwnedBySelectorTest {
 
     @Test
     public void ownedByIsTrueForSelf() throws Exception {
+        // at least on Jenkins the file is owned by "BUILTIN\Administrators"
+        Assume.assumeFalse(Os.isFamily("windows"));
         String self = System.getProperty("user.name");
         File file = folder.newFile("f.txt");
         UserPrincipal user = Files.getOwner(file.toPath());

http://git-wip-us.apache.org/repos/asf/ant/blob/8e87ef9e/src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java
index 6ec486a..c4dd8fc 100644
--- a/src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java
@@ -23,6 +23,8 @@ import static org.junit.Assert.assertEquals;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.attribute.PosixFileAttributeView;
 import java.nio.file.attribute.PosixFilePermission;
 import java.util.EnumSet;
 import java.util.Set;
@@ -34,6 +36,7 @@ import org.apache.tools.tar.TarEntry;
 import org.apache.tools.tar.TarOutputStream;
 import org.apache.tools.zip.ZipEntry;
 import org.apache.tools.zip.ZipOutputStream;
+import org.junit.Assume;
 import org.junit.Test;
 
 public class PermissionUtilsTest {
@@ -100,6 +103,8 @@ public class PermissionUtilsTest {
     public void getSetPermissionsWorksForFiles() throws IOException {
         File f = File.createTempFile("ant", ".tst");
         f.deleteOnExit();
+        Assume.assumeNotNull(Files.getFileAttributeView(f.toPath(),
+                                                        PosixFileAttributeView.class));
         Set<PosixFilePermission> s =
             EnumSet.of(PosixFilePermission.OWNER_READ,
                        PosixFilePermission.OWNER_WRITE,


Mime
View raw message