[PATCH v5 04/10] ws2_32/tests: Continue sending remaining data on short write in test_write_events.

Jinoh Kang jinoh.kang.kr at gmail.com
Fri Mar 11 14:22:13 CST 2022


Today, we assert that a short write clears the FD_WRITE event bit;
however, short writes can never happen on Windows in the first place.
We're testing for a property of a socket behaviour that does not exist
on Windows, but currently happens to be exhibited by Wine.

Ignore short writes, and continue sending until it fails with
EWOULDBLOCK.  This way, the test won't care whether or not a short write
clears FD_WRITE.  This allows us some flexibility in implementation of
send().

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---

Notes:
    v4 -> v5: new patch

 dlls/ws2_32/tests/sock.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 66bd5452046..b7d7ffc9646 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -5660,14 +5660,11 @@ static void test_write_events(struct event_test_ctx *ctx)
 
     if (!broken(1))
     {
-        while ((ret = send(server, buffer, buffer_size, 0)) == buffer_size);
         /* Windows will never send less than buffer_size bytes here, but Linux
          * may do a short write. */
-        todo_wine_if (ret > 0)
-        {
-            ok(ret == -1, "got %d\n", ret);
-            ok(WSAGetLastError() == WSAEWOULDBLOCK, "got error %u\n", WSAGetLastError());
-        }
+        while ((ret = send(server, buffer, buffer_size, 0)) > 0);
+        ok(ret == -1, "got %d\n", ret);
+        ok(WSAGetLastError() == WSAEWOULDBLOCK, "got error %u\n", WSAGetLastError());
 
         while (recv(client, buffer, buffer_size, 0) > 0);
         ok(WSAGetLastError() == WSAEWOULDBLOCK, "got error %u\n", WSAGetLastError());
-- 
2.34.1




More information about the wine-devel mailing list