Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions testing/cmocka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
16 changes: 15 additions & 1 deletion testing/cmocka/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ config TESTING_CMOCKA

if TESTING_CMOCKA

config TESTING_CMOCKA_PROG
bool "Compile cmocka binary"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool "Compile cmocka binary"
tristate "Compile cmocka binary"

Copy link
Contributor Author

@linguini1 linguini1 Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come tristate should be used here? Is it because of the MODULE variable in Makefile?

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"
Expand All @@ -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
8 changes: 5 additions & 3 deletions testing/cmocka/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ CFLAGS += -DHAVE_CLOCK_REALTIME=1
CFLAGS += -DHAVE_STRUCT_TIMESPEC=1
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/testing/cmocka

MODULE = $(CONFIG_TESTING_CMOCKA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MODULE = $(CONFIG_TESTING_CMOCKA)
MODULE = $(CONFIG_TESTING_CMOCKA_PROG)


ifeq ($(CONFIG_TESTING_CMOCKA_PROG),y)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ifeq ($(CONFIG_TESTING_CMOCKA_PROG),y)
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),)
Expand Down
Loading