]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/testsanitizers: don't fail asan test if no symbolizer
authorIan Lance Taylor <iant@golang.org>
Wed, 29 Dec 2021 18:02:27 +0000 (10:02 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 29 Dec 2021 19:23:11 +0000 (19:23 +0000)
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>
misc/cgo/testsanitizers/asan_test.go

index cd1e9f354b127bf6cbf3b1370a266250c43d86eb..ed58e5a183fc365f1427bd285ee634c8fcc67045 100644 (file)
@@ -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