Skip to content

Commit 1298735

Browse files
dmgkpull[bot]
authored andcommitted
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 66c0651 commit 1298735

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

misc/cgo/testsanitizers/cc_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,8 @@ func mSanSupported(goos, goarch string) bool {
540540
switch goos {
541541
case "linux":
542542
return goarch == "amd64" || goarch == "arm64"
543+
case "freebsd":
544+
return goarch == "amd64"
543545
default:
544546
return false
545547
}

misc/cgo/testsanitizers/msan_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ func TestMSAN(t *testing.T) {
2424
}
2525

2626
t.Parallel()
27-
requireOvercommit(t)
27+
// Overcommit is enabled by default on FreeBSD (vm.overcommit=0, see tuning(7)).
28+
// Do not skip tests with stricter overcommit settings unless testing shows that FreeBSD has similar issues.
29+
if goos == "linux" {
30+
requireOvercommit(t)
31+
}
2832
config := configure("memory")
2933
config.skipIfCSanitizerBroken(t)
3034

src/cmd/dist/test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,9 @@ func (t *tester) registerTests() {
832832
if gohostos == "linux" && (goarch == "amd64" || goarch == "ppc64le") {
833833
t.registerTest("testasan", "../misc/cgo/testasan", "go", "run", ".")
834834
}
835-
if goos == "linux" {
836-
// because syscall.SysProcAttr struct used in misc/cgo/testsanitizers is only built on linux.
835+
if goos == "linux" || (goos == "freebsd" && goarch == "amd64") {
836+
// because Pdeathsig of syscall.SysProcAttr struct used in misc/cgo/testsanitizers is only
837+
// supported on Linux and FreeBSD.
837838
t.registerHostTest("testsanitizers", "../misc/cgo/testsanitizers", "misc/cgo/testsanitizers", ".")
838839
}
839840
if t.hasBash() && goos != "android" && !t.iOS() && gohostos != "windows" {

0 commit comments

Comments
 (0)