casaroli commented on code in PR #3887:
URL: https://github.com/apache/nuttx-apps/pull/3887#discussion_r4435139674


##########
testing/ostest/ostest_main.c:
##########
@@ -816,6 +818,22 @@ int main(int argc, FAR char **argv)
   show_environment(true, true, true);
 #endif
 
+  /* Verify that we can spawn a new task.  If all signal support is disabled,
+   * execute the test body synchronously instead.  This keeps ostest usable
+   * on configurations where waitpid()/SIGCHLD are intentionally unavailable.
+   */
+
+#if defined(CONFIG_DISABLE_ALL_SIGNALS) && !defined(CONFIG_BUILD_KERNEL)

Review Comment:
   task_create() does not use signals, and without CONFIG_SCHED_HAVE_PARENT 
waitpid() waits on group->tg_exitsem (sched/sched/sched_waitpid.c:458-464), not 
on SIGCHLD; only the CONFIG_SCHED_HAVE_PARENT waitpid() uses SIGCHLD 
(nxsig_timedwait(), line 193). So most no-signal configurations lose the 
task_create() test for no reason.
   
   Fix: take the synchronous path only with CONFIG_SCHED_HAVE_PARENT.



##########
testing/ostest/ostest_main.c:
##########
@@ -816,6 +818,22 @@ int main(int argc, FAR char **argv)
   show_environment(true, true, true);
 #endif
 
+  /* Verify that we can spawn a new task.  If all signal support is disabled,
+   * execute the test body synchronously instead.  This keeps ostest usable
+   * on configurations where waitpid()/SIGCHLD are intentionally unavailable.
+   */
+
+#if defined(CONFIG_DISABLE_ALL_SIGNALS) && !defined(CONFIG_BUILD_KERNEL)
+  {
+    FAR char * const args[NARGS + 2] =
+    {
+      argv[0], (FAR char *)arg1, (FAR char *)arg2,
+      (FAR char *)arg3, (FAR char *)arg4, NULL
+    };
+
+    ostest_result = user_main(NARGS + 1, (FAR char **)args);

Review Comment:
   user_main() now runs on the ostest main stack, CONFIG_DEFAULT_TASK_STACKSIZE 
(Makefile line 29, default 2048), while the task path gives it 
CONFIG_TESTING_OSTEST_STACKSIZE (default 8192), so the full suite can overflow 
the smaller stack.
   
   Fix: use the same stack size in both paths, or say in the Kconfig help that 
the main stack must be large enough.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to