test/rcu: fix build for small number of cores
authorGavin Hu <gavin.hu@arm.com>
Mon, 25 Nov 2019 03:36:33 +0000 (11:36 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 25 Nov 2019 22:51:53 +0000 (23:51 +0100)
commit1b32cc619b617dd356afffbf347569409db037ef
treecd4a652f68fa6348b7945d7b9cc132bbfa5e25cc
parent6b01864cc9c59a731dbc727a96995fd2b2ff452f
test/rcu: fix build for small number of cores

If the RTE_MAX_LCORE is less than 10, a compilation error is generated:
app/test/test_rcu_qsbr.c:234:10: error: comparison of integer
expressions of different signedness: ‘unsigned int’ and ‘int’
[-Werror=sign-compare]

The cause is (RTE_MAX_LCORE - 10) results in a negative value.

To fix, use rte_rand() to find a number between 0 and RTE_MAX_LCORE.

Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
app/test/test_rcu_qsbr.c