--- old/test/jdk/internal/jimage/ExecutableTest.java 2015-07-30 17:24:24.215171849 +0200 +++ new/test/jdk/internal/jimage/ExecutableTest.java 2015-07-30 17:24:24.051173084 +0200 @@ -30,32 +30,47 @@ import java.util.EnumSet; import java.util.Set; +import jdk.testlibrary.Platform; + /* * @test * @bug 8132475 * @summary Check that the executables in the current JDK image * are executable by all users. + * @library /lib/testlibrary * @run main ExecutableTest * @author Volker Simonis */ public class ExecutableTest { + // We use a fixed list of binaries because not all the files in the + // bin/ directory are necessarily exectuables (see 8132704) + private static final String[] executables = { + "appletviewer", "idlj", "jar", "jarsigner", "java", "java-rmi.cgi", "javac", + "javadoc", "javah", "javap", "jcmd", "jconsole", "jdb", "jdeps", "jimage", + "jinfo", "jjs", "jmap", "jps", "jrunscript", "jsadebugd", "jstack", "jstat", + "jstatd", "keytool", "orbd", "pack200", "policytool", "rmic", "rmid", + "rmiregistry", "schemagen", "serialver", "servertool", "tnameserv", + "unpack200", "wsgen", "wsimport", "xjc" }; + public static void main(String args[]) throws Throwable { String JAVA_HOME = System.getProperty("java.home"); - Path binPath = Paths.get(JAVA_HOME, "bin"); - DirectoryStream stream = Files.newDirectoryStream(binPath); + String exeSuffix = Platform.isWindows() ? ".exe" : ""; + EnumSet execPerms = EnumSet.of(GROUP_EXECUTE, OTHERS_EXECUTE, OWNER_EXECUTE); - for (Path entry : stream) { - if (Files.isRegularFile(entry)) { - if (!Files.isExecutable(entry)) { - throw new Error(entry + " is not executable!"); + + for (String exe : executables) { + Path path = Paths.get(JAVA_HOME, "bin", exe + exeSuffix); + if (Files.isRegularFile(path)) { + if (!Files.isExecutable(path)) { + throw new Error(path + " is not executable!"); } try { - Set perm = Files.getPosixFilePermissions(entry); + Set perm = Files.getPosixFilePermissions(path); if (!perm.containsAll(execPerms)) { - throw new Error(entry + " has not all executable permissions!\n" + + throw new Error(path + " has not all executable permissions!\n" + "Should have: " + execPerms + "\nbut has: " + perm); } } catch (UnsupportedOperationException e) {}