cmd/dist, misc/cgo/testsanitizers: enable msan tests on freebsd/amd64

Adjust os/arch checks to enable msan tests on freebsd/amd64.

R=go1.20

For #53298

Change-Id: I3d0f5259db73d526d006a12de5ba6284528cf819
Reviewed-on: https://go-review.googlesource.com/c/go/+/411276
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Dmitri Goutnik 2022-06-08 10:56:36 -05:00
parent e56c93f07b
commit a4b4717f23
3 changed files with 10 additions and 3 deletions

View File

@ -540,6 +540,8 @@ func mSanSupported(goos, goarch string) bool {
switch goos {
case "linux":
return goarch == "amd64" || goarch == "arm64"
case "freebsd":
return goarch == "amd64"
default:
return false
}

View File

@ -24,7 +24,11 @@ func TestMSAN(t *testing.T) {
}
t.Parallel()
requireOvercommit(t)
// Overcommit is enabled by default on FreeBSD (vm.overcommit=0, see tuning(7)).
// Do not skip tests with stricter overcommit settings unless testing shows that FreeBSD has similar issues.
if goos == "linux" {
requireOvercommit(t)
}
config := configure("memory")
config.skipIfCSanitizerBroken(t)

View File

@ -832,8 +832,9 @@ func (t *tester) registerTests() {
if gohostos == "linux" && (goarch == "amd64" || goarch == "ppc64le") {
t.registerTest("testasan", "../misc/cgo/testasan", "go", "run", ".")
}
if goos == "linux" {
// because syscall.SysProcAttr struct used in misc/cgo/testsanitizers is only built on linux.
if goos == "linux" || (goos == "freebsd" && goarch == "amd64") {
// because Pdeathsig of syscall.SysProcAttr struct used in misc/cgo/testsanitizers is only
// supported on Linux and FreeBSD.
t.registerHostTest("testsanitizers", "../misc/cgo/testsanitizers", "misc/cgo/testsanitizers", ".")
}
if t.hasBash() && goos != "android" && !t.iOS() && gohostos != "windows" {