casaroli opened a new pull request, #3987:
URL: https://github.com/apache/nuttx-apps/pull/3987

   ## Summary
   
   `ostest_main()` sets `SA_NOCLDWAIT` on `SIGCHLD` for the whole run when 
`CONFIG_SCHED_HAVE_PARENT`, `CONFIG_SCHED_CHILD_STATUS` and 
`CONFIG_ENABLE_ALL_SIGNALS` are set. Then `waitpid()` keeps no exit status: it 
returns `ECHILD` when the task ended before the call. The chroot test reads the 
result of its child and of its grandchild with `waitpid()`, so with 
`CONFIG_FS_CHROOT` it can stop in its assertion:
   
   ```
   chroot_test: ERROR waitpid failed errno=10
   dump_assert_info: Assertion failed : at file: chroot.c:273 task: ostest
   ```
   
   This PR uses `waitpid()` only to wait for the task, and takes `ECHILD` as 
"the task ended", as `fork_test()` and `vfork_test()` do. Each task writes its 
result in a variable. The test is not built in a kernel build, so the tasks 
share the memory.
   
   ## Impact
   
   Only `testing/ostest/chroot.c`, which is built with `CONFIG_FS_CHROOT` and 
`CONFIG_SCHED_WAITPID` outside kernel builds. The test checks the same things 
as before. No change to NuttX.
   
   ## Testing
   
   `qemu-armv8a:nsh` (flat) with `CONFIG_FS_CHROOT` and `CONFIG_FS_TMPFS`, HVF, 
aarch64 GCC 14.2. The defconfig has `CONFIG_SCHED_CHILD_STATUS`, so ostest sets 
`SA_NOCLDWAIT`.
   
   | | master | this PR |
   |---|---|---|
   | ostest | stops at `chroot.c:273` (`waitpid failed errno=10`), status 256 | 
`chroot_test: PASSED`, status 0 |
   
   The same run of `qemu-armv8a:knsh` (kernel, where the test is not built): 
ostest status 0. Not run: a protected build, and a build without 
`SA_NOCLDWAIT`, where `waitpid()` returns the PID as before.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
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