diff options
Diffstat (limited to 'src/runtime/race/testdata')
| -rw-r--r-- | src/runtime/race/testdata/io_test.go | 2 | ||||
| -rw-r--r-- | src/runtime/race/testdata/mutex_test.go | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/runtime/race/testdata/io_test.go b/src/runtime/race/testdata/io_test.go index c5055f7837..3303cb0717 100644 --- a/src/runtime/race/testdata/io_test.go +++ b/src/runtime/race/testdata/io_test.go @@ -17,7 +17,7 @@ import ( func TestNoRaceIOFile(t *testing.T) { x := 0 - path, _ := os.MkdirTemp("", "race_test") + path := t.TempDir() fname := filepath.Join(path, "data") go func() { x = 42 diff --git a/src/runtime/race/testdata/mutex_test.go b/src/runtime/race/testdata/mutex_test.go index cbed2d370c..9dbed9a2c9 100644 --- a/src/runtime/race/testdata/mutex_test.go +++ b/src/runtime/race/testdata/mutex_test.go @@ -78,16 +78,23 @@ func TestNoRaceMutexPureHappensBefore(t *testing.T) { var mu sync.Mutex var x int16 = 0 _ = x + written := false ch := make(chan bool, 2) go func() { x = 1 mu.Lock() + written = true mu.Unlock() ch <- true }() go func() { - <-time.After(1e5) + time.Sleep(100 * time.Microsecond) mu.Lock() + for !written { + mu.Unlock() + time.Sleep(100 * time.Microsecond) + mu.Lock() + } mu.Unlock() x = 1 ch <- true |
