Commit b064d6b3 authored by Aaron Jacobs's avatar Aaron Jacobs

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

parent 4c280e82
......@@ -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() {
......
......@@ -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())
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment