From: Ian Lance Taylor Date: Wed, 29 Dec 2021 18:02:27 +0000 (-0800) Subject: misc/cgo/testsanitizers: don't fail asan test if no symbolizer X-Git-Tag: go1.18beta2~178 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8a306e205663cde672e9920e2e81db9d3615e6c0;p=gostls13.git misc/cgo/testsanitizers: don't fail asan test if no symbolizer Change-Id: Ic05c641bda3cc8f5292921c9b0c0d3df34f3bc48 Reviewed-on: https://go-review.googlesource.com/c/go/+/374794 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Cherry Mui --- diff --git a/misc/cgo/testsanitizers/asan_test.go b/misc/cgo/testsanitizers/asan_test.go index cd1e9f354b..ed58e5a183 100644 --- a/misc/cgo/testsanitizers/asan_test.go +++ b/misc/cgo/testsanitizers/asan_test.go @@ -55,10 +55,15 @@ func TestASAN(t *testing.T) { cmd := hangProneCmd(outPath) if tc.memoryAccessError != "" { - out, err := cmd.CombinedOutput() - if err != nil && strings.Contains(string(out), tc.memoryAccessError) { + outb, err := cmd.CombinedOutput() + out := string(outb) + if err != nil && strings.Contains(out, tc.memoryAccessError) { + // This string is output if the + // sanitizer library needs a + // symbolizer program and can't find it. + const noSymbolizer = "external symbolizer" // Check if -asan option can correctly print where the error occured. - if tc.errorLocation != "" && !strings.Contains(string(out), tc.errorLocation) { + if tc.errorLocation != "" && !strings.Contains(out, tc.errorLocation) && !strings.Contains(out, noSymbolizer) { t.Errorf("%#q exited without expected location of the error\n%s; got failure\n%s", strings.Join(cmd.Args, " "), tc.errorLocation, out) } return