From f1154b5be2aca30650ce743ba7f2e40dc35c768e Mon Sep 17 00:00:00 2001 From: zhangchao53 Date: Tue, 13 Jun 2023 16:33:09 +0800 Subject: [PATCH] Memory leaks can be checked using cmocka Signed-off-by: zhangchao53 --- testing/cmocka/Kconfig | 4 ++++ testing/cmocka/Make.defs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/testing/cmocka/Kconfig b/testing/cmocka/Kconfig index 7aebcde0c..d56006251 100644 --- a/testing/cmocka/Kconfig +++ b/testing/cmocka/Kconfig @@ -26,4 +26,8 @@ config TESTING_CMOCKA_STACKSIZE int "cmocka test stack size" default DEFAULT_TASK_STACKSIZE +config TESTING_CMOCKA_LEAKDETECT + bool "Memory leaks can be checked using cmocka, please use in local environment" + default n + endif diff --git a/testing/cmocka/Make.defs b/testing/cmocka/Make.defs index 1f1709a02..3086f8fcb 100644 --- a/testing/cmocka/Make.defs +++ b/testing/cmocka/Make.defs @@ -22,4 +22,7 @@ ifneq ($(CONFIG_TESTING_CMOCKA),) CONFIGURED_APPS += $(APPDIR)/testing/cmocka CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/testing/cmocka/cmocka/include CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/testing/cmocka/cmocka/include +ifneq ($(CONFIG_TESTING_CMOCKA_LEAKDETECT),) +CFLAGS += -DUNIT_TESTING=ON +endif endif