Bruno Jesus : ws2_32/tests: Add SO_ERROR [set|get]sockopt tests.

Alexandre Julliard julliard at winehq.org
Fri Jan 18 12:07:36 CST 2013


Module: wine
Branch: master
Commit: 02c199beed2ae6a0c2925235ce319844771753b1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=02c199beed2ae6a0c2925235ce319844771753b1

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Thu Jan 17 22:33:05 2013 -0200

ws2_32/tests: Add SO_ERROR [set|get]sockopt tests.

---

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

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 8860448..56a64bc 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1192,6 +1192,34 @@ static void test_set_getsockopt(void)
         "got %d with %d (expected SOCKET_ERROR with WSAEINVAL)\n",
         err, WSAGetLastError());
 
+    /* Test SO_ERROR set/get */
+    SetLastError(0xdeadbeef);
+    i = 1234;
+    err = setsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, size);
+todo_wine
+    ok( !err && !WSAGetLastError(),
+        "got %d with %d (expected 0 with 0)\n",
+        err, WSAGetLastError());
+
+    SetLastError(0xdeadbeef);
+    i = 4321;
+    err = getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, &size);
+todo_wine
+    ok( !err && !WSAGetLastError(),
+        "got %d with %d (expected 0 with 0)\n",
+        err, WSAGetLastError());
+todo_wine
+    ok (i == 1234, "got %d (expected 1234)\n", i);
+
+    /* Test invalid optlen */
+    SetLastError(0xdeadbeef);
+    size = 1;
+    err = getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, &size);
+todo_wine
+    ok( (err == SOCKET_ERROR) && (WSAGetLastError() == WSAEFAULT),
+        "got %d with %d (expected SOCKET_ERROR with WSAEFAULT)\n",
+        err, WSAGetLastError());
+
     closesocket(s);
 }
 




More information about the wine-cvs mailing list