1
0
mirror of https://github.com/golang/go synced 2024-11-26 23:41:37 -07:00

runtime: fix CgoRaceprof and CgoRaceSignal build failures

TestRaceProf and TestRaceSignal were changed to run on all platforms
that support the race detector as of CL 487575, but the testprogcgo
source files needed to run the test rely on POSIX threads and were
still build-constrained to only linux/amd64 and freebsd/amd64.

Since the C test program appears to require only POSIX APIs, update
the constraint to build the source file on all Unix platforms, and
update the tests to skip on Windows.

This may slightly increase testprogcgo build time on Unix platforms
that do not support the race detector.

Change-Id: I704dd496d475a3cd2e2da2a09c7d2e3bb8e96d02
Reviewed-on: https://go-review.googlesource.com/c/go/+/488115
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
This commit is contained in:
Bryan C. Mills 2023-04-24 10:18:07 -04:00 committed by Gopher Robot
parent c80cedec93
commit 5256f90c98
3 changed files with 15 additions and 4 deletions

View File

@ -371,6 +371,10 @@ func TestRaceProf(t *testing.T) {
if !platform.RaceDetectorSupported(runtime.GOOS, runtime.GOARCH) { if !platform.RaceDetectorSupported(runtime.GOOS, runtime.GOARCH) {
t.Skipf("skipping on %s/%s because race detector not supported", runtime.GOOS, runtime.GOARCH) t.Skipf("skipping on %s/%s because race detector not supported", runtime.GOOS, runtime.GOARCH)
} }
if runtime.GOOS == "windows" {
t.Skipf("skipping: test requires pthread support")
// TODO: Can this test be rewritten to use the C11 thread API instead?
}
testenv.MustHaveGoRun(t) testenv.MustHaveGoRun(t)
@ -399,6 +403,13 @@ func TestRaceSignal(t *testing.T) {
if !platform.RaceDetectorSupported(runtime.GOOS, runtime.GOARCH) { if !platform.RaceDetectorSupported(runtime.GOOS, runtime.GOARCH) {
t.Skipf("skipping on %s/%s because race detector not supported", runtime.GOOS, runtime.GOARCH) t.Skipf("skipping on %s/%s because race detector not supported", runtime.GOOS, runtime.GOARCH)
} }
if runtime.GOOS == "windows" {
t.Skipf("skipping: test requires pthread support")
// TODO: Can this test be rewritten to use the C11 thread API instead?
}
if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
testenv.SkipFlaky(t, 59807)
}
t.Parallel() t.Parallel()

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build (linux && amd64) || (freebsd && amd64) //go:build unix
// +build linux,amd64 freebsd,amd64 // +build unix
package main package main

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build (linux && amd64) || (freebsd && amd64) //go:build unix
// +build linux,amd64 freebsd,amd64 // +build unix
package main package main