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

Fix races in TestMemoryPressure.

parent f33f1679
......@@ -54,11 +54,11 @@ func TestMemoryPressure(t *testing.T) {
if err != nil {
t.Fatalf("mount failed: %v", err)
}
state.Debug = VerboseTest()
go state.Loop()
defer state.Unmount()
state.Debug = VerboseTest()
// Wait for FS to get ready.
os.Lstat(dir)
......@@ -75,7 +75,12 @@ func TestMemoryPressure(t *testing.T) {
}(i)
}
time.Sleep(100 * time.Millisecond)
state.reqMu.Lock()
bufs.lock.Lock()
created := bufs.createdBuffers + state.outstandingReadBufs
bufs.lock.Unlock()
state.reqMu.Unlock()
t.Logf("Have %d read bufs", state.outstandingReadBufs)
if created > _MAX_READERS {
......
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