From f0bbb5c45023782c064c6241ba85897a3a3a2e18 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Mon, 23 Feb 2015 03:55:54 -0500 Subject: [PATCH] runtime/pprof: make TestBlockProfile more robust It's using debug mode of pprof.writeBlock, so the output actually goes through text/tabwriter. It is possible that tabwriter expands each tab into multiple tabs in certain cases. For example, this output has been observed on the new arm64 port: 10073805 1 @ 0x1088ec 0xd1b8c 0xd0628 0xb68c0 0x867f4 # 0x1088ec sync.(*Cond).Wait+0xfc /home/minux/go.git/src/sync/cond.go:63 # 0xd1b8c runtime/pprof_test.blockCond+0x22c /home/minux/go.git/src/runtime/pprof/pprof_test.go:454 # 0xd0628 runtime/pprof_test.TestBlockProfile+0x1b8 /home/minux/go.git/src/runtime/pprof/pprof_test.go:359 # 0xb68c0 testing.tRunner+0x140 /home/minux/go.git/src/testing/testing.go:447 10069965 1 @ 0x14008 0xd1390 0xd0628 0xb68c0 0x867f4 # 0x14008 runtime.chansend1+0x48 /home/minux/go.git/src/runtime/chan.go:76 # 0xd1390 runtime/pprof_test.blockChanSend+0x100 /home/minux/go.git/src/runtime/pprof/pprof_test.go:396 # 0xd0628 runtime/pprof_test.TestBlockProfile+0x1b8 /home/minux/go.git/src/runtime/pprof/pprof_test.go:359 # 0xb68c0 testing.tRunner+0x140 /home/minux/go.git/src/testing/testing.go:447 10069706 1 @ 0x108e0c 0xd193c 0xd0628 0xb68c0 0x867f4 # 0x108e0c sync.(*Mutex).Lock+0x19c /home/minux/go.git/src/sync/mutex.go:67 # 0xd193c runtime/pprof_test.blockMutex+0xbc /home/minux/go.git/src/runtime/pprof/pprof_test.go:441 # 0xd0628 runtime/pprof_test.TestBlockProfile+0x1b8 /home/minux/go.git/src/runtime/pprof/pprof_test.go:359 # 0xb68c0 testing.tRunner+0x140 /home/minux/go.git/src/testing/testing.go:447 Change-Id: I3bef778c5fe01a894cfdc526fdc5fecb873b8ade Signed-off-by: Shenghou Ma Reviewed-on: https://go-review.googlesource.com/5554 Reviewed-by: Dmitry Vyukov --- src/runtime/pprof/pprof_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go index 49dd78446f..2d1bfa9a48 100644 --- a/src/runtime/pprof/pprof_test.go +++ b/src/runtime/pprof/pprof_test.go @@ -375,7 +375,7 @@ func TestBlockProfile(t *testing.T) { } for _, test := range tests { - if !regexp.MustCompile(test.re).MatchString(prof) { + if !regexp.MustCompile(strings.Replace(test.re, "\t", "\t+", -1)).MatchString(prof) { t.Fatalf("Bad %v entry, expect:\n%v\ngot:\n%v", test.name, test.re, prof) } } -- 2.50.0