瀏覽代碼

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>
Emmanuel T Odeke 6 年之前
父節點
當前提交
d06c31c94c
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      internal/socket/socket_test.go

+ 3 - 1
internal/socket/socket_test.go

@@ -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))
 			}
 		})