From: Krzysztof Kanas Date: Fri, 23 Aug 2019 08:16:58 +0000 (+0200) Subject: test/bonding: fix LSC related cases X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;ds=sidebyside;h=88524d6b8b339278c95df3a0a894054c365daf13;p=dpdk.git test/bonding: fix LSC related cases On rare situation test_link_bonding test case fail due to timespec tv_nsec overflow, which causes pthread_cond_timedwait to return EINVAL and test to fail. Fixes: 76d29903f5f5 ("bond: support link status interrupt") Cc: stable@dpdk.org Signed-off-by: Krzysztof Kanas Reviewed-by: Ferruh Yigit --- diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index a9b9d0c42a..b5ce9dbb47 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -1202,6 +1202,11 @@ lsc_timeout(int wait_us) ts.tv_sec = tp.tv_sec; ts.tv_nsec = tp.tv_usec * 1000; ts.tv_nsec += wait_us * 1000; + /* Normalize tv_nsec to [0,999999999L] */ + while (ts.tv_nsec > 1000000000L) { + ts.tv_nsec -= 1000000000L; + ts.tv_sec += 1; + } pthread_mutex_lock(&mutex); if (test_lsc_interrupt_count < 1)