]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture/smb2: add explicit timeout handling to async_credits tests
authorStefan Metzmacher <metze@samba.org>
Mon, 26 May 2025 11:14:53 +0000 (13:14 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 18 Jun 2025 17:52:37 +0000 (17:52 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source4/torture/smb2/credits.c

index 5389f3430d42d3ddbf95e186cbc7b911e86706ad..4ccb4a986cd136e3646cd8c932604cd33291146e 100644 (file)
@@ -445,6 +445,8 @@ static bool test_ipc_max_async_credits(struct torture_context *tctx,
                                       size_t max_data)
 {
        struct test_ipc_async_credits_state *states[num_trees];
+       struct timeval timeout_tv = { .tv_sec = 0, };
+       struct tevent_req *timeout_req = NULL;
        bool stop_loop = false;
        NTSTATUS status;
        size_t i, t;
@@ -589,6 +591,10 @@ static bool test_ipc_max_async_credits(struct torture_context *tctx,
                }
        }
 
+       timeout_tv = timeval_current_ofs(10, 0);
+       timeout_req = tevent_wakeup_send(tctx, tctx->ev, timeout_tv);
+       torture_assert_goto(tctx, timeout_req, ok, out, "tevent_wakeup_send");
+
        /* Loop to send and receive packets */
        while (!stop_loop) {
                size_t loops_ready = 0;
@@ -598,6 +604,9 @@ static bool test_ipc_max_async_credits(struct torture_context *tctx,
                torture_assert_int_equal_goto(
                        tctx, rc, 0, ok, out, "tevent_loop_once");
 
+               ok = tevent_req_is_in_progress(timeout_req);
+               torture_assert_goto(tctx, ok, ok, out, "timeout_req");
+
                for (i = 0; i < num_trees; i++) {
                        struct test_ipc_async_credits_state
                                *state = states[i];
@@ -1171,6 +1180,8 @@ static bool test_notify_max_async_credits(struct torture_context *tctx,
                                   size_t num_loops)
 {
        struct test_notify_async_credit_state *states[num_trees];
+       struct timeval timeout_tv = { .tv_sec = 0, };
+       struct tevent_req *timeout_req = NULL;
        bool stop_loop = false;
        NTSTATUS status;
        size_t i, t;
@@ -1286,6 +1297,10 @@ static bool test_notify_max_async_credits(struct torture_context *tctx,
                }
        }
 
+       timeout_tv = timeval_current_ofs(10, 0);
+       timeout_req = tevent_wakeup_send(tctx, tctx->ev, timeout_tv);
+       torture_assert_goto(tctx, timeout_req, ok, out, "tevent_wakeup_send");
+
        /* Loop to send and receive packets */
        while (!stop_loop) {
                size_t loops_ready = 0;
@@ -1295,6 +1310,9 @@ static bool test_notify_max_async_credits(struct torture_context *tctx,
                torture_assert_int_equal_goto(
                        tctx, rc, 0, ok, out, "tevent_loop_once");
 
+               ok = tevent_req_is_in_progress(timeout_req);
+               torture_assert_goto(tctx, ok, ok, out, "timeout_req");
+
                for (i = 0; i < num_trees; i++) {
                        struct test_notify_async_credit_state
                                *state = states[i];