unixdomainchannels: update to unit tests unixdomainchannels
authormichaelm
Wed, 13 Nov 2019 11:37:09 +0000
branchunixdomainchannels
changeset 59054 42bcf3042cd8
parent 59052 15e9a570c6e6
child 59073 832b8a28e17f
unixdomainchannels: update to unit tests
test/jdk/java/nio/channels/unixdomain/Basic.java
--- a/test/jdk/java/nio/channels/unixdomain/Basic.java	Wed Nov 13 11:06:17 2019 +0000
+++ b/test/jdk/java/nio/channels/unixdomain/Basic.java	Wed Nov 13 11:37:09 2019 +0000
@@ -45,6 +45,10 @@
     public static void main(String args[]) throws Exception {
         if (args.length != 3)
             usage();
+	if (!supported()) {
+	    System.out.println("Unix domain channels not supported");
+	    return;
+	}
         sockRxBufsize = getInt(args[0]);
         sockTxBufsize = getInt(args[1]);
         if (args[2].equals("nagle-on"))
@@ -57,11 +61,17 @@
         test(8 * 1024, 10000);
         test(16 * 1024, 10000);
         test(32 * 1024, 10000);
-        // repeat
-        System.out.println("---- Repeating all tests again -----");
-        test(128, 1000);
-        test(16 * 1024, 10000);
-        test(32 * 1024, 10000);
+    }
+
+    static boolean supported() {
+	try {
+	    SocketChannel.open(StandardProtocolFamily.UNIX);
+	} catch (UnsupportedAddressTypeException e) {
+	    return false;
+	} catch (Exception e) {
+	    return true; // continue test to see what problem is
+	}
+	return true;
     }
 
     static int getInt(String s) {