| // Copyright 2015 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| func TestRandomScheduling(t *testing.T) { |
| // Scheduler is most consistent with GOMAXPROCS=1. |
| // Use that to make the test most likely to fail. |
| defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(1)) |
| if !reflect.DeepEqual(out[0], out[i]) { |
| return // found a different order |
| fmt.Fprintf(&buf, "%v\n", out[i]) |
| t.Fatalf("consistent goroutine execution order:\n%v", buf.String()) |