This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit fc8723ff9999424dac12035fd86f9560cf2d45d9 Author: Marco Casaroli <[email protected]> AuthorDate: Thu Oct 22 13:36:01 2026 +0200 testing/ostest: Catch the SIGUSR1 that wakes up the mqueue receiver. mqueue_test wakes up its receiver thread with pthread_kill(SIGUSR1) and expects only that mq_receive() is interrupted. Nothing caught the signal. With CONFIG_SIG_SIGUSR1_ACTION, SIGUSR1 has its POSIX default action, and the default action ends the whole process: ostest stopped in mqueue_test. Install a handler that does nothing for SIGUSR1 during the test, and restore the old action at the end. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- testing/ostest/mqueue.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/testing/ostest/mqueue.c b/testing/ostest/mqueue.c index c418fb520..f31c0ecdc 100644 --- a/testing/ostest/mqueue.c +++ b/testing/ostest/mqueue.c @@ -33,6 +33,7 @@ #include <mqueue.h> #include <pthread.h> #include <sched.h> +#include <signal.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -263,8 +264,19 @@ static void *receiver_thread(void *arg) return (pthread_addr_t)((uintptr_t)nerrors); } +#ifdef CONFIG_ENABLE_ALL_SIGNALS +static void wakeup_action(int signo) +{ + /* Nothing to do: the signal only interrupts mq_receive() */ +} +#endif + void mqueue_test(void) { +#ifdef CONFIG_ENABLE_ALL_SIGNALS + struct sigaction act; + struct sigaction oact; +#endif pthread_t sender; pthread_t receiver; void *result; @@ -281,6 +293,17 @@ void mqueue_test(void) g_send_mqfd = 0; g_recv_mqfd = 0; +#ifdef CONFIG_ENABLE_ALL_SIGNALS + /* SIGUSR1 wakes up the receiver below. Catch it: its default action + * ends the process with CONFIG_SIG_SIGUSR1_ACTION, as POSIX wants. + */ + + memset(&act, 0, sizeof(act)); + act.sa_handler = wakeup_action; + sigemptyset(&act.sa_mask); + sigaction(SIGUSR1, &act, &oact); +#endif + /* Start the sending thread at higher priority */ printf("mqueue_test: Starting receiver\n"); @@ -462,4 +485,8 @@ void mqueue_test(void) printf("mqueue_test: ERROR mq_unlink failed\n"); ASSERT(false); } + +#ifdef CONFIG_ENABLE_ALL_SIGNALS + sigaction(SIGUSR1, &oact, NULL); +#endif }
