Revised "rmdir while open for reading" tests for Linux's behavior.
parent
4c280e82ac
commit
b064d6b33f
|
@ -734,12 +734,16 @@ func (t *MemFSTest) Rmdir_OpenedForReading() {
|
||||||
// https://github.com/bazillion/fuse/issues/66
|
// https://github.com/bazillion/fuse/issues/66
|
||||||
// ExpectEq(0, fi.Sys().(*syscall.Stat_t).Nlink)
|
// ExpectEq(0, fi.Sys().(*syscall.Stat_t).Nlink)
|
||||||
|
|
||||||
// Attempt to read from the directory. This should succeed even though it has
|
// Attempt to read from the directory. This shouldn't see any junk from the
|
||||||
// been unlinked, and we shouldn't see any junk from the new directory.
|
// new directory. It should either succeed with an empty result or should
|
||||||
|
// return ENOENT.
|
||||||
entries, err := f.Readdir(0)
|
entries, err := f.Readdir(0)
|
||||||
|
|
||||||
AssertEq(nil, err)
|
if err != nil {
|
||||||
ExpectThat(entries, ElementsAre())
|
ExpectThat(err, Error(HasSubstr("no such file")))
|
||||||
|
} else {
|
||||||
|
ExpectThat(entries, ElementsAre())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *MemFSTest) CaseSensitive() {
|
func (t *MemFSTest) CaseSensitive() {
|
||||||
|
|
|
@ -354,10 +354,14 @@ func (t *PosixTest) RmdirWhileOpenedForReading() {
|
||||||
ExpectEq("dir", fi.Name())
|
ExpectEq("dir", fi.Name())
|
||||||
ExpectEq(0, fi.Sys().(*syscall.Stat_t).Nlink)
|
ExpectEq(0, fi.Sys().(*syscall.Stat_t).Nlink)
|
||||||
|
|
||||||
// Attempt to read from the directory. This should succeed even though it has
|
// Attempt to read from the directory. This shouldn't see any junk from the
|
||||||
// been unlinked, and we shouldn't see any junk from the new directory.
|
// new directory. It should either succeed with an empty result or should
|
||||||
|
// return ENOENT.
|
||||||
entries, err := f.Readdir(0)
|
entries, err := f.Readdir(0)
|
||||||
|
|
||||||
AssertEq(nil, err)
|
if err != nil {
|
||||||
ExpectThat(entries, ElementsAre())
|
ExpectThat(err, Error(HasSubstr("no such file")))
|
||||||
|
} else {
|
||||||
|
ExpectThat(entries, ElementsAre())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue