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

   depends-on: apache/nuttx/pull/21682
   
   ## Summary
   
   This PR adds `testing/fs/inotest` (`inotest`), a test of the file serial 
numbers (`st_ino`, `d_ino`) and the device numbers (`st_dev`). Programs that 
walk a tree (`find`, `tar`, `cp -r`, `ftw()`) compare `st_dev` and `st_ino` of 
a directory with those of its parent directories, and `glob()` skips an entry 
with `d_ino` 0. No test in `testing/fs` checks these numbers.
   
   For each directory, and one level into its subdirectories on the same 
device, the test checks:
   
   - `st_ino` of the directory and of each entry is not 0, and a second 
`lstat()` gives the same `st_dev` and `st_ino`;
   - `d_ino` is not 0, and `readdir()` gives in `d_ino` the `st_ino` of 
`lstat()` (not for a mount point: there `readdir()` gives the number of the 
directory below it, as on Linux);
   - `open()` and `fstat()` of a file or a directory give the `st_dev` and 
`st_ino` of `lstat()`;
   - two entries of a directory have different `st_dev` and `st_ino`, except 
hard links;
   - a subdirectory does not have the `st_dev` and `st_ino` of its directory or 
of a parent directory.
   
   It also makes two files and a directory in a new tmpfs (with 
`CONFIG_FS_TMPFS`), checks them in the same way, and checks that a file keeps 
its `st_ino` when it is renamed.
   
   With no arguments the test checks `/`, `/dev` and `/proc` (skipped if 
absent) and the tmpfs. `inotest dir ...` checks other directories, and `inotest 
-w dir` makes the files in `dir`. The program prints each error and `inotest: 
DONE pass <n> fail <n> skip <n>`, and returns `EXIT_FAILURE` if a check fails.
   
   ## Impact
   
   Test only. New option `CONFIG_TESTING_INOTEST`, default n like the other 
tests in `testing/fs`.
   
   ## Testing
   
   QEMU, 1 CPU, with `CONFIG_FS_TMPFS` and `CONFIG_TESTING_INOTEST`. knsh: 
kernel build, the program from `/system/bin`. nsh: flat build, the program as a 
builtin. mps2-an500:knsh: protected build, QEMU TCG, procfs mounted by hand.
   
   | Configuration | nuttx master 03aea786390 | nuttx with apache/nuttx#21682 |
   |---|---|---|
   | `qemu-armv8a:knsh` (HVF) | pass 901, fail 186 | pass 475, fail 0 |
   | `qemu-armv8a:nsh` (HVF) | pass 419, fail 192 | pass 473, fail 0 |
   | `mps2-an500:knsh` (TCG) | pass 355, fail 159 | pass 405, fail 0 |
   
   On master the failures are: `/` and every path of `/proc` have `st_ino` 0; 
the subdirectories of `/proc` have the numbers of `/proc` (`find` sees a loop); 
`d_ino` of the procfs entries is 0; the tmpfs root has `st_dev` 0 and `st_ino` 
1, the same as a node of the pseudo file system; the mounted volumes look like 
directories of `/` (`st_dev` 0), so their roots are compared with the pseudo 
file system. The tmpfs files pass on master.
   
   On Linux (Fedora, glibc 2.43, gcc 16, the same source with an empty 
`nuttx/config.h` and `FAR` defined): `inotest -w /dev/shm / /dev /proc`: pass 
4456, fail 0; `inotest -w /tmp /tmp /sys /usr`: pass 6235, fail 0.
   
   `rv-virt:nsh` (rv32) with the test and `EXTRAFLAGS=-Werror`: OK. CMake 
(Ninja) build of `qemu-armv8a:nsh` with the test: OK, no warning.
   
   `tools/checkpatch.sh -c -u -m -g origin/master..HEAD` 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]

Reply via email to