Skip to content

Commit d0e5602

Browse files
brianquinlancommit-bot@chromium.org
authored andcommitted
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 <[email protected]> Commit-Queue: Brian Quinlan <[email protected]>
1 parent d906c6d commit d0e5602

File tree

2 files changed

+60
-34
lines changed

2 files changed

+60
-34
lines changed

tests/standalone/io/socket_source_address_test.dart

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "dart:io";
88

99
import 'test_utils.dart' show retry, throws, withTempDir;
1010

11-
Future testArguments(connectFunction, String socketDir) async {
11+
Future testArguments(connectFunction) async {
1212
var sourceAddress;
1313
final serverIPv4 = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
1414
serverIPv4.listen((_) {
@@ -20,12 +20,6 @@ Future testArguments(connectFunction, String socketDir) async {
2020
throw 'Unexpected connection from address $sourceAddress';
2121
});
2222

23-
ServerSocket serverUnix = await ServerSocket.bind(
24-
InternetAddress('$socketDir/sock', type: InternetAddressType.unix), 0);
25-
serverUnix.listen((_) {
26-
throw 'Unexpected connection from address $sourceAddress';
27-
});
28-
2923
// Illegal type for sourceAddress.
3024
for (sourceAddress in ['www.google.com', 'abc']) {
3125
await throws(
@@ -46,7 +40,7 @@ Future testArguments(connectFunction, String socketDir) async {
4640
for (sourceAddress in [
4741
'::1',
4842
InternetAddress.loopbackIPv6,
49-
InternetAddress('$socketDir/sock', type: InternetAddressType.unix)
43+
InternetAddress('sock', type: InternetAddressType.unix)
5044
]) {
5145
await throws(
5246
() => connectFunction('127.0.0.1', serverIPv4.port,
@@ -57,13 +51,26 @@ Future testArguments(connectFunction, String socketDir) async {
5751
for (sourceAddress in [
5852
'127.0.0.1',
5953
InternetAddress.loopbackIPv4,
60-
InternetAddress('$socketDir/sock', type: InternetAddressType.unix)
54+
InternetAddress('sock', type: InternetAddressType.unix)
6155
]) {
6256
await throws(
6357
() => connectFunction('::1', serverIPv6.port,
6458
sourceAddress: sourceAddress),
6559
(e) => e is SocketException);
6660
}
61+
62+
await serverIPv4.close();
63+
await serverIPv6.close();
64+
}
65+
66+
Future testUnixDomainArguments(connectFunction, String socketDir) async {
67+
var sourceAddress;
68+
final serverUnix = await ServerSocket.bind(
69+
InternetAddress('$socketDir/sock', type: InternetAddressType.unix), 0);
70+
serverUnix.listen((_) {
71+
throw 'Unexpected connection from address $sourceAddress';
72+
});
73+
6774
// Address family mismatch for Unix domain sockets.
6875
for (sourceAddress in [
6976
'127.0.0.1',
@@ -80,8 +87,6 @@ Future testArguments(connectFunction, String socketDir) async {
8087
e is SocketException &&
8188
e.toString().contains('Address family not supported'));
8289
}
83-
await serverIPv4.close();
84-
await serverIPv6.close();
8590
await serverUnix.close();
8691
}
8792

@@ -156,16 +161,24 @@ Future testConnect(InternetAddress bindAddress, bool v6Only,
156161

157162
main() async {
158163
await retry(() async {
159-
await withTempDir('unix_socket_test', (Directory dir) async {
160-
await testArguments(RawSocket.connect, "${dir.path}");
161-
});
164+
await testArguments(RawSocket.connect);
162165
});
163166
await retry(() async {
164-
await withTempDir('unix_socket_test', (Directory dir) async {
165-
await testArguments(Socket.connect, "${dir.path}");
166-
});
167+
await testArguments(Socket.connect);
167168
});
168169

170+
if (Platform.isMacOS || Platform.isLinux || Platform.isAndroid) {
171+
await retry(() async {
172+
await withTempDir('unix_socket_test', (Directory dir) async {
173+
await testUnixDomainArguments(RawSocket.connect, "${dir.path}");
174+
});
175+
});
176+
await retry(() async {
177+
await withTempDir('unix_socket_test', (Directory dir) async {
178+
await testUnixDomainArguments(Socket.connect, "${dir.path}");
179+
});
180+
});
181+
}
169182
await retry(() async {
170183
await testConnect(
171184
InternetAddress.anyIPv4, false, RawSocket.connect, (s) => s.close());

tests/standalone_2/io/socket_source_address_test.dart

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import "dart:io";
1010

1111
import 'test_utils.dart' show retry, throws, withTempDir;
1212

13-
Future testArguments(connectFunction, String socketDir) async {
13+
Future testArguments(connectFunction) async {
1414
var sourceAddress;
1515
final serverIPv4 = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
1616
serverIPv4.listen((_) {
@@ -22,12 +22,6 @@ Future testArguments(connectFunction, String socketDir) async {
2222
throw 'Unexpected connection from address $sourceAddress';
2323
});
2424

25-
ServerSocket serverUnix = await ServerSocket.bind(
26-
InternetAddress('$socketDir/sock', type: InternetAddressType.unix), 0);
27-
serverUnix.listen((_) {
28-
throw 'Unexpected connection from address $sourceAddress';
29-
});
30-
3125
// Illegal type for sourceAddress.
3226
for (sourceAddress in ['www.google.com', 'abc']) {
3327
await throws(
@@ -48,7 +42,7 @@ Future testArguments(connectFunction, String socketDir) async {
4842
for (sourceAddress in [
4943
'::1',
5044
InternetAddress.loopbackIPv6,
51-
InternetAddress('$socketDir/sock', type: InternetAddressType.unix)
45+
InternetAddress('sock', type: InternetAddressType.unix)
5246
]) {
5347
await throws(
5448
() => connectFunction('127.0.0.1', serverIPv4.port,
@@ -59,13 +53,26 @@ Future testArguments(connectFunction, String socketDir) async {
5953
for (sourceAddress in [
6054
'127.0.0.1',
6155
InternetAddress.loopbackIPv4,
62-
InternetAddress('$socketDir/sock', type: InternetAddressType.unix)
56+
InternetAddress('sock', type: InternetAddressType.unix)
6357
]) {
6458
await throws(
6559
() => connectFunction('::1', serverIPv6.port,
6660
sourceAddress: sourceAddress),
6761
(e) => e is SocketException);
6862
}
63+
64+
await serverIPv4.close();
65+
await serverIPv6.close();
66+
}
67+
68+
Future testUnixDomainArguments(connectFunction, String socketDir) async {
69+
var sourceAddress;
70+
final serverUnix = await ServerSocket.bind(
71+
InternetAddress('$socketDir/sock', type: InternetAddressType.unix), 0);
72+
serverUnix.listen((_) {
73+
throw 'Unexpected connection from address $sourceAddress';
74+
});
75+
6976
// Address family mismatch for Unix domain sockets.
7077
for (sourceAddress in [
7178
'127.0.0.1',
@@ -82,8 +89,6 @@ Future testArguments(connectFunction, String socketDir) async {
8289
e is SocketException &&
8390
e.toString().contains('Address family not supported'));
8491
}
85-
await serverIPv4.close();
86-
await serverIPv6.close();
8792
await serverUnix.close();
8893
}
8994

@@ -158,16 +163,24 @@ Future testConnect(InternetAddress bindAddress, bool v6Only,
158163

159164
main() async {
160165
await retry(() async {
161-
await withTempDir('unix_socket_test', (Directory dir) async {
162-
await testArguments(RawSocket.connect, "${dir.path}");
163-
});
166+
await testArguments(RawSocket.connect);
164167
});
165168
await retry(() async {
166-
await withTempDir('unix_socket_test', (Directory dir) async {
167-
await testArguments(Socket.connect, "${dir.path}");
168-
});
169+
await testArguments(Socket.connect);
169170
});
170171

172+
if (Platform.isMacOS || Platform.isLinux || Platform.isAndroid) {
173+
await retry(() async {
174+
await withTempDir('unix_socket_test', (Directory dir) async {
175+
await testUnixDomainArguments(RawSocket.connect, "${dir.path}");
176+
});
177+
});
178+
await retry(() async {
179+
await withTempDir('unix_socket_test', (Directory dir) async {
180+
await testUnixDomainArguments(Socket.connect, "${dir.path}");
181+
});
182+
});
183+
}
171184
await retry(() async {
172185
await testConnect(
173186
InternetAddress.anyIPv4, false, RawSocket.connect, (s) => s.close());

0 commit comments

Comments
 (0)