mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
!testing/cmocka: Compile cmocka as a libary only by default
BREAKING CHANGE This commit introduces a Kconfig switch to include the cmocka binary built from cmocka_main.c. The default behaviour is now changed so that cmocka is built as a library only, which would be the desired behaviour for users creating their own cmocka projects. To restore the old behaviour (where the cmocka program is compiled), add CONFIG_TESTING_CMOCKA_PROG=y to your legacy configuration. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This commit is contained in:
parent
7daac30cb4
commit
8d4e872402
3 changed files with 38 additions and 20 deletions
|
|
@ -74,20 +74,22 @@ if(CONFIG_TESTING_CMOCKA)
|
|||
target_include_directories(cmocka PRIVATE ${INCDIR})
|
||||
target_compile_options(cmocka PRIVATE ${CFLAGS})
|
||||
|
||||
nuttx_add_application(
|
||||
NAME
|
||||
${CONFIG_TESTING_CMOCKA_PROGNAME}
|
||||
PRIORITY
|
||||
${CONFIG_TESTING_CMOCKA_PRIORITY}
|
||||
STACKSIZE
|
||||
${CONFIG_TESTING_CMOCKA_STACKSIZE}
|
||||
MODULE
|
||||
${CONFIG_TESTING_CMOCKA}
|
||||
INCLUDE_DIRECTORIES
|
||||
${INCDIR}
|
||||
SRCS
|
||||
cmocka_main.c
|
||||
DEPENDS
|
||||
cmocka)
|
||||
if(CONFIG_TESTING_CMOCKA_PROG)
|
||||
nuttx_add_application(
|
||||
NAME
|
||||
${CONFIG_TESTING_CMOCKA_PROGNAME}
|
||||
PRIORITY
|
||||
${CONFIG_TESTING_CMOCKA_PRIORITY}
|
||||
STACKSIZE
|
||||
${CONFIG_TESTING_CMOCKA_STACKSIZE}
|
||||
MODULE
|
||||
${CONFIG_TESTING_CMOCKA}
|
||||
INCLUDE_DIRECTORIES
|
||||
${INCDIR}
|
||||
SRCS
|
||||
cmocka_main.c
|
||||
DEPENDS
|
||||
cmocka)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
|
||||
config TESTING_CMOCKA
|
||||
tristate "Enable libcmocka"
|
||||
bool "Enable libcmocka"
|
||||
depends on LIBC_REGEX
|
||||
default n
|
||||
---help---
|
||||
|
|
@ -12,6 +12,15 @@ config TESTING_CMOCKA
|
|||
|
||||
if TESTING_CMOCKA
|
||||
|
||||
config TESTING_CMOCKA_PROG
|
||||
tristate "Compile cmocka binary"
|
||||
default n
|
||||
---help---
|
||||
Instead of just compiling cmocka as a library, the 'cmocka' binary is
|
||||
also included.
|
||||
|
||||
if TESTING_CMOCKA_PROG
|
||||
|
||||
config TESTING_CMOCKA_PROGNAME
|
||||
string "Program name"
|
||||
default "cmocka"
|
||||
|
|
@ -27,8 +36,13 @@ config TESTING_CMOCKA_STACKSIZE
|
|||
int "cmocka test stack size"
|
||||
default DEFAULT_TASK_STACKSIZE
|
||||
|
||||
endif # TESTING_CMOCKA_PROG
|
||||
|
||||
config TESTING_CMOCKA_LEAKDETECT
|
||||
bool "Memory leaks can be checked using cmocka, please use in local environment"
|
||||
bool "Detect leaks"
|
||||
default n
|
||||
---help---
|
||||
Memory leaks can be checked using cmocka, please use in a local
|
||||
environment.
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -29,12 +29,14 @@ CFLAGS += -DHAVE_CLOCK_REALTIME=1
|
|||
CFLAGS += -DHAVE_STRUCT_TIMESPEC=1
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/testing/cmocka
|
||||
|
||||
MODULE = $(CONFIG_TESTING_CMOCKA_PROG)
|
||||
|
||||
ifneq ($(CONFIG_TESTING_CMOCKA_PROG),)
|
||||
PROGNAME = $(CONFIG_TESTING_CMOCKA_PROGNAME)
|
||||
PRIORITY = $(CONFIG_TESTING_CMOCKA_PRIORITY)
|
||||
STACKSIZE = $(CONFIG_TESTING_CMOCKA_STACKSIZE)
|
||||
MODULE = $(CONFIG_TESTING_CMOCKA)
|
||||
|
||||
MAINSRC = $(CURDIR)/cmocka_main.c
|
||||
MAINSRC = $(CURDIR)/cmocka_main.c
|
||||
endif
|
||||
|
||||
# Download and unpack tarball if no git repo found
|
||||
ifeq ($(wildcard cmocka/.git),)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue