Revised "rmdir while open for reading" tests for Linux's behavior.

geesefs-0-30-9
Aaron Jacobs 2015-03-16 13:56:21 +11:00
parent 4c280e82ac
commit b064d6b33f
2 changed files with 16 additions and 8 deletions

View File

@ -734,12 +734,16 @@ func (t *MemFSTest) Rmdir_OpenedForReading() {
// https://github.com/bazillion/fuse/issues/66
// ExpectEq(0, fi.Sys().(*syscall.Stat_t).Nlink)
// Attempt to read from the directory. This should succeed even though it has
// been unlinked, and we shouldn't see any junk from the new directory.
// Attempt to read from the directory. This shouldn't see any junk from the
// new directory. It should either succeed with an empty result or should
// return ENOENT.
entries, err := f.Readdir(0)
AssertEq(nil, err)
ExpectThat(entries, ElementsAre())
if err != nil {
ExpectThat(err, Error(HasSubstr("no such file")))
} else {
ExpectThat(entries, ElementsAre())
}
}
func (t *MemFSTest) CaseSensitive() {

View File

@ -354,10 +354,14 @@ func (t *PosixTest) RmdirWhileOpenedForReading() {
ExpectEq("dir", fi.Name())
ExpectEq(0, fi.Sys().(*syscall.Stat_t).Nlink)
// Attempt to read from the directory. This should succeed even though it has
// been unlinked, and we shouldn't see any junk from the new directory.
// Attempt to read from the directory. This shouldn't see any junk from the
// new directory. It should either succeed with an empty result or should
// return ENOENT.
entries, err := f.Readdir(0)
AssertEq(nil, err)
ExpectThat(entries, ElementsAre())
if err != nil {
ExpectThat(err, Error(HasSubstr("no such file")))
} else {
ExpectThat(entries, ElementsAre())
}
}