Zebediah Figura : ws2_32/tests: Add some tests for SO_DEBUG.

Alexandre Julliard julliard at winehq.org
Wed Jun 23 16:10:10 CDT 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Jun 23 11:23:46 2021 -0500

ws2_32/tests: Add some tests for SO_DEBUG.

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 | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index c12ff45b921..c4a3f953175 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -10978,6 +10978,41 @@ static void test_timeout(void)
     CloseHandle(overlapped.hEvent);
 }
 
+static void test_so_debug(void)
+{
+    int ret, len;
+    DWORD debug;
+    SOCKET s;
+
+    s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+
+    len = sizeof(debug);
+    WSASetLastError(0xdeadbeef);
+    debug = 0xdeadbeef;
+    ret = getsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&debug, &len);
+    ok(!ret, "got %d\n", ret);
+    todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
+    ok(len == sizeof(debug), "got len %u\n", len);
+    ok(!debug, "got debug %u\n", debug);
+
+    WSASetLastError(0xdeadbeef);
+    debug = 2;
+    ret = setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&debug, sizeof(debug));
+    ok(!ret, "got %d\n", ret);
+    todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
+
+    len = sizeof(debug);
+    WSASetLastError(0xdeadbeef);
+    debug = 0xdeadbeef;
+    ret = getsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&debug, &len);
+    ok(!ret, "got %d\n", ret);
+    todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
+    ok(len == sizeof(debug), "got len %u\n", len);
+    todo_wine ok(debug == 1, "got debug %u\n", debug);
+
+    closesocket(s);
+}
+
 START_TEST( sock )
 {
     int i;
@@ -10993,6 +11028,7 @@ START_TEST( sock )
     test_so_reuseaddr();
     test_ip_pktinfo();
     test_extendedSocketOptions();
+    test_so_debug();
 
     for (i = 0; i < ARRAY_SIZE(tests); i++)
         do_test(&tests[i]);




More information about the wine-cvs mailing list