changeset 54533:9219624244a6

8222410: java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile hangs when "nc" does not accept "-U" Reviewed-by: alanb
author shade
date Mon, 15 Apr 2019 18:22:08 +0200
parents e9c62d960d64
children 66f5241da404
files test/jdk/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java	Tue Apr 09 16:21:20 2019 +0100
+++ b/test/jdk/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java	Mon Apr 15 18:22:08 2019 +0200
@@ -61,6 +61,14 @@
             return;
         }
 
+        // Verify that 'nc' accepts '-U' for Unix domain sockets.
+        // Skip the test if it is not.
+        Process procHelp = Runtime.getRuntime().exec(CMD_BASE + " -h");
+        if (procHelp.waitFor() != 0) {
+            System.err.println("Netcat does not accept required options; skipping test.");
+            return;
+        }
+
         // Create a new sub-directory of the nominal test directory in which
         // 'nc' will create the socket file.
         String testSubDir = System.getProperty("test.dir", ".")