Updated a few tests for darwin's special entry cache behavior.

geesefs-0-30-9
Aaron Jacobs 2015-03-17 16:24:15 +11:00
parent b9b5a4f5fc
commit 6fe7f54829
1 changed files with 24 additions and 13 deletions

View File

@ -19,6 +19,7 @@ import (
"log" "log"
"os" "os"
"path" "path"
"runtime"
"strings" "strings"
"syscall" "syscall"
"testing" "testing"
@ -353,12 +354,17 @@ func (t *EntryCachingTest) StatRenumberStat() {
// But after waiting for the entry cache to expire, we should see the new // But after waiting for the entry cache to expire, we should see the new
// IDs. // IDs.
time.Sleep(2 * t.lookupEntryTimeout) //
fooAfter, dirAfter, barAfter = t.statAll() // Note that the cache is not guaranteed to expire on darwin. See notes on
// fuse.MountConfig.EnableVnodeCaching.
if runtime.GOOS != "darwin" {
time.Sleep(2 * t.lookupEntryTimeout)
fooAfter, dirAfter, barAfter = t.statAll()
ExpectEq(t.fs.FooID(), getInodeID(fooAfter)) ExpectEq(t.fs.FooID(), getInodeID(fooAfter))
ExpectEq(t.fs.DirID(), getInodeID(dirAfter)) ExpectEq(t.fs.DirID(), getInodeID(dirAfter))
ExpectEq(t.fs.BarID(), getInodeID(barAfter)) ExpectEq(t.fs.BarID(), getInodeID(barAfter))
}
} }
func (t *EntryCachingTest) StatMtimeStat() { func (t *EntryCachingTest) StatMtimeStat() {
@ -395,16 +401,21 @@ func (t *EntryCachingTest) StatRenumberMtimeStat() {
// After waiting for the entry cache to expire, we should see fresh // After waiting for the entry cache to expire, we should see fresh
// everything. // everything.
time.Sleep(2 * t.lookupEntryTimeout) //
fooAfter, dirAfter, barAfter = t.statAll() // Note that the cache is not guaranteed to expire on darwin. See notes on
// fuse.MountConfig.EnableVnodeCaching.
if runtime.GOOS != "darwin" {
time.Sleep(2 * t.lookupEntryTimeout)
fooAfter, dirAfter, barAfter = t.statAll()
ExpectEq(t.fs.FooID(), getInodeID(fooAfter)) ExpectEq(t.fs.FooID(), getInodeID(fooAfter))
ExpectEq(t.fs.DirID(), getInodeID(dirAfter)) ExpectEq(t.fs.DirID(), getInodeID(dirAfter))
ExpectEq(t.fs.BarID(), getInodeID(barAfter)) ExpectEq(t.fs.BarID(), getInodeID(barAfter))
ExpectThat(fooAfter.ModTime(), timeutil.TimeEq(newMtime)) ExpectThat(fooAfter.ModTime(), timeutil.TimeEq(newMtime))
ExpectThat(dirAfter.ModTime(), timeutil.TimeEq(newMtime)) ExpectThat(dirAfter.ModTime(), timeutil.TimeEq(newMtime))
ExpectThat(barAfter.ModTime(), timeutil.TimeEq(newMtime)) ExpectThat(barAfter.ModTime(), timeutil.TimeEq(newMtime))
}
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////