mirror of
https://github.com/golang/net.git
synced 2026-03-31 10:27:08 +09:00
internal/socket: pass race detection if CGO is not enabled
Follows up CL 205461 by recognizing that -race cannot run if CGO is not enabled, hence won't broadly fail the test. Fixes golang/go#35668 Change-Id: I6a47e6fc7c4afd0bf225fc9876c96b29efa863ce Reviewed-on: https://go-review.googlesource.com/c/net/+/207677 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
committed by
Emmanuel Odeke
parent
f9c8255933
commit
d06c31c94c
@@ -359,7 +359,9 @@ func main() {
|
||||
t.Fatalf("failed to write file: %v", err)
|
||||
}
|
||||
got, err := exec.Command(goBinary, "run", "-race", src).CombinedOutput()
|
||||
if !strings.Contains(string(got), "WARNING: DATA RACE") {
|
||||
if strings.Contains(string(got), "-race requires cgo") {
|
||||
t.Log("CGO is not enabled so can't use -race")
|
||||
} else if !strings.Contains(string(got), "WARNING: DATA RACE") {
|
||||
t.Errorf("race not detected for test %d: err:%v out:%s", i, err, string(got))
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user