* [hurd,commited] sunrpc/tst-udp-*: Fix timeout value
@ 2020-05-16 17:38 Samuel Thibault
0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2020-05-16 17:38 UTC (permalink / raw)
To: libc-alpha; +Cc: Samuel Thibault, commit-hurd
Following on 00c3da43a ('sunrpc/tst-udp-timeout: Fix timeout value').
While e.g. 2.5 timeout can be represented exactly with doubles, time stamps
may not be represented that exactly, and thus with coarse-grain clocks (e.g.
10ms) we may end up with 2.499-ish values due to rounding errors.
* sunrpc/tst-udp-timeout.c (test_udp_server): Add more timeout slack.
* sunrpc/tst-udp-nonblocking.c (do_test): Likewise.
---
sunrpc/tst-udp-nonblocking.c | 2 +-
sunrpc/tst-udp-timeout.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sunrpc/tst-udp-nonblocking.c b/sunrpc/tst-udp-nonblocking.c
index 189136c9f9..45d6b8919f 100644
--- a/sunrpc/tst-udp-nonblocking.c
+++ b/sunrpc/tst-udp-nonblocking.c
@@ -290,7 +290,7 @@ do_test (void)
printf ("info: send/receive took %f seconds\n",
after_pings - before_pings);
/* Expected timeout is 0.75 seconds. */
- TEST_VERIFY (0.75 <= after_pings - before_pings);
+ TEST_VERIFY (0.70 <= after_pings - before_pings);
TEST_VERIFY (after_pings - before_pings < 1.2);
uint32_t xid;
diff --git a/sunrpc/tst-udp-timeout.c b/sunrpc/tst-udp-timeout.c
index 26869f5547..7ca284d84b 100644
--- a/sunrpc/tst-udp-timeout.c
+++ b/sunrpc/tst-udp-timeout.c
@@ -294,10 +294,10 @@ test_udp_server (int port)
double after = get_ticks ();
if (test_verbose)
printf ("info: 21 garbage packets took %f seconds\n", after - before);
- /* Expected timeout is 0.5 seconds. Add some slack in case process
- scheduling delays processing the query or response, but do not
- accept a retry (which would happen at 1.5 seconds). */
- TEST_VERIFY (0.5 <= after - before);
+ /* Expected timeout is 0.5 seconds. Add some slack for rounding errors and
+ in case process scheduling delays processing the query or response, but
+ do not accept a retry (which would happen at 1.5 seconds). */
+ TEST_VERIFY (0.45 <= after - before);
TEST_VERIFY (after - before < 1.2);
test_call_flush (clnt);
@@ -316,7 +316,7 @@ test_udp_server (int port)
after - before);
/* Expected timeout is 1.5 seconds. Do not accept a second retry
(which would happen at 3 seconds). */
- TEST_VERIFY (1.5 <= after - before);
+ TEST_VERIFY (1.45 <= after - before);
TEST_VERIFY (after - before < 2.9);
test_call_flush (clnt);
@@ -331,7 +331,7 @@ test_udp_server (int port)
if (test_verbose)
printf ("info: 0.75 second timeout took %f seconds\n",
after - before);
- TEST_VERIFY (0.75 <= after - before);
+ TEST_VERIFY (0.70 <= after - before);
TEST_VERIFY (after - before < 1.4);
test_call_flush (clnt);
@@ -351,7 +351,7 @@ test_udp_server (int port)
printf ("info: test_udp_server: 0.75 second timeout took %f seconds"
" (garbage %d)\n",
after - before, with_garbage);
- TEST_VERIFY (0.75 <= after - before);
+ TEST_VERIFY (0.70 <= after - before);
TEST_VERIFY (after - before < 1.4);
test_call_flush (clnt);
@@ -369,7 +369,7 @@ test_udp_server (int port)
printf ("info: test_udp_server: 2.5 second timeout took %f seconds"
" (garbage %d)\n",
after - before, with_garbage);
- TEST_VERIFY (2.5 <= after - before);
+ TEST_VERIFY (2.45 <= after - before);
TEST_VERIFY (after - before < 3.0);
test_call_flush (clnt);
}
--
2.26.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-16 17:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16 17:38 [hurd,commited] sunrpc/tst-udp-*: Fix timeout value Samuel Thibault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).