Repository navigation
Conversation
test_nuttx_fs_file_get01 calls file_get() and file_put() and reads struct file. These are kernel functions, not system calls. A program of a protected or kernel build cannot call them, so cmocka_fs_test does not build there: - kernel build: stdio.h does not include nuttx/fs/fs.h, and the case does not compile (implicit declaration of file_get and file_put, invalid use of undefined type struct file). - protected build: the user blob does not link (undefined reference to file_get2 and file_put). Build the case and its entry in the test list only with CONFIG_BUILD_FLAT. A flat build still runs it. The other fs cases use only the POSIX interface and run in all build modes. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
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
cmocka_fs_test(CONFIG_CM_FS_TEST) does not build in a protected or a kernel build. The casetest_nuttx_fs_file_get01callsfile_get()andfile_put()and readsstruct file. These are kernel functions, not system calls, so a user program cannot use them.stdio.hdoes not includenuttx/fs/fs.hfor programs, sofs_file_get_test.cdoes not compile: "implicit declaration of function 'file_get'", "implicit declaration of function 'file_put'", "invalid use of undefined type 'struct file'".file_get2'", "undefined reference tofile_put'".This PR builds the case and its entry in the test list only with
CONFIG_BUILD_FLAT, as the suite already does withCONFIG_ARCH_SIMfor other cases. The other 45 cases use only the POSIX interface and do not change.Impact
Flat builds: no change,
test_nuttx_fs_file_get01still runs. Protected and kernel builds:cmocka_fs_testbuilds and runs without this one case. The change is in the C sources only, so the Make and the CMake builds both get it.CI runs the fs cases one by one from apache/nuttx-ntfc-testing (
fs/fs/test_fs_integration.py, which namestest_nuttx_fs_file_get01). The configurations withCONFIG_CM_FS_TEST(rv-virt:citest,sim:citest) are flat builds, so the CI run does not change.Testing
CONFIG_TESTS_TESTSUITES,CONFIG_CM_FS_TEST,CONFIG_TESTS_TESTSUITES_MOUNT_DIR="/tmp"(tmpfs), nuttx master e9eefaa0e9a:qemu-armv8a:nsh(flat, arm64, QEMU HVF)file_get01includedqemu-armv8a:knsh(kernel, arm64, QEMU HVF)rv-virt:knsh64(kernel, rv64)rv-virt:pnsh64(protected, rv64)On
qemu-armv8a:knshthe run usedCONFIG_TLS_LOG2_MAXSTACK=14, because the default stack of the suite (16384) is larger than the 8 KiB limit of that configuration and exec fails withEINVAL. The table uses the Make build. The CMake build ofqemu-armv8a:nshandrv-virt:pnsh64with this PR passes too. ostest passes onqemu-armv8a:knshandqemu-armv8a:nsh.tools/checkpatch.sh -c -u -m -gpasses.