summaryrefslogtreecommitdiff
path: root/src/runtime/pprof
diff options
context:
space:
mode:
authorElias Naur <elias.naur@gmail.com>2017-03-25 14:54:28 +0100
committerElias Naur <elias.naur@gmail.com>2017-03-27 08:55:14 +0000
commitaa4c2ca316b1553ae65a3e8afb4cf862e11b78d0 (patch)
treed338a7003015b9aaaf72ae83975973e92175a499 /src/runtime/pprof
parent4909ecc46266b5afa121ef5f29382172188dbc36 (diff)
downloadgo-git-aa4c2ca316b1553ae65a3e8afb4cf862e11b78d0.tar.gz
runtime/pprof: fix proto tests on NetBSD
The proto_test tests are failing on NetBSD: https://build.golang.org/log/a3a577144ac48c6ef8e384ce6a700ad30549fb78 the failures seem similar to previous failures on Android: https://build.golang.org/log/b5786e0cd6d5941dc37b6a50be5172f6b99e22f0 The Android failures where fixed by CL 37896. This CL is an attempt to fix the NetBSD failures with a similar fix. Change-Id: I3834afa5b32303ca226e6a31f0f321f66fef9a3f Reviewed-on: https://go-review.googlesource.com/38637 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/pprof')
-rw-r--r--src/runtime/pprof/proto_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/runtime/pprof/proto_test.go b/src/runtime/pprof/proto_test.go
index 7b0fa95d71..2f10419147 100644
--- a/src/runtime/pprof/proto_test.go
+++ b/src/runtime/pprof/proto_test.go
@@ -70,7 +70,8 @@ func f2() { f2() }
// testPCs returns two PCs and two corresponding memory mappings
// to use in test profiles.
func testPCs(t *testing.T) (addr1, addr2 uint64, map1, map2 *profile.Mapping) {
- if runtime.GOOS == "linux" || runtime.GOOS == "android" {
+ switch runtime.GOOS {
+ case "linux", "android", "netbsd":
// Figure out two addresses from /proc/self/maps.
mmap, err := ioutil.ReadFile("/proc/self/maps")
if err != nil {
@@ -91,7 +92,7 @@ func testPCs(t *testing.T) (addr1, addr2 uint64, map1, map2 *profile.Mapping) {
addr2 = mprof.Mapping[1].Start
map2 = mprof.Mapping[1]
map2.BuildID, _ = elfBuildID(map2.File)
- } else {
+ default:
addr1 = uint64(funcPC(f1))
addr2 = uint64(funcPC(f2))
}