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

   depends-on: apache/nuttx/pull/21907
   
   ## Summary
   
   Add a test of the current directory to ostest, `cwd_test()` in 
`testing/ostest/cwd.c`. The current directory is an attribute of the task 
group. The test checks that `getcwd()` gives the directory of `chdir()`, that 
`setenv()` and `unsetenv()` of `PWD` do not change it, that `chdir()` in a 
thread changes it for the task group, that `getcwd()` gives the new name after 
`rename()` of the directory, and that `getcwd()` fails with `ENOENT` after 
`rmdir()` of the directory, also when a new directory of the same name appears.
   
   The test checks apache/nuttx#21907 ("fs: Keep the current directory in the 
task group."). Merge this PR after it, and after apache/nuttx-apps#4061 (NSH 
sets `PWD`).
   
   ## Impact
   
   Only ostest. The test uses directories of the pseudo file system 
(`/ostest_cwd`, `/ostest_cwd2`), so it needs no mounted file system. It is 
built when `CONFIG_DISABLE_PSEUDOFS_OPERATIONS` is not set (Make and CMake). 
The thread case needs pthreads, the `PWD` cases the environment. At the end the 
test goes back to its directory and `PWD`, and removes its directories.
   
   ## Testing
   
   QEMU with HVF, ostest with this test:
   
   | Configuration | nuttx master 46066440966 | with apache/nuttx#21907 (and 
apache/nuttx-apps#4061) |
   |---|---|---|
   | qemu-armv8a:knsh (kernel build) | 4 errors: setenv PWD, unsetenv PWD, 
rename, rmdir; ostest asserts | `cwd_test: PASS`, ostest exits with status 0 |
   | qemu-armv8a:nsh (flat build) | the same 4 errors; ostest asserts | 
`cwd_test: PASS`, ostest exits with status 0 |
   
   The thread case passes on master too: the threads of a task group already 
shared the directory through the environment. It stays as a guard.
   
   `tools/checkpatch.sh -c -u -m -g` of nuttx passes on the commit.
   


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