From 579eb79f62d92db872d730f5fe954ca2b7dce8ae Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Mon, 28 Oct 2024 17:23:40 +0000 Subject: all: skip and fix various tests with -asan and -msan First, skip all the allocation count tests. In some cases this aligns with existing skips for -race, but in others we've got new issues. These are debug modes, so some performance loss is expected, and this is clearly no worse than today where the tests fail. Next, skip internal linking and static linking tests for msan and asan. With asan we get an explicit failure that neither are supported by the C and/or Go compilers. With msan, we only get the Go compiler telling us internal linking is unavailable. With static linking, we segfault instead. Filed #70080 to track that. Next, skip some malloc tests with asan that don't quite work because of the redzone. This is because of some sizeclass assumptions that get broken with the redzone and the fact that the tiny allocator is effectively disabled (again, due to the redzone). Next, skip some runtime/pprof tests with asan, because of extra allocations. Next, skip some malloc tests with asan that also fail because of extra allocations. Next, fix up memstats accounting for arenas when asan is enabled. There is a bug where more is added to the stats than subtracted. This also simplifies the accounting a little. Next, skip race tests with msan or asan enabled; they're mutually incompatible. Fixes #70054. Fixes #64256. Fixes #64257. For #70079. For #70080. Change-Id: I99c02a0b9d621e44f1f918b307aa4a4944c3ec60 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-asan-clang15,gotip-linux-amd64-msan-clang15 Reviewed-on: https://go-review.googlesource.com/c/go/+/622855 Reviewed-by: Cherry Mui TryBot-Bypass: Michael Knyszek --- src/encoding/binary/binary_test.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/encoding/binary') diff --git a/src/encoding/binary/binary_test.go b/src/encoding/binary/binary_test.go index 9e5fed53b7..e0c5c0d9e0 100644 --- a/src/encoding/binary/binary_test.go +++ b/src/encoding/binary/binary_test.go @@ -7,6 +7,7 @@ package binary import ( "bytes" "fmt" + "internal/asan" "io" "math" "reflect" @@ -710,6 +711,9 @@ func TestNoFixedSize(t *testing.T) { } func TestAppendAllocs(t *testing.T) { + if asan.Enabled { + t.Skip("test allocates more with -asan; see #70079") + } buf := make([]byte, 0, Size(&s)) var err error allocs := testing.AllocsPerRun(1, func() { @@ -745,6 +749,9 @@ var sizableTypes = []any{ } func TestSizeAllocs(t *testing.T) { + if asan.Enabled { + t.Skip("test allocates more with -asan; see #70079") + } for _, data := range sizableTypes { t.Run(fmt.Sprintf("%T", data), func(t *testing.T) { // Size uses a sync.Map behind the scenes. The slow lookup path of -- cgit v1.3