git-tst-udp
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Tue, 27 May 2025 10:40:04 +0000 (11:40 +0100)
committerSean Whitton <spwhitton@spwhitton.name>
Tue, 27 May 2025 10:40:04 +0000 (11:40 +0100)
Committed for glibc 2.32

commit cbfc16122e9c4948b3a17224aeb5f8b70f02417d
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sat May 16 19:29:50 2020 +0200

    sunrpc/tst-udp-*: Fix timeout value

    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.

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name git-tst-udp.diff

sunrpc/tst-udp-nonblocking.c
sunrpc/tst-udp-timeout.c

index 189136c9f99557c601e9d57231ef8ed085aaa4aa..45d6b8919f24ab1ee7ad0b9300912f97afc1e82e 100644 (file)
@@ -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;
index 8d45365b23d801c19d2480e44aee9526c9d8c0e2..fd193522e6c327794375aeb8a4b32e4cd216cbd7 100644 (file)
@@ -283,10 +283,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);
 
@@ -305,7 +305,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);
 
@@ -320,7 +320,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);
 
@@ -340,7 +340,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);
 
@@ -358,7 +358,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);
     }