mirror of https://github.com/perkeep/perkeep.git
fuse: remove 1 second pause during testing.
Change-Id: I6a708907ae5881b5225c0ef944b7cda7aed0cfba
This commit is contained in:
parent
9b9b837148
commit
ad5df4d614
|
@ -48,18 +48,7 @@ func TestFuse(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
// TODO: remove hard-coded 1 second here. try repeated from short
|
||||
// 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
|
||||
}
|
||||
waitForMount(t, dir)
|
||||
|
||||
for _, tt := range fuseTests {
|
||||
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 {
|
||||
name string
|
||||
node interface {
|
||||
|
|
Loading…
Reference in New Issue