aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/race/testdata/mop_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/race/testdata/mop_test.go')
-rw-r--r--src/runtime/race/testdata/mop_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/race/testdata/mop_test.go b/src/runtime/race/testdata/mop_test.go
index 095ead6c9a..7f95051a8c 100644
--- a/src/runtime/race/testdata/mop_test.go
+++ b/src/runtime/race/testdata/mop_test.go
@@ -335,6 +335,8 @@ func TestRaceRange(t *testing.T) {
}
done <- true
}(i)
+ // Ensure the goroutine runs before we continue the loop.
+ runtime.Gosched()
}
for i := 0; i < N; i++ {
<-done
@@ -1727,13 +1729,16 @@ func TestNoRaceAsFunc4(t *testing.T) {
}
func TestRaceHeapParam(t *testing.T) {
+ done := make(chan bool)
x := func() (x int) {
go func() {
x = 42
+ done <- true
}()
return
}()
_ = x
+ <-done
}
func TestNoRaceEmptyStruct(t *testing.T) {