Commit 1fc114c7 authored by Russ Cox's avatar Russ Cox

cmd/addr2line: simplify windows test

Change-Id: I0fcc35f43bc6059e6203af6134319cfc060c4b9a
Reviewed-on: https://go-review.googlesource.com/11085Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 08e25fc1
...@@ -52,15 +52,9 @@ func runAddr2Line(t *testing.T, exepath, addr string) (funcname, path, lineno st ...@@ -52,15 +52,9 @@ func runAddr2Line(t *testing.T, exepath, addr string) (funcname, path, lineno st
funcname = f[0] funcname = f[0]
pathAndLineNo := f[1] pathAndLineNo := f[1]
f = strings.Split(pathAndLineNo, ":") f = strings.Split(pathAndLineNo, ":")
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" && len(f) == 3 {
switch len(f) { // Reattach drive letter.
case 2: f = []string{f[0] + ":" + f[1], f[2]}
return funcname, f[0], f[1]
case 3:
return funcname, f[0] + ":" + f[1], f[2]
default:
t.Fatalf("no line number found in %q", pathAndLineNo)
}
} }
if len(f) != 2 { if len(f) != 2 {
t.Fatalf("no line number found in %q", pathAndLineNo) t.Fatalf("no line number found in %q", pathAndLineNo)
...@@ -86,12 +80,12 @@ func testAddr2Line(t *testing.T, exepath, addr string) { ...@@ -86,12 +80,12 @@ func testAddr2Line(t *testing.T, exepath, addr string) {
if !os.SameFile(fi1, fi2) { if !os.SameFile(fi1, fi2) {
t.Fatalf("addr2line_test.go and %s are not same file", srcPath) t.Fatalf("addr2line_test.go and %s are not same file", srcPath)
} }
if srcLineNo != "95" { if srcLineNo != "89" {
t.Fatalf("line number = %v; want 95", srcLineNo) t.Fatalf("line number = %v; want 89", srcLineNo)
} }
} }
// This is line 94. The test depends on that. // This is line 88. The test depends on that.
func TestAddr2Line(t *testing.T) { func TestAddr2Line(t *testing.T) {
testenv.MustHaveGoBuild(t) testenv.MustHaveGoBuild(t)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment