s4/torture: fix a timestamps test to work on ext filesystem
authorRalph Boehme <slow@samba.org>
Tue, 10 Mar 2020 17:26:49 +0000 (18:26 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 19 Mar 2020 01:20:34 +0000 (01:20 +0000)
ext filesystem has a time_t limit of 15032385535 (0x0x37fffffff). From
Documentation/filesystems/ext4/inodes.rst:

  If the inode structure size ``sb->s_inode_size`` is larger than 128 bytes and
  the ``i_inode_extra`` field is large enough to encompass the respective
  ``i_[cma]time_extra`` field, the ctime, atime, and mtime inode fields are
  widened to 64 bits. Within this “extra” 32-bit field, the lower two bits are
  used to extend the 32-bit seconds field to be 34 bit wide; the upper 30 bits
  are used to provide nanosecond timestamp accuracy. Therefore, timestamps
  should not overflow until May 2446. ...

Changing the test to use the value 0x37fffffff instead of 100000000000 allows
running the test locally on ext filesytems.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/torture/smb2/timestamps.c

index 9655e5bc164d7ea6eaecf23c1b81294e38b55472..4a9f1e9bf881349cea5eab2335dc003f9d1a6e0f 100644 (file)
@@ -235,11 +235,11 @@ done:
        return ret;
 }
 
-static bool test_time_t_100000000000(struct torture_context *tctx,
+static bool test_time_t_15032385535(struct torture_context *tctx,
                                    struct smb2_tree *tree)
 {
-       return test_time_t(tctx, tree, "test_time_t_100000000000.txt",
-                          100000000000 /* >> INT32_MAX */);
+       return test_time_t(tctx, tree, "test_time_t_15032385535.txt",
+                          15032385535 /* >> INT32_MAX, limit on ext */);
 }
 
 static bool test_time_t_10000000000(struct torture_context *tctx,
@@ -294,7 +294,7 @@ struct torture_suite *torture_smb2_timestamps_init(TALLOC_CTX *ctx)
 {
        struct torture_suite *suite = torture_suite_create(ctx, "timestamps");
 
-       torture_suite_add_1smb2_test(suite, "time_t_100000000000", test_time_t_100000000000);
+       torture_suite_add_1smb2_test(suite, "time_t_15032385535", test_time_t_15032385535);
        torture_suite_add_1smb2_test(suite, "time_t_10000000000", test_time_t_10000000000);
        torture_suite_add_1smb2_test(suite, "time_t_4294967295", test_time_t_4294967295);
        torture_suite_add_1smb2_test(suite, "time_t_1", test_time_t_1);