]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/pprof: do not require a GOROOT/src prefix in tests
authorBryan C. Mills <bcmills@google.com>
Thu, 10 Mar 2022 15:41:54 +0000 (10:41 -0500)
committerBryan Mills <bcmills@google.com>
Wed, 16 Mar 2022 15:20:22 +0000 (15:20 +0000)
When paths are trimmed, the reported file locations begin with the
package import path (not GOROOT/src).

Updates #51461

Change-Id: Idbd408a02e8d03329d10e30b0b08263e69e66285
Reviewed-on: https://go-review.googlesource.com/c/go/+/391812
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/pprof/mprof_test.go
src/runtime/pprof/pprof_test.go

index 665487a7c4fc946a535b36afc190468e6d41a8db..391588d4acd0ec61fda9dd562f4dfb033fa52b06 100644 (file)
@@ -93,31 +93,31 @@ func TestMemoryProfiler(t *testing.T) {
        }{{
                stk: []string{"runtime/pprof.allocatePersistent1K", "runtime/pprof.TestMemoryProfiler"},
                legacy: fmt.Sprintf(`%v: %v \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
-#      0x[0-9,a-f]+    runtime/pprof\.allocatePersistent1K\+0x[0-9,a-f]+       .*/runtime/pprof/mprof_test\.go:47
-#      0x[0-9,a-f]+    runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test\.go:82
+#      0x[0-9,a-f]+    runtime/pprof\.allocatePersistent1K\+0x[0-9,a-f]+       .*runtime/pprof/mprof_test\.go:47
+#      0x[0-9,a-f]+    runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*runtime/pprof/mprof_test\.go:82
 `, 32*memoryProfilerRun, 1024*memoryProfilerRun, 32*memoryProfilerRun, 1024*memoryProfilerRun),
        }, {
                stk: []string{"runtime/pprof.allocateTransient1M", "runtime/pprof.TestMemoryProfiler"},
                legacy: fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
-#      0x[0-9,a-f]+    runtime/pprof\.allocateTransient1M\+0x[0-9,a-f]+        .*/runtime/pprof/mprof_test.go:24
-#      0x[0-9,a-f]+    runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:79
+#      0x[0-9,a-f]+    runtime/pprof\.allocateTransient1M\+0x[0-9,a-f]+        .*runtime/pprof/mprof_test.go:24
+#      0x[0-9,a-f]+    runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*runtime/pprof/mprof_test.go:79
 `, (1<<10)*memoryProfilerRun, (1<<20)*memoryProfilerRun),
        }, {
                stk: []string{"runtime/pprof.allocateTransient2M", "runtime/pprof.TestMemoryProfiler"},
                legacy: fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
-#      0x[0-9,a-f]+    runtime/pprof\.allocateTransient2M\+0x[0-9,a-f]+        .*/runtime/pprof/mprof_test.go:30
-#      0x[0-9,a-f]+    runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:80
+#      0x[0-9,a-f]+    runtime/pprof\.allocateTransient2M\+0x[0-9,a-f]+        .*runtime/pprof/mprof_test.go:30
+#      0x[0-9,a-f]+    runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*runtime/pprof/mprof_test.go:80
 `, memoryProfilerRun, (2<<20)*memoryProfilerRun),
        }, {
                stk: []string{"runtime/pprof.allocateTransient2MInline", "runtime/pprof.TestMemoryProfiler"},
                legacy: fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
-#      0x[0-9,a-f]+    runtime/pprof\.allocateTransient2MInline\+0x[0-9,a-f]+  .*/runtime/pprof/mprof_test.go:34
-#      0x[0-9,a-f]+    runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:81
+#      0x[0-9,a-f]+    runtime/pprof\.allocateTransient2MInline\+0x[0-9,a-f]+  .*runtime/pprof/mprof_test.go:34
+#      0x[0-9,a-f]+    runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*runtime/pprof/mprof_test.go:81
 `, memoryProfilerRun, (2<<20)*memoryProfilerRun),
        }, {
                stk: []string{"runtime/pprof.allocateReflectTransient"},
                legacy: fmt.Sprintf(`0: 0 \[%v: %v\] @( 0x[0-9,a-f]+)+
-#      0x[0-9,a-f]+    runtime/pprof\.allocateReflectTransient\+0x[0-9,a-f]+   .*/runtime/pprof/mprof_test.go:55
+#      0x[0-9,a-f]+    runtime/pprof\.allocateReflectTransient\+0x[0-9,a-f]+   .*runtime/pprof/mprof_test.go:55
 `, memoryProfilerRun, (2<<20)*memoryProfilerRun),
        }}
 
index 322579cdc436898de7d18181657a2d3acd14fee5..99897fcfdc15f3f9b9b86b83964778d7c46a54b6 100644 (file)
@@ -809,9 +809,9 @@ func TestBlockProfile(t *testing.T) {
                        },
                        re: `
 [0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
-#      0x[0-9a-f]+     runtime\.chanrecv1\+0x[0-9a-f]+ .*/src/runtime/chan.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.blockChanRecv\+0x[0-9a-f]+       .*/src/runtime/pprof/pprof_test.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*/src/runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime\.chanrecv1\+0x[0-9a-f]+ .*runtime/chan.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.blockChanRecv\+0x[0-9a-f]+       .*runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*runtime/pprof/pprof_test.go:[0-9]+
 `},
                {
                        name: "chan send",
@@ -823,9 +823,9 @@ func TestBlockProfile(t *testing.T) {
                        },
                        re: `
 [0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
-#      0x[0-9a-f]+     runtime\.chansend1\+0x[0-9a-f]+ .*/src/runtime/chan.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.blockChanSend\+0x[0-9a-f]+       .*/src/runtime/pprof/pprof_test.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*/src/runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime\.chansend1\+0x[0-9a-f]+ .*runtime/chan.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.blockChanSend\+0x[0-9a-f]+       .*runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*runtime/pprof/pprof_test.go:[0-9]+
 `},
                {
                        name: "chan close",
@@ -837,9 +837,9 @@ func TestBlockProfile(t *testing.T) {
                        },
                        re: `
 [0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
-#      0x[0-9a-f]+     runtime\.chanrecv1\+0x[0-9a-f]+ .*/src/runtime/chan.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.blockChanClose\+0x[0-9a-f]+      .*/src/runtime/pprof/pprof_test.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*/src/runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime\.chanrecv1\+0x[0-9a-f]+ .*runtime/chan.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.blockChanClose\+0x[0-9a-f]+      .*runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*runtime/pprof/pprof_test.go:[0-9]+
 `},
                {
                        name: "select recv async",
@@ -851,9 +851,9 @@ func TestBlockProfile(t *testing.T) {
                        },
                        re: `
 [0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
-#      0x[0-9a-f]+     runtime\.selectgo\+0x[0-9a-f]+  .*/src/runtime/select.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.blockSelectRecvAsync\+0x[0-9a-f]+        .*/src/runtime/pprof/pprof_test.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*/src/runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime\.selectgo\+0x[0-9a-f]+  .*runtime/select.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.blockSelectRecvAsync\+0x[0-9a-f]+        .*runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*runtime/pprof/pprof_test.go:[0-9]+
 `},
                {
                        name: "select send sync",
@@ -865,9 +865,9 @@ func TestBlockProfile(t *testing.T) {
                        },
                        re: `
 [0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
-#      0x[0-9a-f]+     runtime\.selectgo\+0x[0-9a-f]+  .*/src/runtime/select.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.blockSelectSendSync\+0x[0-9a-f]+ .*/src/runtime/pprof/pprof_test.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*/src/runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime\.selectgo\+0x[0-9a-f]+  .*runtime/select.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.blockSelectSendSync\+0x[0-9a-f]+ .*runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*runtime/pprof/pprof_test.go:[0-9]+
 `},
                {
                        name: "mutex",
@@ -879,9 +879,9 @@ func TestBlockProfile(t *testing.T) {
                        },
                        re: `
 [0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
-#      0x[0-9a-f]+     sync\.\(\*Mutex\)\.Lock\+0x[0-9a-f]+    .*/src/sync/mutex\.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.blockMutex\+0x[0-9a-f]+  .*/src/runtime/pprof/pprof_test.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*/src/runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     sync\.\(\*Mutex\)\.Lock\+0x[0-9a-f]+    .*sync/mutex\.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.blockMutex\+0x[0-9a-f]+  .*runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*runtime/pprof/pprof_test.go:[0-9]+
 `},
                {
                        name: "cond",
@@ -893,9 +893,9 @@ func TestBlockProfile(t *testing.T) {
                        },
                        re: `
 [0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
-#      0x[0-9a-f]+     sync\.\(\*Cond\)\.Wait\+0x[0-9a-f]+     .*/src/sync/cond\.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.blockCond\+0x[0-9a-f]+   .*/src/runtime/pprof/pprof_test.go:[0-9]+
-#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*/src/runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     sync\.\(\*Cond\)\.Wait\+0x[0-9a-f]+     .*sync/cond\.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.blockCond\+0x[0-9a-f]+   .*runtime/pprof/pprof_test.go:[0-9]+
+#      0x[0-9a-f]+     runtime/pprof\.TestBlockProfile\+0x[0-9a-f]+    .*runtime/pprof/pprof_test.go:[0-9]+
 `},
        }