diff options
| author | Alex Brainman <alex.brainman@gmail.com> | 2014-04-16 22:17:38 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-04-16 22:17:38 -0400 |
| commit | 06dc4e78c4c925f0e3763241b9695e6f3a36d8d6 (patch) | |
| tree | 5ab648994c58459f7bcef47e135615a06771faed /src/cmd/nm/nm_test.go | |
| parent | 387895f9ac5d34bfd32f23c1640b598c105bcb73 (diff) | |
| download | go-06dc4e78c4c925f0e3763241b9695e6f3a36d8d6.tar.xz | |
cmd/nm: windows pe handling fixes
- output absolute addresses, not relative;
- accept negative section numbers.
Update #6936
Fixes #7738
LGTM=rsc
R=golang-codereviews, bradfitz, ruiu, rsc
CC=golang-codereviews
https://golang.org/cl/85240046
Diffstat (limited to 'src/cmd/nm/nm_test.go')
| -rw-r--r-- | src/cmd/nm/nm_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/cmd/nm/nm_test.go b/src/cmd/nm/nm_test.go new file mode 100644 index 0000000000..ba9dc00f56 --- /dev/null +++ b/src/cmd/nm/nm_test.go @@ -0,0 +1,40 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "os" + "os/exec" + "path/filepath" + "runtime" + "testing" +) + +func TestNM(t *testing.T) { + out, err := exec.Command("go", "build", "-o", "testnm.exe", "cmd/nm").CombinedOutput() + if err != nil { + t.Fatalf("go build -o testnm.exe cmd/nm: %v\n%s", err, string(out)) + } + defer os.Remove("testnm.exe") + + testfiles := []string{ + "elf/testdata/gcc-386-freebsd-exec", + "elf/testdata/gcc-amd64-linux-exec", + "macho/testdata/gcc-386-darwin-exec", + "macho/testdata/gcc-amd64-darwin-exec", + "pe/testdata/gcc-amd64-mingw-exec", + "pe/testdata/gcc-386-mingw-exec", + "plan9obj/testdata/amd64-plan9-exec", + "plan9obj/testdata/386-plan9-exec", + } + for _, f := range testfiles { + exepath := filepath.Join(runtime.GOROOT(), "src", "pkg", "debug", f) + cmd := exec.Command("./testnm.exe", exepath) + out, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("go tool nm %v: %v\n%s", exepath, err, string(out)) + } + } +} |
