casaroli opened a new pull request, #4074:
URL: https://github.com/apache/nuttx-apps/pull/4074
depends-on: apache/nuttx/pull/21944
## Summary
Add two cmocka cases to the kernel fs testsuite: `test_nuttx_fs_sendfile03`
(with an offset) and `test_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 with `EAGAIN` and 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()` and
`test_nuttx_fs_sendfile02()`, because CI checks the whole file.
## Impact
Only `cmocka_fs_test` changes. The new cases are built only with
`CONFIG_PIPES` and a `CONFIG_DEV_PIPE_SIZE` larger than 0, the condition of
`pipe2()`; `CM_FS_TEST` itself depends only on `FS_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_test` run with `CONFIG_TESTS_TESTSUITES`,
`CONFIG_CM_FS_TEST` and `CONFIG_TESTS_TESTSUITES_MOUNT_DIR="/tmp"` (tmpfs):
| Configuration | nuttx master 61ff9b8b308 | with apache/nuttx#21944 |
|---|---|---|
| `qemu-armv8a:nsh` (flat, arm64, QEMU HVF) | 46 of 48 pass: sendfile03 and
sendfile04 fail, "sendfile sent 0 but the offset moved 1536" | 48 of 48 pass |
| `rv-virt:nsh` (flat, rv32, QEMU TCG) | 46 of 48 pass: the same two fail |
48 of 48 pass |
| `sim:nsh` (flat, x86_64 Linux, the NuttX CI image) | 41 of 43 pass: the
same two fail | 43 of 43 pass |
All other cases give the same result before and after. Not run: kernel
builds, where `cmocka_fs_test` does not build on master (`fs_file_get_test.c`
calls the kernel function `file_get()`).
`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]