[PATCH 08/11] torture-base.delaywrite: assert the for a delayed write, that it just takes longer than our configured delay
abartlet at samba.org
abartlet at samba.org
Wed Jun 18 22:16:32 MDT 2014
From: Andrew Bartlett <abartlet at samba.org>
This removes the hardcoded TIMEDELAY_SECS that was then made variable by the confusing "secs" variable
Andrew Bartlett
Change-Id: I14dc37f5f1014873d68b80b4693f3876a2a0804c
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
source4/torture/basic/delaywrite.c | 53 +++++++++++++++++---------------------
1 file changed, 24 insertions(+), 29 deletions(-)
diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c
index 30cb5da..8db37da 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);
--
2.0.0
More information about the samba-technical
mailing list