Browse Source

disable a few tests on Windows

master
Stefan Bodewig 9 years ago
parent
commit
8e87ef9e6b
3 changed files with 16 additions and 3 deletions
  1. +7
    -3
      src/tests/antunit/types/selectors/ownedby-test.xml
  2. +4
    -0
      src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
  3. +5
    -0
      src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java

+ 7
- 3
src/tests/antunit/types/selectors/ownedby-test.xml View File

@@ -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}"/>


+ 4
- 0
src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java View File

@@ -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());


+ 5
- 0
src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java View File

@@ -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,


Loading…
Cancel
Save