diff options
author | Andrew Bartlett <abartlet@samba.org> | 2014-06-20 22:28:50 +1200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-06-23 23:30:14 +0200 |
commit | 0e224698f7d5610ab681c1181cba3b7a2f042e31 (patch) | |
tree | 608291337dc1ba61877d4317b551a31ef9715061 | |
parent | f407f58fd36f83ef7ead900610a1ff353c09db08 (diff) | |
download | samba-0e224698f7d5610ab681c1181cba3b7a2f042e31.tar.gz samba-0e224698f7d5610ab681c1181cba3b7a2f042e31.tar.xz samba-0e224698f7d5610ab681c1181cba3b7a2f042e31.zip |
torture-base.delaywrite: assert the for a delayed write, that it just takes longer than our configured delay
This removes the hardcoded TIMEDELAY_SECS that was then made variable
by the confusing "secs" variable
Andrew Bartlett
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source4/torture/basic/delaywrite.c | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 30cb5da070..8db37da536 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -31,10 +31,6 @@ #include "torture/util.h" #include "torture/basic/proto.h" -#define W2K8R2_TIMEDELAY_SECS 1 -#define W2K3_TIMEDELAY_SECS 2 -#define TIMEDELAY_SECS W2K3_TIMEDELAY_SECS - #define BASEDIR "\\delaywrite" static bool test_delayed_write_update(struct torture_context *tctx, struct smbcli_state *cli) @@ -96,17 +92,16 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl nt_time_string(tctx, finfo2.basic_info.out.write_time)); if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) { double diff = timeval_elapsed(&start); - if (diff < (TIMEDELAY_SECS * sec)) { + if (diff < used_delay) { torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds" - "(1 sec == %.2f)(wrong!)\n", - diff, sec); + "(expected > %.2f) (wrong!)\n", + diff, used_delay / (double)1000000); ret = false; break; } - torture_comment(tctx, "Server updated write_time after %.2f seconds" - "(1 sec == %.2f)(correct)\n", - diff, sec); + torture_comment(tctx, "Server updated write_time after %.2f seconds (correct)\n", + diff); break; } fflush(stdout); @@ -1162,10 +1157,10 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc nt_time_string(tctx, finfo2.basic_info.out.write_time)); if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) { double diff = timeval_elapsed(&start); - if (diff < (TIMEDELAY_SECS * sec)) { + if (diff < used_delay) { torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds" - "(1sec == %.2f) (wrong!)\n", - diff, sec); + "(expected > %.2f) (wrong!)\n", + diff, used_delay / (double)1000000); ret = false; break; } @@ -1543,10 +1538,10 @@ static bool test_delayed_write_update3(struct torture_context *tctx, if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) { double diff = timeval_elapsed(&start); - if (diff < (TIMEDELAY_SECS * sec)) { + if (diff < (used_delay)) { torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds " - "(1sec == %.2f) (wrong!)\n", - diff, sec); + "(write time update delay == %.2f) (wrong!)\n", + diff, used_delay / (double)1000000); ret = false; break; } @@ -1705,7 +1700,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) { double diff = timeval_elapsed(&start); - if (diff < (TIMEDELAY_SECS * sec)) { + if (diff < (used_delay)) { torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds " "(1sec == %.2f) (wrong!)\n", diff, sec); @@ -1916,17 +1911,17 @@ static bool test_delayed_write_update3b(struct torture_context *tctx, if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) { double diff = timeval_elapsed(&start); - if (diff < (TIMEDELAY_SECS * sec)) { - torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds " - "(1sec == %.2f) (wrong!)\n", - diff, sec); + if (diff < used_delay) { + torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds" + "(expected > %.2f) (wrong!)\n", + diff, used_delay / (double)1000000); ret = false; break; } torture_comment(tctx, "Server updated write_time after %.2f seconds " - "(1sec == %.2f) (correct)\n", - diff, sec); + "(write time update delay == %.2f) (correct)\n", + diff, used_delay / (double)1000000); break; } smb_msleep(0.5 * msec); @@ -2285,17 +2280,17 @@ static bool test_delayed_write_update4(struct torture_context *tctx, if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) { double diff = timeval_elapsed(&start); - if (diff < (TIMEDELAY_SECS * sec)) { - torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds " - "(1sec == %.2f) (wrong!)\n", - diff, sec); + if (diff < used_delay) { + torture_result(tctx, TORTURE_FAIL, "Server updated write_time after %.2f seconds" + "(expected > %.2f) (wrong!)\n", + diff, used_delay / (double)1000000); ret = false; break; } torture_comment(tctx, "Server updated write_time after %.2f seconds " - "(1sec == %.2f) (correct)\n", - diff, sec); + "(write time update delay == %.2f) (correct)\n", + diff, used_delay / (double)1000000); break; } smb_msleep(0.5 * msec); |