}
func check(t *testing.T, source, golden string, mode checkMode) {
- // start a timer to produce a time-out signal
- tc := make(chan int)
- go func() {
- time.Sleep(10 * time.Second) // plenty of a safety margin, even for very slow machines
- tc <- 0
- }()
-
// run the test
cc := make(chan int)
go func() {
cc <- 0
}()
- // wait for the first finisher
+ // wait with timeout
select {
- case <-tc:
+ case <-time.After(10 * time.Second): // plenty of a safety margin, even for very slow machines
// test running past time out
t.Errorf("%s: running too slowly", source)
case <-cc: