8132704: [TESTBUG] jdk/internal/jimage/ExecutableTest.java incorrectly asserts all files to be executable
authorsimonis
Fri, 31 Jul 2015 15:19:15 +0200
changeset 32004 5dba041fc305
parent 32003 acb12269398a
child 32005 2c716d9dac38
8132704: [TESTBUG] jdk/internal/jimage/ExecutableTest.java incorrectly asserts all files to be executable Reviewed-by: rriggs, alanb
jdk/test/jdk/internal/jimage/ExecutableTest.java
--- a/jdk/test/jdk/internal/jimage/ExecutableTest.java	Fri Jul 31 15:07:18 2015 +0300
+++ b/jdk/test/jdk/internal/jimage/ExecutableTest.java	Fri Jul 31 15:19:15 2015 +0200
@@ -27,7 +27,9 @@
 import java.nio.file.Paths;
 import java.nio.file.attribute.PosixFilePermission;
 import static java.nio.file.attribute.PosixFilePermission.*;
+import java.util.Arrays;
 import java.util.EnumSet;
+import java.util.HashSet;
 import java.util.Set;
 
 /*
@@ -41,6 +43,11 @@
 
 public class ExecutableTest {
 
+    // The bin/ directory may contain non-executable files (see 8132704)
+    private static final String[] exclude = { "jmc.ini" };
+    private static final Set<String> excludeSet =
+        new HashSet<String>(Arrays.asList(exclude));
+
     public static void main(String args[]) throws Throwable {
         String JAVA_HOME = System.getProperty("java.home");
         Path binPath = Paths.get(JAVA_HOME, "bin");
@@ -48,6 +55,7 @@
         EnumSet<PosixFilePermission> execPerms =
             EnumSet.of(GROUP_EXECUTE, OTHERS_EXECUTE, OWNER_EXECUTE);
         for (Path entry : stream) {
+            if (excludeSet.contains(entry.getFileName().toString())) continue;
             if (Files.isRegularFile(entry)) {
                 if (!Files.isExecutable(entry)) {
                     throw new Error(entry + " is not executable!");