Acked-by: Marat Khalili <[email protected]>
> -----Original Message-----
> From: Stephen Hemminger <[email protected]>
> Sent: Wednesday 29 April 2026 15:42
> To: [email protected]
> Cc: Weijun Pan <[email protected]>; [email protected]; Thomas Monjalon
> <[email protected]>; Jerin
> Jacob <[email protected]>; Pavan Nikhilesh <[email protected]>
> Subject: [PATCH 2/2] test: parenthesize assertion macro parameters
>
> From: Weijun Pan <[email protected]>
>
> Some test assertion macros use parameters directly in expressions,
> which can lead to unexpected evaluation due to operator precedence
> after macro substitution.
>
> Fix this by parenthesizing macro parameters and the resulting
> expressions in rte_test.h
>
> Bugzilla ID: 1925
> Fixes: 5afc521eac6a ("eal: add test assert macros")
> Cc: [email protected]
>
> Signed-off-by: Weijun Pan <[email protected]>
> ---
> .mailmap | 1 +
> lib/eal/include/rte_test.h | 12 ++++++------
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/.mailmap b/.mailmap
> index 0e0d83e1c6..a72bba5fb8 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -1771,6 +1771,7 @@ Weichun Chen <[email protected]>
> Weifeng Li <[email protected]>
> Weiguo Li <[email protected]> <[email protected]>
> WeiJie Zhuang <[email protected]>
> +Weijun Pan <[email protected]> <[email protected]>
> Weiliang Luo <[email protected]>
> Weiyuan Li <[email protected]>
> Wen Chiu <[email protected]>
> diff --git a/lib/eal/include/rte_test.h b/lib/eal/include/rte_test.h
> index 62c8f165af..d132d3156b 100644
> --- a/lib/eal/include/rte_test.h
> +++ b/lib/eal/include/rte_test.h
> @@ -26,21 +26,21 @@
> } while (0)
>
> #define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) \
> - RTE_TEST_ASSERT(a == b, msg, ##__VA_ARGS__)
> + RTE_TEST_ASSERT((a) == (b), msg, ##__VA_ARGS__)
>
> #define RTE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) \
> - RTE_TEST_ASSERT(a != b, msg, ##__VA_ARGS__)
> + RTE_TEST_ASSERT((a) != (b), msg, ##__VA_ARGS__)
>
> #define RTE_TEST_ASSERT_SUCCESS(val, msg, ...) \
> - RTE_TEST_ASSERT(val == 0, msg, ##__VA_ARGS__)
> + RTE_TEST_ASSERT((val) == 0, msg, ##__VA_ARGS__)
>
> #define RTE_TEST_ASSERT_FAIL(val, msg, ...) \
> - RTE_TEST_ASSERT(val != 0, msg, ##__VA_ARGS__)
> + RTE_TEST_ASSERT((val) != 0, msg, ##__VA_ARGS__)
>
> #define RTE_TEST_ASSERT_NULL(val, msg, ...) \
> - RTE_TEST_ASSERT(val == NULL, msg, ##__VA_ARGS__)
> + RTE_TEST_ASSERT((val) == NULL, msg, ##__VA_ARGS__)
>
> #define RTE_TEST_ASSERT_NOT_NULL(val, msg, ...) \
> - RTE_TEST_ASSERT(val != NULL, msg, ##__VA_ARGS__)
> + RTE_TEST_ASSERT((val) != NULL, msg, ##__VA_ARGS__)
>
> #endif /* _RTE_TEST_H_ */
> --
> 2.53.0