Zebediah Figura : ws2_32/tests: Fix yet another test failure with Vista or older.

Alexandre Julliard julliard at winehq.org
Tue Jun 1 16:04:32 CDT 2021


Module: wine
Branch: master
Commit: faf66ae94453dc98f8d2c8636570ed66c83f57ee
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=faf66ae94453dc98f8d2c8636570ed66c83f57ee

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon May 31 22:16:32 2021 -0500

ws2_32/tests: Fix yet another test failure with Vista or older.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/tests/sock.c | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index cf3878eba40..e76d9ac27a6 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -200,6 +200,23 @@ static void tcp_socketpair(SOCKET *src, SOCKET *dst)
     tcp_socketpair_flags(src, dst, WSA_FLAG_OVERLAPPED);
 }
 
+#define check_poll(a, b) check_poll_(__LINE__, a, POLLRDNORM | POLLRDBAND | POLLWRNORM, b, FALSE)
+#define check_poll_todo(a, b) check_poll_(__LINE__, a, POLLRDNORM | POLLRDBAND | POLLWRNORM, b, TRUE)
+#define check_poll_mask(a, b, c) check_poll_(__LINE__, a, b, c, FALSE)
+#define check_poll_mask_todo(a, b, c) check_poll_(__LINE__, a, b, c, TRUE)
+static void check_poll_(int line, SOCKET s, short mask, short expect, BOOL todo)
+{
+    WSAPOLLFD pollfd;
+    int ret;
+
+    pollfd.fd = s;
+    pollfd.events = mask;
+    pollfd.revents = 0xdead;
+    ret = pWSAPoll(&pollfd, 1, 1000);
+    ok_(__FILE__, line)(ret == (pollfd.revents ? 1 : 0), "WSAPoll() returned %d\n", ret);
+    todo_wine_if (todo) ok_(__FILE__, line)(pollfd.revents == expect, "got wrong events %#x\n", pollfd.revents);
+}
+
 static void set_so_opentype ( BOOL overlapped )
 {
     int optval = !overlapped, newval, len = sizeof (int);
@@ -3763,11 +3780,17 @@ static void test_fionread_siocatmark(void)
     ret = send(server, "data", 5, 0);
     ok(ret == 5, "got %d\n", ret);
 
+    /* wait for the data to be available */
+    check_poll_mask(client, POLLRDNORM, POLLRDNORM);
+
     check_fionread_siocatmark(client, 5, TRUE);
 
     ret = send(server, "a", 1, MSG_OOB);
     ok(ret == 1, "got %d\n", ret);
 
+    /* wait for the data to be available */
+    check_poll_mask(client, POLLRDBAND, POLLRDBAND);
+
     check_fionread_siocatmark_todo_oob(client, 5, FALSE);
 
     ret = send(server, "a", 1, MSG_OOB);
@@ -5871,23 +5894,6 @@ static void test_write_watch(void)
     VirtualFree( base, 0, MEM_FREE );
 }
 
-#define check_poll(a, b) check_poll_(__LINE__, a, POLLRDNORM | POLLRDBAND | POLLWRNORM, b, FALSE)
-#define check_poll_todo(a, b) check_poll_(__LINE__, a, POLLRDNORM | POLLRDBAND | POLLWRNORM, b, TRUE)
-#define check_poll_mask(a, b, c) check_poll_(__LINE__, a, b, c, FALSE)
-#define check_poll_mask_todo(a, b, c) check_poll_(__LINE__, a, b, c, TRUE)
-static void check_poll_(int line, SOCKET s, short mask, short expect, BOOL todo)
-{
-    WSAPOLLFD pollfd;
-    int ret;
-
-    pollfd.fd = s;
-    pollfd.events = mask;
-    pollfd.revents = 0xdead;
-    ret = pWSAPoll(&pollfd, 1, 1000);
-    ok_(__FILE__, line)(ret == (pollfd.revents ? 1 : 0), "WSAPoll() returned %d\n", ret);
-    todo_wine_if (todo) ok_(__FILE__, line)(pollfd.revents == expect, "got wrong events %#x\n", pollfd.revents);
-}
-
 static void test_WSAPoll(void)
 {
     const struct sockaddr_in bind_addr = {.sin_family = AF_INET, .sin_addr.s_addr = htonl(INADDR_LOOPBACK)};




More information about the wine-cvs mailing list