Skip to content

Commit 8a306e2

Browse files
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 <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
1 parent 91e7821 commit 8a306e2

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

misc/cgo/testsanitizers/asan_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,15 @@ func TestASAN(t *testing.T) {
5555

5656
cmd := hangProneCmd(outPath)
5757
if tc.memoryAccessError != "" {
58-
out, err := cmd.CombinedOutput()
59-
if err != nil && strings.Contains(string(out), tc.memoryAccessError) {
58+
outb, err := cmd.CombinedOutput()
59+
out := string(outb)
60+
if err != nil && strings.Contains(out, tc.memoryAccessError) {
61+
// This string is output if the
62+
// sanitizer library needs a
63+
// symbolizer program and can't find it.
64+
const noSymbolizer = "external symbolizer"
6065
// Check if -asan option can correctly print where the error occured.
61-
if tc.errorLocation != "" && !strings.Contains(string(out), tc.errorLocation) {
66+
if tc.errorLocation != "" && !strings.Contains(out, tc.errorLocation) && !strings.Contains(out, noSymbolizer) {
6267
t.Errorf("%#q exited without expected location of the error\n%s; got failure\n%s", strings.Join(cmd.Args, " "), tc.errorLocation, out)
6368
}
6469
return

0 commit comments

Comments
 (0)