signals: fix build and runtime issues when signals all isabled

Fix build and runtime issues when signals all disabled.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
This commit is contained in:
wangchengdong 2026-01-16 22:47:13 +08:00 committed by Donny(董九柱)
parent 9c85568c4f
commit d9afe2db8c
19 changed files with 172 additions and 48 deletions

View file

@ -5,7 +5,7 @@
config TESTING_NAND_SIM
boolean "NAND Flash Simulator"
depends on MTD_NAND_RAM
depends on MTD_NAND_RAM && ENABLE_ALL_SIGNALS
default n
---help---
Enable the NAND Flash Simulator device.

View file

@ -22,14 +22,15 @@
if(CONFIG_TESTING_OSTEST)
set(SRCS
getopt.c
libc_memmem.c
restart.c
sigprocmask.c
sighand.c
signest.c
sighelper.c)
set(SRCS getopt.c libc_memmem.c restart.c sighelper.c)
if(CONFIG_ENABLE_ALL_SIGNALS)
list(APPEND SRCS sighand.c signest.c)
endif()
if(NOT CONFIG_DISABLE_ALL_SIGNALS)
list(APPEND SRCS sigprocmask.c)
endif()
if(CONFIG_DEV_NULL)
list(APPEND SRCS dev_null.c)
@ -124,7 +125,10 @@ if(CONFIG_TESTING_OSTEST)
if(NOT CONFIG_DISABLE_MQUEUE)
if(NOT CONFIG_DISABLE_PTHREAD)
list(APPEND SRCS mqueue.c timedmqueue.c)
list(APPEND SRCS timedmqueue.c)
if(NOT CONFIG_DISABLE_ALL_SIGNALS)
list(APPEND SRCS mqueue.c)
endif()
endif() # CONFIG_DISABLE_PTHREAD
endif() # CONFIG_DISABLE_MQUEUE

View file

@ -31,9 +31,17 @@ MODULE = $(CONFIG_TESTING_OSTEST)
# NuttX OS Test
CSRCS = getopt.c libc_memmem.c restart.c sigprocmask.c sighand.c \
CSRCS = getopt.c libc_memmem.c restart.c \
signest.c sighelper.c
ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y)
CSRCS += sighand.c signest.c
endif
ifneq ($(CONFIG_DISABLE_ALL_SIGNALS),y)
CSRCS += sigprocmask.c
endif
MAINSRC = ostest_main.c
ifeq ($(CONFIG_DEV_NULL),y)
@ -119,7 +127,10 @@ endif # CONFIG_DISABLE_PTHREAD
ifneq ($(CONFIG_DISABLE_MQUEUE),y)
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
CSRCS += mqueue.c timedmqueue.c
CSRCS += timedmqueue.c
ifneq ($(CONFIG_DISABLE_ALL_SIGNALS),y)
CSRCS += mqueue.c
endif
endif # CONFIG_DISABLE_PTHREAD
endif # CONFIG_DISABLE_MQUEUE

View file

@ -496,14 +496,6 @@ static int user_main(int argc, char *argv[])
check_test_memory_usage();
#endif /* !CONFIG_DISABLE_PTHREAD */
#if !defined(CONFIG_DISABLE_MQUEUE) && !defined(CONFIG_DISABLE_PTHREAD)
/* Verify pthreads and message queues */
printf("\nuser_main: message queue test\n");
mqueue_test();
check_test_memory_usage();
#endif
#if !defined(CONFIG_DISABLE_MQUEUE) && !defined(CONFIG_DISABLE_PTHREAD)
/* Verify pthreads and message queues */
@ -519,6 +511,14 @@ static int user_main(int argc, char *argv[])
sigprocmask_test();
check_test_memory_usage();
#if !defined(CONFIG_DISABLE_MQUEUE) && !defined(CONFIG_DISABLE_PTHREAD)
/* Verify pthreads and message queues */
printf("\nuser_main: message queue test\n");
mqueue_test();
check_test_memory_usage();
#endif
#if defined(CONFIG_SIG_SIGSTOP_ACTION) && defined(CONFIG_SIG_SIGKILL_ACTION) && \
!defined(CONFIG_BUILD_KERNEL)
printf("\nuser_main: signal action test\n");