mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
ws2_32/tests: Show that the last WSACleanup must destroy sockets.
This commit is contained in:
parent
7e4d075ec1
commit
a1e2294006
1 changed files with 27 additions and 0 deletions
|
@ -1027,6 +1027,8 @@ static void test_WithWSAStartup(void)
|
||||||
WORD version = MAKEWORD( 2, 2 );
|
WORD version = MAKEWORD( 2, 2 );
|
||||||
INT res;
|
INT res;
|
||||||
LPVOID ptr;
|
LPVOID ptr;
|
||||||
|
SOCKET src, dst;
|
||||||
|
DWORD error;
|
||||||
|
|
||||||
res = WSAStartup( version, &data );
|
res = WSAStartup( version, &data );
|
||||||
ok(res == 0, "WSAStartup() failed unexpectedly: %d\n", res);
|
ok(res == 0, "WSAStartup() failed unexpectedly: %d\n", res);
|
||||||
|
@ -1034,6 +1036,31 @@ static void test_WithWSAStartup(void)
|
||||||
ptr = gethostbyname("localhost");
|
ptr = gethostbyname("localhost");
|
||||||
ok(ptr != NULL, "gethostbyname() failed unexpectedly: %d\n", WSAGetLastError());
|
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();
|
WSACleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue