From patchwork Sat May 16 17:38:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1291925 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49PXZT3TR9z9sTK for ; Sun, 17 May 2020 03:38:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68FA938930CA; Sat, 16 May 2020 17:38:54 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [185.233.100.1]) by sourceware.org (Postfix) with ESMTPS id 6EC34388E839 for ; Sat, 16 May 2020 17:38:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6EC34388E839 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 1688F32D0; Sat, 16 May 2020 19:38:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ptd8uavbGmb9; Sat, 16 May 2020 19:38:47 +0200 (CEST) Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr [86.234.239.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 88D13300F; Sat, 16 May 2020 19:38:47 +0200 (CEST) Received: from samy by function with local (Exim 4.93) (envelope-from ) id 1ja0lq-000a9o-8X; Sat, 16 May 2020 19:38:46 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd,commited] sunrpc/tst-udp-*: Fix timeout value Date: Sat, 16 May 2020 19:38:46 +0200 Message-Id: <20200516173846.138947-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Spam-Status: No, score=-18.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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); }