]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime/trace: fix TestTraceSymbolize networking
authorRuss Cox <rsc@golang.org>
Tue, 21 Jul 2015 00:20:05 +0000 (20:20 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 23 Jul 2015 05:37:15 +0000 (05:37 +0000)
We use 127.0.0.1 instead of localhost in Go networking tests.
The reporter of #11774 has localhost defined to be 120.192.83.162,
for reasons unknown.

Also, if TestTraceSymbolize calls Fatalf (for example because Listen
fails) then we need to stop the trace for future tests to work.
See failure log in #11774.

Fixes #11774.

Change-Id: Iceddb03a72d31e967acd2d559ecb78051f9c14b7
Reviewed-on: https://go-review.googlesource.com/12521
Reviewed-by: Rob Pike <r@golang.org>
src/runtime/trace/trace_stack_test.go

index 061274a4f686e529372f5865e4127de0de9b330d..1fca454ed017970ee417108814e7a9fc700f1182 100644 (file)
@@ -6,6 +6,7 @@ package trace_test
 
 import (
        "bytes"
+       "internal/testenv"
        "internal/trace"
        "net"
        "os"
@@ -21,13 +22,12 @@ import (
 // top uninteresting frames (runtime guts).
 func TestTraceSymbolize(t *testing.T) {
        skipTraceTestsIfNeeded(t)
-       if runtime.GOOS == "nacl" {
-               t.Skip("skipping: nacl tests fail with 'failed to symbolize trace: failed to start addr2line'")
-       }
+       testenv.MustHaveExec(t)
        buf := new(bytes.Buffer)
        if err := Start(buf); err != nil {
                t.Fatalf("failed to start tracing: %v", err)
        }
+       defer Stop() // in case of early return
 
        // Now we will do a bunch of things for which we verify stacks later.
        // It is impossible to ensure that a goroutine has actually blocked
@@ -78,7 +78,7 @@ func TestTraceSymbolize(t *testing.T) {
                cv.Wait()
                cv.L.Unlock()
        }()
-       ln, err := net.Listen("tcp", "localhost:0")
+       ln, err := net.Listen("tcp", "127.0.0.1:0")
        if err != nil {
                t.Fatalf("failed to listen: %v", err)
        }