Disable Unix socket test on Windows.

TEST=included vm-kernel-linux-release-x64-try and vm-fuchsia-release-x64-try.

Change-Id: I0d2902f4bb9d794934a28dc688aaf72dcf5ec425
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217560
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
diff --git a/tests/standalone/io/socket_source_address_test.dart b/tests/standalone/io/socket_source_address_test.dart
index 1e7eb34..e8e5b23 100644
--- a/tests/standalone/io/socket_source_address_test.dart
+++ b/tests/standalone/io/socket_source_address_test.dart
@@ -8,7 +8,7 @@
 
 import 'test_utils.dart' show retry, throws, withTempDir;
 
-Future testArguments(connectFunction, String socketDir) async {
+Future testArguments(connectFunction) async {
   var sourceAddress;
   final serverIPv4 = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
   serverIPv4.listen((_) {
@@ -20,12 +20,6 @@
     throw 'Unexpected connection from address $sourceAddress';
   });
 
-  ServerSocket serverUnix = await ServerSocket.bind(
-      InternetAddress('$socketDir/sock', type: InternetAddressType.unix), 0);
-  serverUnix.listen((_) {
-    throw 'Unexpected connection from address $sourceAddress';
-  });
-
   // Illegal type for sourceAddress.
   for (sourceAddress in ['www.google.com', 'abc']) {
     await throws(
@@ -46,7 +40,7 @@
   for (sourceAddress in [
     '::1',
     InternetAddress.loopbackIPv6,
-    InternetAddress('$socketDir/sock', type: InternetAddressType.unix)
+    InternetAddress('sock', type: InternetAddressType.unix)
   ]) {
     await throws(
         () => connectFunction('127.0.0.1', serverIPv4.port,
@@ -57,13 +51,26 @@
   for (sourceAddress in [
     '127.0.0.1',
     InternetAddress.loopbackIPv4,
-    InternetAddress('$socketDir/sock', type: InternetAddressType.unix)
+    InternetAddress('sock', type: InternetAddressType.unix)
   ]) {
     await throws(
         () => connectFunction('::1', serverIPv6.port,
             sourceAddress: sourceAddress),
         (e) => e is SocketException);
   }
+
+  await serverIPv4.close();
+  await serverIPv6.close();
+}
+
+Future testUnixDomainArguments(connectFunction, String socketDir) async {
+  var sourceAddress;
+  final serverUnix = await ServerSocket.bind(
+      InternetAddress('$socketDir/sock', type: InternetAddressType.unix), 0);
+  serverUnix.listen((_) {
+    throw 'Unexpected connection from address $sourceAddress';
+  });
+
   // Address family mismatch for Unix domain sockets.
   for (sourceAddress in [
     '127.0.0.1',
@@ -80,8 +87,6 @@
             e is SocketException &&
             e.toString().contains('Address family not supported'));
   }
-  await serverIPv4.close();
-  await serverIPv6.close();
   await serverUnix.close();
 }
 
@@ -156,16 +161,24 @@
 
 main() async {
   await retry(() async {
-    await withTempDir('unix_socket_test', (Directory dir) async {
-      await testArguments(RawSocket.connect, "${dir.path}");
-    });
+    await testArguments(RawSocket.connect);
   });
   await retry(() async {
-    await withTempDir('unix_socket_test', (Directory dir) async {
-      await testArguments(Socket.connect, "${dir.path}");
-    });
+    await testArguments(Socket.connect);
   });
 
+  if (Platform.isMacOS || Platform.isLinux || Platform.isAndroid) {
+    await retry(() async {
+      await withTempDir('unix_socket_test', (Directory dir) async {
+        await testUnixDomainArguments(RawSocket.connect, "${dir.path}");
+      });
+    });
+    await retry(() async {
+      await withTempDir('unix_socket_test', (Directory dir) async {
+        await testUnixDomainArguments(Socket.connect, "${dir.path}");
+      });
+    });
+  }
   await retry(() async {
     await testConnect(
         InternetAddress.anyIPv4, false, RawSocket.connect, (s) => s.close());
diff --git a/tests/standalone_2/io/socket_source_address_test.dart b/tests/standalone_2/io/socket_source_address_test.dart
index 7e77209..f118367 100644
--- a/tests/standalone_2/io/socket_source_address_test.dart
+++ b/tests/standalone_2/io/socket_source_address_test.dart
@@ -10,7 +10,7 @@
 
 import 'test_utils.dart' show retry, throws, withTempDir;
 
-Future testArguments(connectFunction, String socketDir) async {
+Future testArguments(connectFunction) async {
   var sourceAddress;
   final serverIPv4 = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
   serverIPv4.listen((_) {
@@ -22,12 +22,6 @@
     throw 'Unexpected connection from address $sourceAddress';
   });
 
-  ServerSocket serverUnix = await ServerSocket.bind(
-      InternetAddress('$socketDir/sock', type: InternetAddressType.unix), 0);
-  serverUnix.listen((_) {
-    throw 'Unexpected connection from address $sourceAddress';
-  });
-
   // Illegal type for sourceAddress.
   for (sourceAddress in ['www.google.com', 'abc']) {
     await throws(
@@ -48,7 +42,7 @@
   for (sourceAddress in [
     '::1',
     InternetAddress.loopbackIPv6,
-    InternetAddress('$socketDir/sock', type: InternetAddressType.unix)
+    InternetAddress('sock', type: InternetAddressType.unix)
   ]) {
     await throws(
         () => connectFunction('127.0.0.1', serverIPv4.port,
@@ -59,13 +53,26 @@
   for (sourceAddress in [
     '127.0.0.1',
     InternetAddress.loopbackIPv4,
-    InternetAddress('$socketDir/sock', type: InternetAddressType.unix)
+    InternetAddress('sock', type: InternetAddressType.unix)
   ]) {
     await throws(
         () => connectFunction('::1', serverIPv6.port,
             sourceAddress: sourceAddress),
         (e) => e is SocketException);
   }
+
+  await serverIPv4.close();
+  await serverIPv6.close();
+}
+
+Future testUnixDomainArguments(connectFunction, String socketDir) async {
+  var sourceAddress;
+  final serverUnix = await ServerSocket.bind(
+      InternetAddress('$socketDir/sock', type: InternetAddressType.unix), 0);
+  serverUnix.listen((_) {
+    throw 'Unexpected connection from address $sourceAddress';
+  });
+
   // Address family mismatch for Unix domain sockets.
   for (sourceAddress in [
     '127.0.0.1',
@@ -82,8 +89,6 @@
             e is SocketException &&
             e.toString().contains('Address family not supported'));
   }
-  await serverIPv4.close();
-  await serverIPv6.close();
   await serverUnix.close();
 }
 
@@ -158,16 +163,24 @@
 
 main() async {
   await retry(() async {
-    await withTempDir('unix_socket_test', (Directory dir) async {
-      await testArguments(RawSocket.connect, "${dir.path}");
-    });
+    await testArguments(RawSocket.connect);
   });
   await retry(() async {
-    await withTempDir('unix_socket_test', (Directory dir) async {
-      await testArguments(Socket.connect, "${dir.path}");
-    });
+    await testArguments(Socket.connect);
   });
 
+  if (Platform.isMacOS || Platform.isLinux || Platform.isAndroid) {
+    await retry(() async {
+      await withTempDir('unix_socket_test', (Directory dir) async {
+        await testUnixDomainArguments(RawSocket.connect, "${dir.path}");
+      });
+    });
+    await retry(() async {
+      await withTempDir('unix_socket_test', (Directory dir) async {
+        await testUnixDomainArguments(Socket.connect, "${dir.path}");
+      });
+    });
+  }
   await retry(() async {
     await testConnect(
         InternetAddress.anyIPv4, false, RawSocket.connect, (s) => s.close());