From: David Christensen Date: Wed, 8 Sep 2021 17:48:20 +0000 (-0700) Subject: test/atomic: fix 128-bit atomic test with many cores X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=17a042376be17f6c615b93b189a53eaca1b8bd48;p=dpdk.git test/atomic: fix 128-bit atomic test with many cores When checking the results of the rte_atomic128_cmp_exchange() function, current code compares the values of a uint32_t and a uint64_t variable. If the number of lcores used by the test is large, or the value of the iteration count N is increased, the variable size mismatch can cause a false test failure. Modify the comparison to compare uint64_t values. Fixes: fa3253c534b1 ("test/atomic: add 128-bit atomic compare exchange test") Cc: stable@dpdk.org Signed-off-by: David Christensen Tested-by: Ruifeng Wang Reviewed-by: Ruifeng Wang --- diff --git a/app/test/test_atomic.c b/app/test/test_atomic.c index f10f555af8..ce0c259bd7 100644 --- a/app/test/test_atomic.c +++ b/app/test/test_atomic.c @@ -591,7 +591,7 @@ test_atomic(void) rte_atomic32_clear(&synchro); iterations = count128.val[0] - count128.val[1]; - if (iterations != 4*N*(rte_lcore_count()-1)) { + if (iterations != (uint64_t)4*N*(rte_lcore_count()-1)) { printf("128-bit compare and swap failed\n"); return -1; }