[1/2] test/bonding: fix LSC related test cases

Message ID 20190823081659.27793-1-kkanas@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [1/2] test/bonding: fix LSC related test cases |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Krzysztof Kanas Aug. 23, 2019, 8:16 a.m. UTC
  From: Krzysztof Kanas <kkanas@marvell.com>

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: declan.doherty@intel.com

Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
---
 app/test/test_link_bonding.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Ferruh Yigit Oct. 8, 2019, 6:48 p.m. UTC | #1
On 8/23/2019 9:16 AM, kkanas@marvell.com wrote:
> From: Krzysztof Kanas <kkanas@marvell.com>
> 
> 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: declan.doherty@intel.com
> 
> Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>

For series,
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Series applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 938fafca3a95..1cfa77278376 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -1160,6 +1160,12 @@  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)