diff mbox series

[v3,3/4] tst_common.h: Use tst_multiply_timeout in TST_RETRY_FN()

Message ID 20191016161519.11256-3-cfamullaconrad@suse.de
State Changes Requested
Delegated to: Petr Vorel
Headers show
Series [v3,1/4] tst_test.sh: Use LTP_TIMEOUT_MUL in TST_RETRY_FN() | expand

Commit Message

Clemens Famulla-Conrad Oct. 16, 2019, 4:15 p.m. UTC
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 <cfamullaconrad@suse.de>
---
 include/tst_common.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Petr Vorel Oct. 17, 2019, 8:48 a.m. UTC | #1
Hi,

> 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 <cfamullaconrad@suse.de>
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr
diff mbox series

Patch

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 {						\