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

   ## Summary
   
   In a flat build, the socket calls and the signal handlers of 
`cmocka_net_local_dgram` use the stack of the test program. On qemu-armv8a:nsh 
the program uses 8144 to 8192 bytes of stack on master (measured with 
`CONFIG_STACK_COLORATION`, 9 runs). Its stack is 
`CONFIG_TESTING_NET_TEST_STACKSIZE`, which is `DEFAULT_TASK_STACKSIZE` (8192) 
there. So the test has no margin: with 7.5 KiB it crashes in 3 of 3 boots, and 
with apache/nuttx#22357 (one function 4 bytes shorter) it crashes in 6 of 10 
boots with 8 KiB. The crash dumps show the stack 100% used.
   
   This PR adds `CONFIG_TESTING_NET_LOCAL_DGRAM_STACKSIZE` (default 16384) for 
`cmocka_net_local_dgram` only, in Kconfig, Make and CMake. The other nettest 
programs keep `CONFIG_TESTING_NET_TEST_STACKSIZE`.
   
   ## Impact
   
   Only `cmocka_net_local_dgram` changes: its stack is 16 KiB by default. No 
change for the other nettest programs or for rv-virt:citest (it does not build 
this test).
   
   ## Testing
   
   Host: Fedora x86_64, NuttX CI image, `-Werror`. Target: qemu-armv8a:nsh 
(flat) with TCP, UDP and local sockets, under QEMU TCG (cortex-a53, 1 CPU). 
Each boot runs `cmocka_net_local_dgram` 3 times.
   
   | Kernel | Stack of the test | Boots (runs) | Crashes | Stack used 
(`STACK_COLORATION`) |
   |---|---|---|---|---|
   | master 28db4789c34 | 32 KiB | 3 (9) | 0 | 8144 to 8192 bytes |
   | master + apache/nuttx#22357 | 32 KiB | 3 (9) | 0 | 8144 to 8528 bytes |
   | master d729a200002 | 7.5 KiB | 3 | 3 | 100% |
   | master d729a200002 | 8 KiB (before this PR) | 10 | 0 | - |
   | d729a200002 + apache/nuttx#22357 | 8 KiB (before this PR) | 10 | 6 | 100% |
   | master + apache/nuttx#22357 | 16 KiB (this PR) | 10 (30) | 0 | - |
   | master | 16 KiB (this PR) | 3 (9) | 0 | - |
   
   Every run without a crash passes 91 of 91 cases. A run with no case (a 
cmocka filter that matches nothing) uses 7008 bytes, so the cases add 1.1 to 
1.5 KiB to the start-up and cmocka frames.
   
   - `tools/checkpatch.sh -c -u -m -g`: pass.
   


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