runtime: skip testprogcgo tests in race mode on freebsd

These were just enabled by https://go.dev/cl/643897, but freebsd
unfortunately doesn't seem to support cgo + race mode by default.

For #73788.

Cq-Include-Trybots: luci.golang.try:gotip-freebsd-amd64-race
Change-Id: I6a6a636c06176ca746548d0588283b1429d7c6d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/674160
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Pratt 2025-05-19 17:28:45 -04:00 committed by Gopher Robot
parent ca3b474702
commit 2aac5a5cba
4 changed files with 135 additions and 0 deletions

View File

@ -5,6 +5,7 @@
package runtime_test
import (
"internal/race"
"internal/testenv"
"runtime"
"strings"
@ -35,6 +36,9 @@ func TestCoroCgoCallback(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("coro cgo callback tests not supported on Windows")
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
for _, test := range []string{
"CoroCgoIterCallback",
"CoroCgoIterCallbackYield",

View File

@ -35,6 +35,9 @@ func TestCgoSignalDeadlock(t *testing.T) {
if testing.Short() && runtime.GOOS == "windows" {
t.Skip("Skipping in short mode") // takes up to 64 seconds
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoSignalDeadlock")
want := "OK\n"
if got != want {
@ -43,6 +46,10 @@ func TestCgoSignalDeadlock(t *testing.T) {
}
func TestCgoTraceback(t *testing.T) {
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
got := runTestProg(t, "testprogcgo", "CgoTraceback")
want := "OK\n"
@ -57,6 +64,9 @@ func TestCgoCallbackGC(t *testing.T) {
case "plan9", "windows":
t.Skipf("no pthreads on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
if testing.Short() {
switch {
case runtime.GOOS == "dragonfly":
@ -80,6 +90,9 @@ func TestCgoCallbackPprof(t *testing.T) {
case "plan9", "windows":
t.Skipf("no pthreads on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
if testenv.CPUProfilingBroken() {
t.Skip("skipping on platform with broken profiling")
}
@ -95,6 +108,9 @@ func TestCgoExternalThreadPanic(t *testing.T) {
if runtime.GOOS == "plan9" {
t.Skipf("no pthreads on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoExternalThreadPanic")
want := "panic: BOOM"
if !strings.Contains(got, want) {
@ -109,6 +125,9 @@ func TestCgoExternalThreadSIGPROF(t *testing.T) {
case "plan9", "windows":
t.Skipf("no pthreads on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoExternalThreadSIGPROF", "GO_START_SIGPROF_THREAD=1")
if want := "OK\n"; got != want {
@ -123,6 +142,9 @@ func TestCgoExternalThreadSignal(t *testing.T) {
case "plan9", "windows":
t.Skipf("no pthreads on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoExternalThreadSignal")
if want := "OK\n"; got != want {
@ -138,6 +160,9 @@ func TestCgoDLLImports(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("skipping windows specific test")
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoDLLImportsMain")
want := "OK\n"
if got != want {
@ -152,6 +177,9 @@ func TestCgoExecSignalMask(t *testing.T) {
case "windows", "plan9":
t.Skipf("skipping signal mask test on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoExecSignalMask", "GOTRACEBACK=system")
want := "OK\n"
if got != want {
@ -166,6 +194,9 @@ func TestEnsureDropM(t *testing.T) {
case "windows", "plan9":
t.Skipf("skipping dropm test on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "EnsureDropM")
want := "OK\n"
if got != want {
@ -180,6 +211,9 @@ func TestCgoCheckBytes(t *testing.T) {
t.Parallel()
// Make sure we don't count the build time as part of the run time.
testenv.MustHaveGoBuild(t)
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
exe, err := buildTestProg(t, "testprogcgo")
if err != nil {
t.Fatal(err)
@ -218,6 +252,9 @@ func TestCgoCheckBytes(t *testing.T) {
func TestCgoPanicDeadlock(t *testing.T) {
t.Parallel()
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
// test issue 14432
got := runTestProg(t, "testprogcgo", "CgoPanicDeadlock")
want := "panic: cgo error\n\n"
@ -228,6 +265,9 @@ func TestCgoPanicDeadlock(t *testing.T) {
func TestCgoCCodeSIGPROF(t *testing.T) {
t.Parallel()
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoCCodeSIGPROF")
want := "OK\n"
if got != want {
@ -243,6 +283,9 @@ func TestCgoPprofCallback(t *testing.T) {
case "windows", "plan9":
t.Skipf("skipping cgo pprof callback test on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoPprofCallback")
want := "OK\n"
if got != want {
@ -264,6 +307,9 @@ func TestCgoCrashTraceback(t *testing.T) {
if asan.Enabled || msan.Enabled {
t.Skip("skipping test on ASAN/MSAN: triggers SIGSEGV in sanitizer runtime")
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CrashTraceback")
for i := 1; i <= 3; i++ {
if !strings.Contains(got, fmt.Sprintf("cgo symbolizer:%d", i)) {
@ -283,6 +329,9 @@ func TestCgoCrashTracebackGo(t *testing.T) {
default:
t.Skipf("not yet supported on %s", platform)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CrashTracebackGo")
for i := 1; i <= 3; i++ {
want := fmt.Sprintf("main.h%d", i)
@ -294,6 +343,9 @@ func TestCgoCrashTracebackGo(t *testing.T) {
func TestCgoTracebackContext(t *testing.T) {
t.Parallel()
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "TracebackContext")
want := "OK\n"
if got != want {
@ -303,6 +355,9 @@ func TestCgoTracebackContext(t *testing.T) {
func TestCgoTracebackContextPreemption(t *testing.T) {
t.Parallel()
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "TracebackContextPreemption")
want := "OK\n"
if got != want {
@ -312,6 +367,9 @@ func TestCgoTracebackContextPreemption(t *testing.T) {
func TestCgoTracebackContextProfile(t *testing.T) {
t.Parallel()
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "TracebackContextProfile")
want := "OK\n"
if got != want {
@ -324,6 +382,9 @@ func testCgoPprof(t *testing.T, buildArg, runArg, top, bottom string) {
if runtime.GOOS != "linux" || (runtime.GOARCH != "amd64" && runtime.GOARCH != "ppc64le" && runtime.GOARCH != "arm64" && runtime.GOARCH != "loong64") {
t.Skipf("not yet supported on %s/%s", runtime.GOOS, runtime.GOARCH)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
testenv.MustHaveGoRun(t)
var args []string
@ -413,6 +474,9 @@ func TestRaceProf(t *testing.T) {
t.Skipf("skipping: test requires pthread support")
// TODO: Can this test be rewritten to use the C11 thread API instead?
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
testenv.MustHaveGoRun(t)
@ -442,6 +506,9 @@ func TestRaceSignal(t *testing.T) {
if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
testenv.SkipFlaky(t, 60316)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
@ -468,6 +535,9 @@ func TestCgoNumGoroutine(t *testing.T) {
case "windows", "plan9":
t.Skipf("skipping numgoroutine test on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
got := runTestProg(t, "testprogcgo", "NumGoroutine")
want := "OK\n"
@ -486,6 +556,9 @@ func TestCatchPanic(t *testing.T) {
t.Skipf("crash() on darwin/amd64 doesn't raise SIGABRT")
}
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
testenv.MustHaveGoRun(t)
@ -513,6 +586,9 @@ func TestCgoLockOSThreadExit(t *testing.T) {
case "plan9", "windows":
t.Skipf("no pthreads on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
testLockOSThreadExit(t, "testprogcgo")
}
@ -537,6 +613,9 @@ func TestSigStackSwapping(t *testing.T) {
case "plan9", "windows":
t.Skipf("no sigaltstack on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
got := runTestProg(t, "testprogcgo", "SigStack")
want := "OK\n"
@ -557,6 +636,9 @@ func TestCgoTracebackSigpanic(t *testing.T) {
if asan.Enabled || msan.Enabled {
t.Skip("skipping test on ASAN/MSAN: triggers SIGSEGV in sanitizer runtime")
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
if runtime.GOOS == "ios" {
testenv.SkipFlaky(t, 59912)
}
@ -584,6 +666,9 @@ func TestCgoTracebackSigpanic(t *testing.T) {
}
func TestCgoPanicCallback(t *testing.T) {
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
got := runTestProg(t, "testprogcgo", "PanicCallback")
t.Log(got)
@ -675,6 +760,9 @@ func TestSegv(t *testing.T) {
if test == "SegvInCgo" && runtime.GOOS == "ios" {
testenv.SkipFlaky(t, 59947) // Don't even try, in case it times out.
}
if strings.HasSuffix(test, "InCgo") && runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
prog := "testprog"
@ -727,6 +815,9 @@ func TestAbortInCgo(t *testing.T) {
// without going through the runtime at all.
t.Skipf("no signals on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
got := runTestProg(t, "testprogcgo", "Abort")
@ -760,6 +851,9 @@ func TestEINTR(t *testing.T) {
t.Skip("skipping on linux-386; C sigaction does not preserve Go restorer")
}
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
output := runTestProg(t, "testprogcgo", "EINTR")
@ -775,6 +869,9 @@ func TestNeedmDeadlock(t *testing.T) {
case "plan9", "windows":
t.Skipf("no signals on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
output := runTestProg(t, "testprogcgo", "NeedmDeadlock")
want := "OK\n"
if output != want {
@ -783,6 +880,9 @@ func TestNeedmDeadlock(t *testing.T) {
}
func TestCgoNoCallback(t *testing.T) {
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoNoCallback")
want := "function marked with #cgo nocallback called back into Go"
if !strings.Contains(got, want) {
@ -794,6 +894,9 @@ func TestCgoNoEscape(t *testing.T) {
if asan.Enabled {
t.Skip("skipping test: ASAN forces extra heap allocations")
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoNoEscape")
want := "OK\n"
if got != want {
@ -803,6 +906,9 @@ func TestCgoNoEscape(t *testing.T) {
// Issue #63739.
func TestCgoEscapeWithMultiplePointers(t *testing.T) {
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoEscapeWithMultiplePointers")
want := "OK\n"
if got != want {
@ -811,6 +917,9 @@ func TestCgoEscapeWithMultiplePointers(t *testing.T) {
}
func TestCgoTracebackGoroutineProfile(t *testing.T) {
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
output := runTestProg(t, "testprogcgo", "GoroutineProfile")
want := "OK\n"
if output != want {
@ -823,6 +932,9 @@ func TestCgoSigfwd(t *testing.T) {
if !goos.IsUnix {
t.Skipf("no signals on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "CgoSigfwd", "GO_TEST_CGOSIGFWD=1")
if want := "OK\n"; got != want {
@ -831,6 +943,9 @@ func TestCgoSigfwd(t *testing.T) {
}
func TestDestructorCallback(t *testing.T) {
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
got := runTestProg(t, "testprogcgo", "DestructorCallback")
if want := "OK\n"; got != want {
@ -844,6 +959,9 @@ func TestEnsureBindM(t *testing.T) {
case "windows", "plan9":
t.Skipf("skipping bindm test on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "EnsureBindM")
want := "OK\n"
if got != want {
@ -861,6 +979,9 @@ func TestStackSwitchCallback(t *testing.T) {
// ASAN prints this as a warning.
t.Skip("skipping test on ASAN because ASAN doesn't fully support makecontext/swapcontext functions")
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
got := runTestProg(t, "testprogcgo", "StackSwitchCallback")
skip := "SKIP\n"
if got == skip {
@ -876,6 +997,9 @@ func TestCgoToGoCallGoexit(t *testing.T) {
if runtime.GOOS == "plan9" || runtime.GOOS == "windows" {
t.Skipf("no pthreads on %s", runtime.GOOS)
}
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
output := runTestProg(t, "testprogcgo", "CgoToGoCallGoexit")
if !strings.Contains(output, "runtime.Goexit called in a thread that was not created by the Go runtime") {
t.Fatalf("output should contain %s, got %s", "runtime.Goexit called in a thread that was not created by the Go runtime", output)

View File

@ -229,6 +229,9 @@ func testCrashHandler(t *testing.T, cgo bool) {
}
var output string
if cgo {
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
output = runTestProg(t, "testprogcgo", "Crash")
} else {
output = runTestProg(t, "testprog", "Crash")

View File

@ -9,6 +9,7 @@ package runtime_test
import (
"bytes"
"fmt"
"internal/race"
"internal/testenv"
"internal/trace"
"io"
@ -26,6 +27,9 @@ func TestTraceUnwindCGO(t *testing.T) {
t.Skip("-quick")
}
testenv.MustHaveGoBuild(t)
if runtime.GOOS == "freebsd" && race.Enabled {
t.Skipf("race + cgo freebsd not supported. See https://go.dev/issue/73788.")
}
t.Parallel()
exe, err := buildTestProg(t, "testprogcgo")