From 4677ac6e70769bcc7f0c8bacdf000cdeb8c8089f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Apr 2008 19:04:44 +0200 Subject: BASE-DELAYWRITE: be more friendly to filesystems without high resolution timestamps metze (This used to be commit 9c18cf670889c9eb8c12b505c3b9ce5f9a516839) --- source4/torture/basic/delaywrite.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index bc1cdbca96..84adfef61a 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -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); \ -- cgit