Bruno Jesus : ws2_32/tests: Show that the last WSACleanup must destroy sockets.
Alexandre Julliard
julliard at winehq.org
Tue Jan 7 13:21:17 CST 2014
Module: wine
Branch: master
Commit: a1e22940069b050e376944c66d4a1030184c67e6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a1e22940069b050e376944c66d4a1030184c67e6
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Mon Jan 6 20:58:56 2014 -0200
ws2_32/tests: Show that the last WSACleanup must destroy sockets.
---
dlls/ws2_32/tests/sock.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 9a90454..86a829e 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1027,6 +1027,8 @@ static void test_WithWSAStartup(void)
WORD version = MAKEWORD( 2, 2 );
INT res;
LPVOID ptr;
+ SOCKET src, dst;
+ DWORD error;
res = WSAStartup( version, &data );
ok(res == 0, "WSAStartup() failed unexpectedly: %d\n", res);
@@ -1034,6 +1036,31 @@ static void test_WithWSAStartup(void)
ptr = gethostbyname("localhost");
ok(ptr != NULL, "gethostbyname() failed unexpectedly: %d\n", WSAGetLastError());
+ ok(!tcp_socketpair(&src, &dst), "creating socket pair failed\n");
+
+ res = send(src, "TEST", 4, 0);
+ ok(res == 4, "send failed with error %d\n", WSAGetLastError());
+
+ WSACleanup();
+
+ res = WSAStartup( version, &data );
+ ok(res == 0, "WSAStartup() failed unexpectedly: %d\n", res);
+
+ /* show that sockets are destroyed automatically after WSACleanup */
+ todo_wine {
+ SetLastError(0xdeadbeef);
+ res = send(src, "TEST", 4, 0);
+ error = WSAGetLastError();
+ ok(res == SOCKET_ERROR, "send should have failed\n");
+ ok(error == WSAENOTSOCK, "expected 10038, got %d\n", error);
+
+ SetLastError(0xdeadbeef);
+ res = closesocket(dst);
+ error = WSAGetLastError();
+ ok(res == SOCKET_ERROR, "closesocket should have failed\n");
+ ok(error == WSAENOTSOCK, "expected 10038, got %d\n", error);
+ }
+
WSACleanup();
}
More information about the wine-cvs
mailing list