All the existing CPU profiler tests already parse the profile.
That should be sufficient indication that profiles can be parsed.
Fixes #17853.
Change-Id: Ie8a190e2ae4eef125c8eb0d4e8b7adac420abbdb
Reviewed-on: https://go-review.googlesource.com/33136
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
}
return true
}
-
-// Tests that the profiler outputs a parsable protobuf Profile profile.
-func TestCPUProfileParse(t *testing.T) {
-
- var before, after runtime.MemStats
- runtime.ReadMemStats(&before)
- var buf bytes.Buffer
-
- if err := StartCPUProfile(&buf); err != nil {
- t.Fatalf("Profile failed: Could not enable CPU profiling: %s\n", err)
- }
- time.Sleep(5 * time.Second)
- StopCPUProfile()
-
- runtime.ReadMemStats(&after)
- _, err := profile.Parse(&buf)
- if err != nil {
- t.Fatalf("Could not parse Profile profile: %v", err)
- }
-}