1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

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>
This commit is contained in:
Andrew Bartlett 2014-06-20 22:28:50 +12:00 committed by Jeremy Allison
parent f407f58fd3
commit 0e224698f7

View File

@ -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);