]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Add notify test with two connection for 'smb2 max async credits'
authorAndreas Schneider <asn@samba.org>
Fri, 9 Aug 2024 06:37:44 +0000 (08:37 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 29 Jan 2025 11:20:33 +0000 (11:20 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14430

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
selftest/knownfail.d/smb2_credits
source4/torture/smb2/credits.c

index dd011726179010332f686ef8c4da56ffcce568a5..2a5d259a3d074aeaa9e6cac76932696ff61efcad 100644 (file)
@@ -2,3 +2,4 @@ samba3.smb2.credits.*1conn_ipc_max_async_credits
 samba3.smb2.credits.*2conn_ipc_max_async_credits
 samba3.smb2.credits.*multichannel_ipc_max_async_credits
 samba3.smb2.credits.*1conn_notify_max_async_credits
+samba3.smb2.credits.*2conn_notify_max_async_credits
index ebb0a3469a3f92a11a6c50e8826be6af78be1e75..d16213866ae1f423831007955922df78db515b85 100644 (file)
@@ -1339,6 +1339,46 @@ out:
        return ok;
 }
 
+static bool test_2conn_notify_max_async_credits(struct torture_context *tctx,
+                                               struct smb2_tree *tree1,
+                                               struct smb2_tree *tree2)
+{
+       struct smb2_tree *trees[2] = { tree1, tree2 };
+       uint16_t max_async_credits = torture_setting_int(
+               tctx,
+               "maxasynccredits",
+               512 /* lpcfg_smb2_max_async_credits(tctx->lp_ctx) */);
+       struct smb2_handle dh = {{}};
+       bool ok = false;
+       NTSTATUS status;
+       uint16_t max_credits = max_async_credits + 2;
+
+       smb2_transport_credits_ask_num(tree1->session->transport, max_credits);
+       smb2_transport_credits_ask_num(tree2->session->transport, max_credits);
+
+       /* Cleanup TESTDIR */
+       smb2_deltree(tree1, TESTDIR);
+       smb2_deltree(tree2, TESTDIR);
+
+       /* Create TESTDIR */
+       status = torture_smb2_testdir(tree1, TESTDIR, &dh);
+       torture_assert_ntstatus_ok_goto(
+               tctx, status, ok, out, "smb2_create failed");
+       status = smb2_util_close(tree1, dh);
+       torture_assert_ntstatus_ok_goto(
+               tctx, status, ok, out, "smb2_util_close failed");
+
+       ok = test_notify_max_async_credits(tctx,
+                                          trees,
+                                          ARRAY_SIZE(trees),
+                                          max_credits);
+out:
+       /* Cleanup TESTDIR */
+       smb2_deltree(tree1, TESTDIR);
+
+       return ok;
+}
+
 struct torture_suite *torture_smb2_crediting_init(TALLOC_CTX *ctx)
 {
        struct torture_suite *suite = torture_suite_create(ctx, "credits");
@@ -1360,6 +1400,9 @@ struct torture_suite *torture_smb2_crediting_init(TALLOC_CTX *ctx)
        torture_suite_add_1smb2_test(suite,
                                     "1conn_notify_max_async_credits",
                                     test_1conn_notify_max_async_credits);
+       torture_suite_add_2smb2_test(suite,
+                                    "2conn_notify_max_async_credits",
+                                    test_2conn_notify_max_async_credits);
 
        suite->description = talloc_strdup(suite, "SMB2-CREDITS tests");