From: Russ Cox Date: Thu, 17 Aug 2017 15:29:19 +0000 (-0400) Subject: [dev.boringcrypto] runtime/race: move TestRaceIssue5567 from sha1 to crc32 X-Git-Tag: go1.19beta1~484^2~194 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e0e2bbdd00966a5fdbae0fc2223651fae735e7e2;p=gostls13.git [dev.boringcrypto] runtime/race: move TestRaceIssue5567 from sha1 to crc32 If we substitute a SHA1 implementation where the entirety of the reading of the buffer is done in assembly (or C called from cgo), then the race detector cannot observe the race. Change to crc32 with a fake polynomial, in the hope that it will always be handled by Go code, not optimized assembly or cgo calls. Change-Id: I34e90b14ede6bc220ef686f6aef16b8e464b5cde Reviewed-on: https://go-review.googlesource.com/56510 Run-TryBot: Russ Cox TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/runtime/race/testdata/mop_test.go b/src/runtime/race/testdata/mop_test.go index c96acb9021..560a762315 100644 --- a/src/runtime/race/testdata/mop_test.go +++ b/src/runtime/race/testdata/mop_test.go @@ -6,9 +6,9 @@ package race_test import ( "bytes" - "crypto/sha1" "errors" "fmt" + "hash/crc32" "io" "os" "runtime" @@ -1904,7 +1904,7 @@ func TestRaceIssue5567(t *testing.T) { err = nil } }() - h := sha1.New() + h := crc32.New(crc32.MakeTable(0x12345678)) for b := range in { h.Write(b) }