From patchwork Wed Oct 16 16:15:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clemens Famulla-Conrad X-Patchwork-Id: 1178005 X-Patchwork-Delegate: petr.vorel@gmail.com 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=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46tcqG5lDNz9sPK for ; Thu, 17 Oct 2019 03:16:10 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 953FA3C22BA for ; Wed, 16 Oct 2019 18:16:07 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id 9791B3C1445 for ; Wed, 16 Oct 2019 18:15:56 +0200 (CEST) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 14DAD600294 for ; Wed, 16 Oct 2019 18:15:55 +0200 (CEST) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A95E5B371; Wed, 16 Oct 2019 16:15:55 +0000 (UTC) From: Clemens Famulla-Conrad To: pvorel@suse.cz, liwang@redhat.com, ltp@lists.linux.it Date: Wed, 16 Oct 2019 18:15:18 +0200 Message-Id: <20191016161519.11256-3-cfamullaconrad@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191016161519.11256-1-cfamullaconrad@suse.de> References: <1571225126.8494.1.camel@suse.de> <20191016161519.11256-1-cfamullaconrad@suse.de> X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v3 3/4] tst_common.h: Use tst_multiply_timeout in TST_RETRY_FN() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Because of timeout problems when using TST_RETRY_FN() we want a LTP_TIMEOUT_MUL adopted timeout value here as well. Signed-off-by: Clemens Famulla-Conrad Reviewed-by: Petr Vorel --- include/tst_common.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/tst_common.h b/include/tst_common.h index c21505450..b901273b0 100644 --- a/include/tst_common.h +++ b/include/tst_common.h @@ -50,12 +50,14 @@ TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, 1) #define TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, MAX_DELAY) \ -({ int tst_delay_ = 1; \ +({ unsigned int tst_delay_, tst_max_delay_; \ + tst_delay_ = 1; \ + tst_max_delay_ = tst_multiply_timeout(MAX_DELAY * 1000000); \ for (;;) { \ typeof(FUNC) tst_ret_ = FUNC; \ if (tst_ret_ == ERET) \ break; \ - if (tst_delay_ < MAX_DELAY * 1000000) { \ + if (tst_delay_ < tst_max_delay_) { \ usleep(tst_delay_); \ tst_delay_ *= 2; \ } else { \