Add -cpu 4 to tests.

This commit is contained in:
Tom Wilkie
2015-07-06 13:06:23 +00:00
parent 0043e9f37d
commit d2d73c3cd4
5 changed files with 34 additions and 27 deletions

20
test/poll.go Normal file
View File

@@ -0,0 +1,20 @@
package test
import (
"testing"
"time"
)
// Poll repeatedly evaluates condition until we either timeout, or it suceeds.
func Poll(t *testing.T, d time.Duration, condition func() bool, msg string) {
deadline := time.Now().Add(d)
for {
if time.Now().After(deadline) {
t.Fatal(msg)
}
if condition() {
return
}
time.Sleep(d / 10)
}
}