]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbtorture: adjust "smb2.timestamps.delayed-write-vs-flush" for modern SMB delayed...
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/smb2/timestamps.c

index fa61d4bb0568ebaa36781c0ce1c34a09f2a1bd75..3b94577d16eaea0336512e1b59059643d32034e9 100644 (file)
@@ -13,3 +13,4 @@
 ^samba3.base.delaywrite.delayed update of write time 5\(fileserver_smb1\)
 ^samba3.base.delaywrite.delayed update of write time 6\(fileserver_smb1\)
 ^samba3.smb2.timestamps.delayed-write-vs-seteof\(.*\)
+^samba3.smb2.timestamps.delayed-write-vs-flush\(.*\)
index ccd8e22eb3548b6a25843806b4d3bf58babc9979..9f25c89ff7e6e309524e0b7bbf70a226c75d192a 100644 (file)
@@ -709,7 +709,7 @@ static bool test_delayed_write_vs_flush(struct torture_context *tctx,
        struct smb2_flush f;
        struct smb2_close c;
        NTTIME create_time;
-       NTTIME flush_time;
+       NTTIME write_time;
        NTSTATUS status;
        bool ret = true;
 
@@ -742,7 +742,7 @@ static bool test_delayed_write_vs_flush(struct torture_context *tctx,
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
                                        "write failed\n");
 
-       torture_comment(tctx, "Check writetime hasn't been updated\n");
+       torture_comment(tctx, "Check writetime has been updated\n");
 
        finfo = (union smb_fileinfo) {
                .generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION,
@@ -752,13 +752,14 @@ static bool test_delayed_write_vs_flush(struct torture_context *tctx,
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
                                        "getinfo failed\n");
 
-       torture_assert_nttime_equal(tctx,
-                                   finfo.all_info.out.write_time,
-                                   create_time,
-                                   "Writetime != create_time (wrong!)\n");
+       torture_assert_nttime_not_equal(tctx,
+                                       finfo.all_info.out.write_time,
+                                       create_time,
+                                       "Writetime not updated\n");
+       write_time = finfo.all_info.out.write_time;
 
        torture_comment(tctx, "Flush file, "
-                       "should flush pending writetime update\n");
+                       "there should be no pending writetime update\n");
 
        f = (struct smb2_flush) {
                .in.file.handle = h1,
@@ -768,8 +769,8 @@ static bool test_delayed_write_vs_flush(struct torture_context *tctx,
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
                                        "flush failed\n");
 
-       torture_comment(tctx, "Check writetime has been updated "
-                       "by the setinfo EOF\n");
+       torture_comment(tctx, "Check writetime has not been updated "
+                       "by the flush\n");
 
        finfo = (union smb_fileinfo) {
                .generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION,
@@ -779,11 +780,10 @@ static bool test_delayed_write_vs_flush(struct torture_context *tctx,
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
                                        "getinfo failed\n");
 
-       flush_time = finfo.all_info.out.write_time;
-       if (!(flush_time > create_time)) {
-               ret = false;
-               torture_fail_goto(tctx, done, "flush hasn't updated writetime\n");
-       }
+       torture_assert_nttime_equal(tctx,
+                                   finfo.all_info.out.write_time,
+                                   write_time,
+                                   "Writetime updated\n");
 
        torture_comment(tctx, "Close file-handle 1, write-time should not be updated\n");
 
@@ -799,8 +799,8 @@ static bool test_delayed_write_vs_flush(struct torture_context *tctx,
 
        torture_assert_nttime_equal(tctx,
                                    c.out.write_time,
-                                   flush_time,
-                                   "writetime != flushtime (wrong!)\n");
+                                   write_time,
+                                   "writetime updated\n");
 
 done:
        if (!smb2_util_handle_empty(h1)) {