From: Stefan Metzmacher Date: Mon, 26 May 2025 11:14:53 +0000 (+0200) Subject: s4:torture/smb2: add explicit timeout handling to async_credits tests X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b27fc1cfd5f06433381ef802adee25a58b83175c;p=thirdparty%2Fsamba.git s4:torture/smb2: add explicit timeout handling to async_credits tests Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- diff --git a/source4/torture/smb2/credits.c b/source4/torture/smb2/credits.c index 5389f3430d4..4ccb4a986cd 100644 --- a/source4/torture/smb2/credits.c +++ b/source4/torture/smb2/credits.c @@ -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];