Skip to content

Commit

Permalink
[dev.boringcrypto] runtime/race: move TestRaceIssue5567 from sha1 to …
Browse files Browse the repository at this point in the history
…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 <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
rsc committed Aug 17, 2017
1 parent fe02ba3 commit e0e2bbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/race/testdata/mop_test.go
Expand Up @@ -6,9 +6,9 @@ package race_test

import (
"bytes"
"crypto/sha1"
"errors"
"fmt"
"hash/crc32"
"io"
"os"
"runtime"
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit e0e2bbd

Please sign in to comment.