Commit dffd0318 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse/test: shutdown FUSE before inspecting file system data.

This prevents data races flagged by the race detector.
parent ac219034
...@@ -192,7 +192,11 @@ func TestFSetAttr(t *testing.T) { ...@@ -192,7 +192,11 @@ func TestFSetAttr(t *testing.T) {
} }
fs := pathfs.NewLockingFileSystem(fSetAttrFs) fs := pathfs.NewLockingFileSystem(fSetAttrFs)
dir, clean := setupFAttrTest(t, fs) dir, clean := setupFAttrTest(t, fs)
defer clean() defer func() {
if clean != nil {
clean()
}
}()
fn := dir + "/file" fn := dir + "/file"
f, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY, 0755) f, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY, 0755)
...@@ -257,6 +261,9 @@ func TestFSetAttr(t *testing.T) { ...@@ -257,6 +261,9 @@ func TestFSetAttr(t *testing.T) {
t.Error("Fsync failed:", os.NewSyscallError("Fsync", code)) t.Error("Fsync failed:", os.NewSyscallError("Fsync", code))
} }
// Shutdown the FUSE FS so we can safely look at fSetAttrFs
clean()
clean = nil
if !fSetAttrFs.file.FsyncCalled { if !fSetAttrFs.file.FsyncCalled {
t.Error("Fsync was not called") t.Error("Fsync was not called")
} }
......
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