]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/dist, misc/cgo/testsanitizers: enable msan tests on freebsd/amd64
authorDmitri Goutnik <dgoutnik@gmail.com>
Wed, 8 Jun 2022 15:56:36 +0000 (10:56 -0500)
committerDmitri Goutnik <dgoutnik@gmail.com>
Fri, 14 Oct 2022 12:48:50 +0000 (12:48 +0000)
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>
misc/cgo/testsanitizers/cc_test.go
misc/cgo/testsanitizers/msan_test.go
src/cmd/dist/test.go

index 3c67448dcdb7341306947b862924b628b38d0f15..af85f99325cc097c115b1d27a315c936adfdf607 100644 (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
        }
index 4043e3ecf9f4101f88d6f1e0e00095b12f66de4c..96397e0a876a3bbb8d8166083f231c1e1d5003da 100644 (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)
 
index fb0f1e13525afbdef21dc9eb992abab13350f722..54eb41c8a48148e5eb430f5453a77e89e41ff284 100644 (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" {