ws2_32/tests: add some SIOCATMARK tests

André Hentschel nerv at dawncrow.de
Mon Nov 2 14:00:21 CST 2009


...and update a comment, inform me if you want two patches for that.

i am planning to better implement SIOCATMARK as putty's telnet rely on it (Bug 11621)
---
 dlls/ws2_32/tests/sock.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 518ab4a..cf6b4f3 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -987,7 +987,7 @@ static void test_set_getsockopt(void)
     ok( !err, "get/setsockopt(SO_RCVTIMEO) failed error: %d\n", WSAGetLastError());
     ok( timeout == SOCKTIMEOUT1, "getsockopt(SO_RCVTIMEO) returned wrong value %d\n", timeout);
     /* SO_SNDTIMEO */
-    timeout = SOCKTIMEOUT2; /* 54 seconds. See remark above */ 
+    timeout = SOCKTIMEOUT2; /* 997 seconds. See remark above */ 
     size = sizeof(timeout);
     err = setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, (char *) &timeout, size); 
     if( !err)
@@ -2453,6 +2453,7 @@ static void test_ioctlsocket(void)
     int ret;
     static const LONG cmds[] = {FIONBIO, FIONREAD, SIOCATMARK};
     UINT i;
+    u_long arg;
 
     sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     ok(sock != INVALID_SOCKET, "Creating the socket failed: %d\n", WSAGetLastError());
@@ -2470,6 +2471,27 @@ static void test_ioctlsocket(void)
         ret = WSAGetLastError();
         ok(ret == WSAEFAULT, "expected WSAEFAULT, got %d instead\n", ret);
     }
+
+    arg=99;
+    ret = ioctlsocket(sock, SIOCATMARK, &arg);
+    ok(ret != SOCKET_ERROR, "ioctlsocket failed: %d\n", WSAGetLastError());
+    if(ret != SOCKET_ERROR)
+        todo_wine ok(arg==1, "expected 1\n");
+
+    /* Now try it with a UDP socket */
+    sock = socket(AF_INET, SOCK_DGRAM, 0);
+    ok(sock != INVALID_SOCKET, "Creating the socket failed: %d\n", WSAGetLastError());
+    if(sock == INVALID_SOCKET)
+    {
+        skip("Can't continue without a socket.\n");
+        return;
+    }
+
+    arg=99;
+    ret = ioctlsocket(sock, SIOCATMARK, &arg);
+    todo_wine ok(ret == SOCKET_ERROR, "ioctlsocket succeeded unexpectedly\n");
+    ret = WSAGetLastError();
+    todo_wine ok(ret == WSAEINVAL, "expected WSAEINVAL, got %d instead\n", ret);
 }
 
 static int drain_pause=0;
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list