[PATCH] ws2_32/tests: Add Tests for setsockopt with invalid levels

Detlef Riekenberg wine.dev at web.de
Mon Aug 24 17:04:39 CDT 2009


---
 dlls/ws2_32/tests/sock.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index a83694f..710adf4 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1018,6 +1018,23 @@ static void test_set_getsockopt(void)
     ok(lasterr == WSAEFAULT, "setsockopt with optval being a value "
                              "returned 0x%08x, not WSAEFAULT(0x%08x)\n",
                              lasterr, WSAEFAULT);
+
+    /* SO_RCVTIMEO with invalid values for level */
+    size = sizeof(timeout);
+    timeout = SOCKTIMEOUT1;
+    SetLastError(0xdeadbeef);
+    err = setsockopt(s, 0xffffffff, SO_RCVTIMEO, (char *) &timeout, size); 
+    ok( (err == SOCKET_ERROR) && (WSAGetLastError() == WSAEINVAL), 
+        "got %d with %d (expected SOCKET_ERROR with WSAEINVAL\n",
+        err, WSAGetLastError());
+
+    timeout = SOCKTIMEOUT1;
+    SetLastError(0xdeadbeef);
+    err = setsockopt(s, 0x00008000, SO_RCVTIMEO, (char *) &timeout, size); 
+    ok( (err == SOCKET_ERROR) && (WSAGetLastError() == WSAEINVAL), 
+        "got %d with %d (expected SOCKET_ERROR with WSAEINVAL\n",
+        err, WSAGetLastError());
+
     closesocket(s);
 }
 
-- 
1.5.4.3


--=-UQbA/H407bpusV+RiSDS--




More information about the wine-patches mailing list