mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 04:11:01 +00:00
ws2_32/tests: Make sure that WSARecv() completes synchronously in test_WSARecv().
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=54342
This commit is contained in:
parent
d9ad68a1ef
commit
9d330d81a6
|
@ -7626,24 +7626,29 @@ static void test_WSARecv(void)
|
|||
|
||||
memset(&ov, 0, sizeof(ov));
|
||||
flags = 0;
|
||||
bufs[0].len = 2;
|
||||
bufs[0].len = 1;
|
||||
bufs[0].buf = buf;
|
||||
|
||||
/* Send 4 bytes and receive in two calls of 2 */
|
||||
/* Send 2 bytes and receive in two calls of 1 */
|
||||
SetLastError(0xdeadbeef);
|
||||
iret = send(src, "test", 4, 0);
|
||||
ok(iret == 4, "Expected 4, got %d\n", iret);
|
||||
iret = send(src, "ab", 2, 0);
|
||||
ok(iret == 2, "got %d\n", iret);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %ld\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
bytesReturned = 0xdeadbeef;
|
||||
|
||||
/* Non-overlapped WSARecv() performs an alertable wait (tested below), but
|
||||
* not if it completes synchronously. Make sure it completes synchronously
|
||||
* by polling for input. */
|
||||
check_poll_mask(dest, POLLRDNORM, POLLRDNORM);
|
||||
|
||||
apc_count = 0;
|
||||
dwret = QueueUserAPC(apc_func, GetCurrentThread(), (ULONG_PTR)&apc_count);
|
||||
ok(dwret, "QueueUserAPC returned %lu\n", dwret);
|
||||
|
||||
iret = WSARecv(dest, bufs, 1, &bytesReturned, &flags, NULL, NULL);
|
||||
ok(!iret, "Expected 0, got %d\n", iret);
|
||||
ok(bytesReturned == 2, "Expected 2, got %ld\n", bytesReturned);
|
||||
ok(bytesReturned == 1, "got %ld\n", bytesReturned);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %ld\n", GetLastError());
|
||||
|
||||
ok(!apc_count, "got apc_count %u.\n", apc_count);
|
||||
|
@ -7654,7 +7659,7 @@ static void test_WSARecv(void)
|
|||
bytesReturned = 0xdeadbeef;
|
||||
iret = WSARecv(dest, bufs, 1, &bytesReturned, &flags, NULL, NULL);
|
||||
ok(!iret, "Expected 0, got %d\n", iret);
|
||||
ok(bytesReturned == 2, "Expected 2, got %ld\n", bytesReturned);
|
||||
ok(bytesReturned == 1, "got %ld\n", bytesReturned);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %ld\n", GetLastError());
|
||||
|
||||
bufs[0].len = 4;
|
||||
|
|
Loading…
Reference in a new issue