Closed chrisd8088 closed 5 years ago
WIP on stat-tests
branch for getattr
.
I've done a few -- todo is still chown
(awkward to test because we need to chown
something on the lower filesystem as the test runner; do we assume sudo
is usable and OK to use?), utimens
, truncate
, xattrs. Tests should run on both files and symlinks.
Wowser! This is great, @kivikakk! I figured this might be somewhere down the road for us and I just didn't want to forget about it -- hence the issue -- but you've already made huge progress! ✨🙇
As for chown
, what about something like a little shell function which did an id -nG
, picked another group the user belonged to (assuming there is one), and then just did a chgrp
on a file to that group? And maybe in the case where the user has only one group, the test could report a "skip" instead. I'm thinking of a format something like this [git test](https://github.com/git/git/blob/master/t/t1304-default-acl.sh:
if test ...; then
test_set_prereq OTHER_GROUP
fi
test_expect_success OTHER_GROUP 'test chgrp' '...'
One could also just skip all remaining tests with something like:
if ! test_have_prereq OTHER_GROUP
then
skip_all='skipping chown tests, no additional Unix group available'
test_done
fi
Does that seem reasonable?
As for
chown
, what about something like a little shell function which did anid -nG
, picked another group the user belonged to (assuming there is one), and then just did achgrp
on a file to that group?
I was thinking this would rarely fire because most users are only members of their own group, but then I forgot the state of Linux these days:
$ id -nG
kivikakk cdrom floppy sudo audio dip video plugdev netdev bluetooth scanner docker
This looks great, thank you!
Finally done in https://github.com/github/libprojfs/pull/13/commits/dde2c78c3bc768d6741cd07faeb945c02b303aea. God I hate shell scripting.
Ensure all FUSE operations have a corresponding test in a test script (or program, in cases where a shell command is insufficient to test a particular operation). For example:
chmod()
,chown()
,fsstat()
, etc.