fuse: remove 1 second pause during testing.

Change-Id: I6a708907ae5881b5225c0ef944b7cda7aed0cfba
This commit is contained in:
Brad Fitzpatrick 2012-03-18 18:29:41 -07:00
parent 9b9b837148
commit ad5df4d614
1 changed files with 17 additions and 12 deletions

View File

@ -48,18 +48,7 @@ func TestFuse(t *testing.T) {
} }
}() }()
// TODO: remove hard-coded 1 second here. try repeated from short waitForMount(t, dir)
// to increasingly long timeouts here, waiting for a good Stat.
time.Sleep(1 * time.Second)
probeEntry := *fuseRun
if probeEntry == "" {
probeEntry = fuseTests[0].name
}
_, err = os.Stat(dir + "/" + probeEntry)
if err != nil {
t.Fatalf("mount did not work")
return
}
for _, tt := range fuseTests { for _, tt := range fuseTests {
if *fuseRun == "" || *fuseRun == tt.name { if *fuseRun == "" || *fuseRun == tt.name {
@ -69,6 +58,22 @@ func TestFuse(t *testing.T) {
} }
} }
func waitForMount(t *testing.T, dir string) {
// Filename to wait for in dir:
probeEntry := *fuseRun
if probeEntry == "" {
probeEntry = fuseTests[0].name
}
for tries := 0; tries < 100; tries++ {
_, err := os.Stat(dir + "/" + probeEntry)
if err == nil {
return
}
time.Sleep(10 * time.Millisecond)
}
t.Fatalf("mount did not work")
}
var fuseTests = []struct { var fuseTests = []struct {
name string name string
node interface { node interface {