BASE-DELAYWRITE: be more friendly to filesystems without high resolution timestamps pidldocs
authorStefan Metzmacher <metze@samba.org>
Tue, 8 Apr 2008 17:04:44 +0000 (19:04 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 8 Apr 2008 17:42:06 +0000 (19:42 +0200)
metze

source/torture/basic/delaywrite.c

index bc1cdbca96308147050a7b06d857ff16d3e76686..84adfef61adba42bb7801e0e5c7ec028f328e2fb 100644 (file)
@@ -632,9 +632,20 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s
 }
 
 #define COMPARE_WRITE_TIME_CMP(given, correct, cmp) do { \
+       uint64_t r = 10*1000*1000; \
        NTTIME g = (given).basic_info.out.write_time; \
+       NTTIME gr = (g / r) * r; \
        NTTIME c = (correct).basic_info.out.write_time; \
-       if (g cmp c) { \
+       NTTIME cr = (c / r) * r; \
+       bool strict = torture_setting_bool(tctx, "strict mode", false); \
+       bool err = false; \
+       if (strict && (g cmp c)) { \
+               err = true; \
+       } else if (gr cmp cr) { \
+               /* handle filesystem without high resolution timestamps */ \
+               err = true; \
+       } \
+       if (err) { \
                torture_result(tctx, TORTURE_FAIL, __location__": wrong write_time (%s)%s(%llu) %s (%s)%s(%llu)", \
                                #given, nt_time_string(tctx, g), (unsigned long long)g, \
                                #cmp, #correct, nt_time_string(tctx, c), (unsigned long long)c); \