[dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros
Thomas Monjalon
thomas at monjalon.net
Wed Jan 10 21:20:06 CET 2018
08/01/2018 14:47, Pavan Nikhilesh:
> Adding common test assertion macros for unit testing.
> Taken from test/test.h.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula at caviumnetworks.com>
> Acked-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
> ---
> lib/librte_eal/common/Makefile | 2 +-
> lib/librte_eal/common/include/rte_test.h | 69 ++++++++++++++++++++++++++++++++
> 2 files changed, 70 insertions(+), 1 deletion(-)
> create mode 100644 lib/librte_eal/common/include/rte_test.h
Is the original file still needed?
Can we always use rte_test.h from EAL?
> +#define RTE_TEST_ASSERT(cond, msg, ...) do { \
> + if (!(cond)) { \
> + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \
> + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \
> + return -1; \
> + } \
> +} while (0)
> +
> +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) do { \
> + if (!(a == b)) { \
> + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \
> + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \
> + return -1; \
> + } \
> +} while (0)
Why not call RTE_TEST_ASSERT in all derived macros?
More information about the dev
mailing list