Worked around osxfuse/osxfuse#202.
parent
5908a93101
commit
64d7bf8a69
|
@ -244,7 +244,9 @@ type FileSystem interface {
|
||||||
//
|
//
|
||||||
// Note that one potentially significant case where this is *not* called is
|
// Note that one potentially significant case where this is *not* called is
|
||||||
// munmap(2). (Cf. http://goo.gl/7n1r9X, fuse-devel mailing list thread from
|
// munmap(2). (Cf. http://goo.gl/7n1r9X, fuse-devel mailing list thread from
|
||||||
// Han-Wen Nienhuys on 2014-10-08.)
|
// Han-Wen Nienhuys on 2014-10-08.) Even if users close(2) after writing to
|
||||||
|
// an mmap'd file, on OS X the contents are not immediately flushed (cf.
|
||||||
|
// https://github.com/osxfuse/osxfuse/issues/202).
|
||||||
//
|
//
|
||||||
// Because of cases like dup2(2), calls to FlushFile are not necessarily one
|
// Because of cases like dup2(2), calls to FlushFile are not necessarily one
|
||||||
// to one with calls to OpenFile. They should not be used for reference
|
// to one with calls to OpenFile. They should not be used for reference
|
||||||
|
|
|
@ -614,13 +614,19 @@ func (t *FlushFSTest) Mmap_MunmapBeforeClose() {
|
||||||
ExpectThat(t.getFlushes(), ElementsAre())
|
ExpectThat(t.getFlushes(), ElementsAre())
|
||||||
ExpectThat(t.getFsyncs(), ElementsAre())
|
ExpectThat(t.getFsyncs(), ElementsAre())
|
||||||
|
|
||||||
// Close the file. We should see a flush.
|
// Close the file. We should see a flush. On Darwin, this will contain out of
|
||||||
|
// date contents (cf. https://github.com/osxfuse/osxfuse/issues/202).
|
||||||
err = t.f1.Close()
|
err = t.f1.Close()
|
||||||
t.f1 = nil
|
t.f1 = nil
|
||||||
AssertEq(nil, err)
|
AssertEq(nil, err)
|
||||||
|
|
||||||
AssertThat(t.getFlushes(), ElementsAre("paco"))
|
if runtime.GOOS == "darwin" {
|
||||||
AssertThat(t.getFsyncs(), ElementsAre())
|
ExpectThat(t.getFlushes(), ElementsAre("taco"))
|
||||||
|
ExpectThat(t.getFsyncs(), ElementsAre())
|
||||||
|
} else {
|
||||||
|
ExpectThat(t.getFlushes(), ElementsAre("paco"))
|
||||||
|
ExpectThat(t.getFsyncs(), ElementsAre())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *FlushFSTest) Mmap_CloseBeforeMunmap() {
|
func (t *FlushFSTest) Mmap_CloseBeforeMunmap() {
|
||||||
|
|
Loading…
Reference in New Issue