diff options
| author | Ian Lance Taylor <iant@golang.org> | 2022-03-11 18:29:37 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2022-03-12 23:32:36 +0000 |
| commit | 842d37ee5f86f12aa096b750adbd2debd9129fcb (patch) | |
| tree | 71d14c23c405bcb7ee88cad8ea94fe0a90b37c9a /src/runtime | |
| parent | baf61e4a67789e20f019507287a324cca06bed42 (diff) | |
| download | go-842d37ee5f86f12aa096b750adbd2debd9129fcb.tar.xz | |
syscall: add race annotations to Pread and Pwrite
Fixes #51618
Change-Id: Ife894d8c313dce8c4929f40fa0ac90a069f77a89
Reviewed-on: https://go-review.googlesource.com/c/go/+/391954
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/race/testdata/mop_test.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/runtime/race/testdata/mop_test.go b/src/runtime/race/testdata/mop_test.go index 2d093739df..d05a443f62 100644 --- a/src/runtime/race/testdata/mop_test.go +++ b/src/runtime/race/testdata/mop_test.go @@ -1896,6 +1896,14 @@ func TestRaceNestedStruct(t *testing.T) { } func TestRaceIssue5567(t *testing.T) { + testRaceRead(t, false) +} + +func TestRaceIssue51618(t *testing.T) { + testRaceRead(t, true) +} + +func testRaceRead(t *testing.T, pread bool) { defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4)) in := make(chan []byte) res := make(chan error) @@ -1914,7 +1922,11 @@ func TestRaceIssue5567(t *testing.T) { var n, total int b := make([]byte, 17) // the race is on b buffer for err == nil { - n, err = f.Read(b) + if pread { + n, err = f.ReadAt(b, int64(total)) + } else { + n, err = f.Read(b) + } total += n if n > 0 { in <- b[:n] |
