]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/pprof: accept fewer PCs
authorAustin Clements <austin@google.com>
Wed, 19 Apr 2017 20:06:46 +0000 (16:06 -0400)
committerAustin Clements <austin@google.com>
Thu, 20 Apr 2017 19:46:36 +0000 (19:46 +0000)
TestBlockProfile currently requires exactly five PCs in each sample.
With more aggressive inlining there may be fewer, so change this test
to use the same pattern as TestMutexProfile, which accepts one or more
PCs. With this change, this test passes when compiled with -l=4.

Change-Id: I1421a6d56c96b77111bdc671d88723a222672fd6
Reviewed-on: https://go-review.googlesource.com/41110
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Lazar <lazard@golang.org>
src/runtime/pprof/pprof_test.go

index 2b82e68be754f3d71e676d22bb15bd6230064671..906eae9bf51629ca3bbc71826c38b79da3d98df5 100644 (file)
@@ -363,43 +363,43 @@ func TestBlockProfile(t *testing.T) {
        }
        tests := [...]TestCase{
                {"chan recv", blockChanRecv, `
-[0-9]+ [0-9]+ @ 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]+
+[0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
 #      0x[0-9,a-f]+    runtime\.chanrecv1\+0x[0-9,a-f]+        .*/src/runtime/chan.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.blockChanRecv\+0x[0-9,a-f]+      .*/src/runtime/pprof/pprof_test.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.TestBlockProfile\+0x[0-9,a-f]+   .*/src/runtime/pprof/pprof_test.go:[0-9]+
 `},
                {"chan send", blockChanSend, `
-[0-9]+ [0-9]+ @ 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]+
+[0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
 #      0x[0-9,a-f]+    runtime\.chansend1\+0x[0-9,a-f]+        .*/src/runtime/chan.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.blockChanSend\+0x[0-9,a-f]+      .*/src/runtime/pprof/pprof_test.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.TestBlockProfile\+0x[0-9,a-f]+   .*/src/runtime/pprof/pprof_test.go:[0-9]+
 `},
                {"chan close", blockChanClose, `
-[0-9]+ [0-9]+ @ 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]+
+[0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
 #      0x[0-9,a-f]+    runtime\.chanrecv1\+0x[0-9,a-f]+        .*/src/runtime/chan.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.blockChanClose\+0x[0-9,a-f]+     .*/src/runtime/pprof/pprof_test.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.TestBlockProfile\+0x[0-9,a-f]+   .*/src/runtime/pprof/pprof_test.go:[0-9]+
 `},
                {"select recv async", blockSelectRecvAsync, `
-[0-9]+ [0-9]+ @ 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]+
+[0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
 #      0x[0-9,a-f]+    runtime\.selectgo\+0x[0-9,a-f]+ .*/src/runtime/select.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.blockSelectRecvAsync\+0x[0-9,a-f]+       .*/src/runtime/pprof/pprof_test.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.TestBlockProfile\+0x[0-9,a-f]+   .*/src/runtime/pprof/pprof_test.go:[0-9]+
 `},
                {"select send sync", blockSelectSendSync, `
-[0-9]+ [0-9]+ @ 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]+
+[0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
 #      0x[0-9,a-f]+    runtime\.selectgo\+0x[0-9,a-f]+ .*/src/runtime/select.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.blockSelectSendSync\+0x[0-9,a-f]+        .*/src/runtime/pprof/pprof_test.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.TestBlockProfile\+0x[0-9,a-f]+   .*/src/runtime/pprof/pprof_test.go:[0-9]+
 `},
                {"mutex", blockMutex, `
-[0-9]+ [0-9]+ @ 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]+
+[0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
 #      0x[0-9,a-f]+    sync\.\(\*Mutex\)\.Lock\+0x[0-9,a-f]+   .*/src/sync/mutex\.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.blockMutex\+0x[0-9,a-f]+ .*/src/runtime/pprof/pprof_test.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.TestBlockProfile\+0x[0-9,a-f]+   .*/src/runtime/pprof/pprof_test.go:[0-9]+
 `},
                {"cond", blockCond, `
-[0-9]+ [0-9]+ @ 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]+
+[0-9]+ [0-9]+ @( 0x[[:xdigit:]]+)+
 #      0x[0-9,a-f]+    sync\.\(\*Cond\)\.Wait\+0x[0-9,a-f]+    .*/src/sync/cond\.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.blockCond\+0x[0-9,a-f]+  .*/src/runtime/pprof/pprof_test.go:[0-9]+
 #      0x[0-9,a-f]+    runtime/pprof\.TestBlockProfile\+0x[0-9,a-f]+   .*/src/runtime/pprof/pprof_test.go:[0-9]+