Repository navigation
testing/testsuites: Add sendfile() cases with a nonblocking pipe. - #4074
Merged
xiaoxiang781216 merged 2 commits intoNov 18, 2026
Merged
Conversation
…_test.c. nxstyle reports "Missing blank line after declarations" in test_nuttx_fs_sendfile01() and test_nuttx_fs_sendfile02(). Add the two blank lines. No functional change. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
test_nuttx_fs_sendfile03 and test_nuttx_fs_sendfile04 send a file of 8 KiB to a nonblocking pipe that fills up, with and without an offset. Each call that sends n bytes must move the offset (or the file position) by n. The call on a full pipe must fail with EAGAIN and must not move it. The pipe must get each byte of the file once, in order. The cases need a pipe: they are built only with CONFIG_PIPES and a CONFIG_DEV_PIPE_SIZE larger than 0, as pipe2(). Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
xiaoxiang781216
approved these changes
Nov 17, 2026
casaroli
marked this pull request as ready for review
November 17, 2026 23:35
casaroli
marked this pull request as draft
November 18, 2026 00:38
casaroli
marked this pull request as ready for review
November 18, 2026 00:38
GUIDINGLI
approved these changes
Nov 18, 2026
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx-apps/actions/runs/44209546106 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add two cmocka cases to the kernel fs testsuite:
test_nuttx_fs_sendfile03(with an offset) andtest_nuttx_fs_sendfile04(without an offset). Each case sends a file of 8 KiB to a nonblocking pipe that fills up. A call that sends n bytes must move the offset (or the file position) by n. The call on a full pipe must fail withEAGAINand must not move it. The pipe must get each byte of the file once, in order.The cases check the fix in apache/nuttx#21944 ("fs/vfs: Return the count of a partial sendfile()."). Without that fix, the first call puts 1024 bytes into the pipe, returns -1 with
EAGAIN, and moves the offset by 1536. Merge this PR after apache/nuttx#21944.The first commit only adds the two blank lines after declarations that nxstyle asks for in
test_nuttx_fs_sendfile01()andtest_nuttx_fs_sendfile02(), because CI checks the whole file.Impact
Only
cmocka_fs_testchanges. The new cases are built only withCONFIG_PIPESand aCONFIG_DEV_PIPE_SIZElarger than 0, the condition ofpipe2();CM_FS_TESTitself depends only onFS_LINKS. Each case closes its descriptors before it asserts, so the next cases still run. No other case changes.CI runs the cmocka fs cases one by one from apache/nuttx-ntfc-testing (
fs/fs/test_fs_integration.py). A follow-up there adds the two new cases.Testing
The whole
cmocka_fs_testrun withCONFIG_TESTS_TESTSUITES,CONFIG_CM_FS_TESTandCONFIG_TESTS_TESTSUITES_MOUNT_DIR="/tmp"(tmpfs):qemu-armv8a:nsh(flat, arm64, QEMU HVF)rv-virt:nsh(flat, rv32, QEMU TCG)sim:nsh(flat, x86_64 Linux, the NuttX CI image)All other cases give the same result before and after. Not run: kernel builds, where
cmocka_fs_testdoes not build on master (fs_file_get_test.ccalls the kernel functionfile_get()).tools/checkpatch.sh -c -u -m -gpasses.