summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/basic/delaywrite.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c
index a15abe0657..944c3b8a54 100644
--- a/source4/torture/basic/delaywrite.c
+++ b/source4/torture/basic/delaywrite.c
@@ -295,6 +295,8 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb
double sec = ((double)used_delay) / ((double)normal_delay);
int msec = 1000 * sec;
char buf[2048];
+ bool first;
+ bool updated;
torture_comment(tctx, "\nRunning test_delayed_write_update1a\n");
@@ -336,6 +338,8 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb
start = timeval_current();
end = timeval_add(&start, (120*sec), 0);
+ first = true;
+ updated = false;
while (!timeval_expired(&end)) {
status = smb_raw_fileinfo(cli->tree, tctx, &finfo2);
@@ -347,32 +351,27 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb
torture_comment(tctx, "write time %s\n",
nt_time_string(tctx, finfo2.all_info.out.write_time));
- if (finfo1.all_info.out.write_time != finfo2.all_info.out.write_time) {
- double diff = timeval_elapsed(&start);
- if (diff > (0.25 * (used_delay / (double)1000000))) {
- torture_result(tctx, TORTURE_FAIL, "After SMBwrite truncate "
- "server updated write_time after %.2f seconds"
- "(write time update delay == %.2f)(wrong!)\n",
- diff, used_delay / (double)1000000);
- ret = false;
- break;
- }
-
- torture_comment(tctx, "After SMBwrite truncate "
- "server updated write_time after %.2f seconds"
- "(write time update delay == %.2f)(correct)\n",
- diff, used_delay / (double)1000000);
+ if (finfo1.all_info.out.write_time !=
+ finfo2.all_info.out.write_time)
+ {
+ updated = true;
break;
}
+
fflush(stdout);
smb_msleep(1 * msec);
+ first = false;
}
- torture_assert_u64_not_equal(tctx,
- finfo1.all_info.out.write_time,
- finfo2.all_info.out.write_time,
- "Server did not update write time.");
+ torture_assert(tctx, updated,
+ "Server did not update write time within 120 seconds");
+
+ torture_assert(tctx, first, talloc_asprintf(tctx,
+ "Server did not update write time immediately but only "
+ "after %.2f seconds!", timeval_elapsed(&start)));
+
+ torture_comment(tctx, "Server updated write time immediately. Good!\n");
fflush(stdout);
smb_msleep(2 * msec);