Skip to content

Commit d06c31c

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent f9c8255 commit d06c31c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/socket/socket_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,9 @@ func main() {
359359
t.Fatalf("failed to write file: %v", err)
360360
}
361361
got, err := exec.Command(goBinary, "run", "-race", src).CombinedOutput()
362-
if !strings.Contains(string(got), "WARNING: DATA RACE") {
362+
if strings.Contains(string(got), "-race requires cgo") {
363+
t.Log("CGO is not enabled so can't use -race")
364+
} else if !strings.Contains(string(got), "WARNING: DATA RACE") {
363365
t.Errorf("race not detected for test %d: err:%v out:%s", i, err, string(got))
364366
}
365367
})

0 commit comments

Comments
 (0)