]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate" for...
authorRalph Boehme <slow@samba.org>
Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 27 Mar 2025 05:37:44 +0000 (05:37 +0000)
The adjusted test passes against Windows Server 2022.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest/knownfail.d/samba3.base.delaywrite
source4/torture/basic/delaywrite.c

index 4c7163d6a0ebdfbb6bcc1b006ceaf72ea8b8479d..fcde47c1a6041c2f214b2de41aebcd7fcae945d2 100644 (file)
@@ -1,2 +1,3 @@
 ^samba3.base.delaywrite.finfo update on close\(fileserver_smb1\)
 ^samba3.base.delaywrite.delayed update of write time\(fileserver_smb1\)
+^samba3.base.delaywrite.update of write time and SMBwrite truncate\(fileserver_smb1\)
index b5db0b247028a8cf7b0db950e6d2dfaaadffb753..0fc64a650d9fba8e74fb313c275427b0eb786f58 100644 (file)
@@ -185,11 +185,12 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc
        fflush(stdout);
        smb_msleep(2 * msec);
 
-       /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
+       /* Do a non-zero length SMBwrite and make sure it updates the write time. */
        written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
        torture_assert_int_equal(tctx, written, 1,
                                 "unexpected number of bytes written");
 
+       updated = false;
        start = timeval_current();
        end = timeval_add(&start, (10*sec), 0);
        while (!timeval_expired(&end)) {
@@ -204,42 +205,34 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc
                torture_comment(tctx, "write time %s\n",
                        nt_time_string(tctx, finfo3.all_info.out.write_time));
 
-               torture_assert_u64_equal(tctx,
-                                        finfo3.all_info.out.write_time,
-                                        finfo2.all_info.out.write_time,
-                                        talloc_asprintf(tctx,
-                                               "Server updated write time "
-                                               "after %.2f seconds (wrong!)",
-                                               timeval_elapsed(&start)));
-
+               if (finfo3.all_info.out.write_time !=
+                   finfo2.all_info.out.write_time)
+               {
+                       updated = true;
+                       break;
+               }
                fflush(stdout);
                smb_msleep(1 * msec);
        }
 
-       torture_comment(tctx, "Server did not update write time within 10 "
-                       "seconds. Good!\n");
+       torture_assert(tctx, updated,
+                      "Server did not update write time within 10 seconds");
 
        fflush(stdout);
        smb_msleep(2 * msec);
 
-       /* the close should trigger an write time update */
+       /* the close should not trigger an write time update */
        smbcli_close(cli->tree, fnum1);
        fnum1 = -1;
 
        status = smb_raw_pathinfo(cli->tree, tctx, &pinfo4);
        torture_assert_ntstatus_ok(tctx, status, "pathinfo failed");
 
-       torture_assert_u64_not_equal(tctx,
-                                    pinfo4.all_info.out.write_time,
-                                    finfo3.all_info.out.write_time,
-                                    "Server did not update write time on "
+       torture_assert_u64_equal(tctx,
+                                pinfo4.all_info.out.write_time,
+                                finfo3.all_info.out.write_time,
+                                "Server did update write time on "
                                     "close (wrong!)");
-       torture_assert(tctx,
-               pinfo4.all_info.out.write_time > finfo3.all_info.out.write_time,
-               "Server updated write time on close, but to an earlier point "
-               "in time");
-
-       torture_comment(tctx, "Server updated write time on close (correct)\n");
 
        if (fnum1 != -1)
                smbcli_close(cli->tree, fnum1);