From: Ralph Boehme Date: Tue, 10 Mar 2020 17:26:49 +0000 (+0100) Subject: s4/torture: fix a timestamps test to work on ext filesystem X-Git-Tag: ldb-2.2.0~1403 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73fedf014bbe02a408360d48e35bce4a6dbc9c36;p=thirdparty%2Fsamba.git s4/torture: fix a timestamps test to work on ext filesystem 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 Reviewed-by: Jeremy Allison --- diff --git a/source4/torture/smb2/timestamps.c b/source4/torture/smb2/timestamps.c index 9655e5bc164..4a9f1e9bf88 100644 --- a/source4/torture/smb2/timestamps.c +++ b/source4/torture/smb2/timestamps.c @@ -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);