From 8e87ef9e6bb5038070caff96d69b6f6451b6dad5 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 16 May 2016 14:31:30 +0200 Subject: [PATCH] disable a few tests on Windows --- 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(-) diff --git a/src/tests/antunit/types/selectors/ownedby-test.xml b/src/tests/antunit/types/selectors/ownedby-test.xml index 7949c41f1..5ec438190 100644 --- a/src/tests/antunit/types/selectors/ownedby-test.xml +++ b/src/tests/antunit/types/selectors/ownedby-test.xml @@ -21,6 +21,10 @@ + + + + @@ -36,8 +40,8 @@ - - + + @@ -54,7 +58,7 @@ - + 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 a6dddcf5d..389923fb6 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()); 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 6ec486a61..c4dd8fc4f 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 s = EnumSet.of(PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE,