summaryrefslogtreecommitdiff
path: root/source4/torture/basic
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-10-02 16:48:40 +0200
committerAndrew Bartlett <abartlet@samba.org>2014-10-03 08:34:06 +0200
commit970ae65a9dd9a2d64937b805e7afefef204ee4b4 (patch)
tree2a03cd7f418c3c50c7e4d9864e7f85f415b98515 /source4/torture/basic
parent2907950f13506a0ca2160b72824e315772a4424f (diff)
downloadsamba-970ae65a9dd9a2d64937b805e7afefef204ee4b4.tar.gz
s4:torture:basic: eliminate potential for false failures in delayed_write_update1b
We want to test that the write did update the write time immediately. We check this by getting the file info in a loop for a few seconds. There are several result cases: - the server updated the write time immediately - success - the server updated the write time, but not immediately - failure - the server did not update the write time - failure The loop is only there to be able to discern between the two failure cases. The check for success is whether the first getinfo has reportet the updated write time. The potential for false failures was the additional timing check. So if the first fileinfo call just took too long (e.g. due to a busy system), this was reported as failure. This patch should eliminate interemittent autobuild failures. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/torture/basic')
-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 51405e2a261..b75168f4727 100644
--- a/source4/torture/basic/delaywrite.c
+++ b/source4/torture/basic/delaywrite.c
@@ -456,6 +456,8 @@ static bool test_delayed_write_update1b(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_update1b\n");
@@ -496,6 +498,8 @@ static bool test_delayed_write_update1b(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);
@@ -507,32 +511,27 @@ static bool test_delayed_write_update1b(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 SET_END_OF_FILE truncate "
- "server updated write_time after %.2f seconds"
- "(write time update delay == %.2f)(wrong!)",
- diff, used_delay / (double)1000000);
- ret = false;
- break;
- }
- torture_comment(tctx, "After SET_END_OF_FILE 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,
- finfo2.all_info.out.write_time,
- finfo1.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);