summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-10-17 06:07:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:21:18 -0500
commitf721bcda15d9e094c0e9ea986597fc95def431f5 (patch)
tree0d5ecb8bd2fa879edb3b27a71c8c83cb222e42df
parent0cf42c464ea240c4e57cc5b0c31227a0c5f684d4 (diff)
downloadsamba-f721bcda15d9e094c0e9ea986597fc95def431f5.tar.gz
samba-f721bcda15d9e094c0e9ea986597fc95def431f5.tar.bz2
samba-f721bcda15d9e094c0e9ea986597fc95def431f5.zip
r19366: don't fail async echo tests due to rounding errors
(This used to be commit 9389ca13a38b9a3ba6f3533293ab0d0c8c06a30a)
-rw-r--r--source4/torture/rpc/echo.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index fef9eb8c2b..0568629e47 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -258,23 +258,26 @@ static bool test_sleep(struct torture_context *tctx,
"Event context loop failed");
for (i=0;i<ASYNC_COUNT;i++) {
if (done[i] == False && req[i]->state == RPC_REQUEST_DONE) {
+ int rounded_tdiff;
total_done++;
done[i] = True;
rcv[i] = timeval_current();
diff[i] = timeval_until(&snd[i], &rcv[i]);
+ rounded_tdiff = (int)(0.5 + diff[i].tv_sec + (1.0e-6*diff[i].tv_usec));
status = dcerpc_ndr_request_recv(req[i]);
+ printf("rounded_tdiff=%d\n", rounded_tdiff);
torture_assert_ntstatus_ok(tctx, status,
talloc_asprintf(tctx, "TestSleep(%d) failed", i));
torture_assert(tctx, r[i].out.result == r[i].in.seconds,
talloc_asprintf(tctx, "Failed - Asked to sleep for %u seconds (server replied with %u seconds and the reply takes only %u seconds)",
r[i].out.result, r[i].in.seconds, (uint_t)diff[i].tv_sec));
- torture_assert(tctx, r[i].out.result <= diff[i].tv_sec,
+ torture_assert(tctx, r[i].out.result <= rounded_tdiff,
talloc_asprintf(tctx, "Failed - Slept for %u seconds (but reply takes only %u.%06u seconds)",
r[i].out.result, (uint_t)diff[i].tv_sec, (uint_t)diff[i].tv_usec));
- if (r[i].out.result+1 == diff[i].tv_sec) {
+ if (r[i].out.result+1 == rounded_tdiff) {
torture_comment(tctx, "Slept for %u seconds (but reply takes %u.%06u seconds - busy server?)\n",
r[i].out.result, (uint_t)diff[i].tv_sec, (uint_t)diff[i].tv_usec);
- } else if (r[i].out.result == diff[i].tv_sec) {
+ } else if (r[i].out.result == rounded_tdiff) {
torture_comment(tctx, "Slept for %u seconds (reply takes %u.%06u seconds - ok)\n",
r[i].out.result, (uint_t)diff[i].tv_sec, (uint_t)diff[i].tv_usec);
} else {