huojianchaoyy opened a new pull request, #4192: URL: https://github.com/apache/nuttx-apps/pull/4192
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Follow-up to #4136, addressing @cederom's review of the IOB tests there. The kasantest part of that review is #4191. - **testing/mm/iob: check the results with ASSERT()**: Tests 1, 3, 4, 5, 7, 8 and 12 checked their results only with `DEBUGASSERT()`, which does nothing without `CONFIG_DEBUG_ASSERTIONS`, so the tests always passed in those builds. Use `ASSERT()`, as the rest of the file does. - **testing/mm/iob: skip Test 10 when the pool is too small**: `test_iob_pointer_flags()` holds 9 IOBs at the same time, and `sim:nsh` has 8. The test failed there, and `main()` stopped before Tests 11 and 12. It now checks `iob_navail()` and skips with a message. It also checks the queue entry count and size that it used to print without checking, with the expected size derived from the bytes `create_iob_chain()` puts in each IOB. A dequeued chain that is not the expected one is now freed instead of leaked. - **testing/mm/iob: check the results of the pack and tailroom tests**: Test 6 now checks the length, offset and data after `iob_pack()`, `iob_contig()` and `iob_reserve()`, and Test 9 checks `iob_tailroom()` before and after the copy-in. - **testing/mm/iob: make the extended tail chain test catch the bug**: with the bug fixed by apache/nuttx 69c67a584, the queue entry count and size still look right, so the comment was wrong. The test now also checks the data of the dequeued chain1 and that every IOB returns to the pool. It runs the same sequence with `iob_concat_queue()`, which 69c67a584 fixed as well. - **testing/mm/iob: put Test 12 in order and print only ASCII**: moves Test 12 after Test 11, drops the unused `<setjmp.h>` and `<stdarg.h>`, and replaces the box drawing and check mark characters. No functional change. ## Impact testing/mm/iob only. On pools with fewer than 9 IOBs, Test 10 is skipped instead of failing, so the whole suite runs. Builds without `CONFIG_DEBUG_ASSERTIONS` now check the results. ## Testing Host: Ubuntu 22.04 (Linux 6.8, x86_64), GCC 13.4, CMake 3.23 with Ninja. Base: apps master 9a2c689, nuttx master 8cf5ce2. `./tools/checkpatch.sh -c -u -m -g HEAD~5..HEAD` passes, and each commit builds on `sim:nsh` with `CONFIG_MM_IOB=y`, `CONFIG_TESTING_IOB=y` and `CONFIG_DEBUG_ASSERTIONS` disabled. `sim:nsh`, `nsh> iob`: - `CONFIG_IOB_NBUFFERS=8` (default): Tests 1-9, 11 and 12 pass, and Test 10 prints `Test 10 SKIPPED: needs 9 free IOBs, 8 available`, then `ALL IOB TESTS PASSED!`. Before this change the run stopped at Test 10 with `ERROR: Failed to allocate first IOB in chain`. - `CONFIG_IOB_NBUFFERS=36`: all 12 tests pass, then `ALL IOB TESTS PASSED!`. Test 12 against nuttx with 69c67a584 reverted, each case run on its own: ``` Linking chain2 with iob_add_queue() ERROR: chain1 corrupted after dequeue Linking chain2 with iob_concat_queue() ERROR: chain1 corrupted after dequeue ``` Not tested: hardware boards, SMP. -- 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]
