]> Cypherpunks repositories - gostls13.git/commit
runtime/pprof: allow tests to run multiple times
authorHana Kim <hakim@google.com>
Thu, 24 May 2018 19:15:45 +0000 (15:15 -0400)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Thu, 24 May 2018 20:26:47 +0000 (20:26 +0000)
commit9eb2c434747cc83aa1e356b9ba7c2a58e8cb6926
tree83b7dffa342f025aeca61ba009ded260762e55e6
parent67b0bd7caff55555fad3d79f2f6dfc71ac33edf1
runtime/pprof: allow tests to run multiple times

TestMutexProfile and TestEmptyCallStack couldn't run multiple times
because they mutate state in runtime (mutex profile counters and
a user-defined profile type) and test whether the state
matches what it is supposed to be after the very first run.

We fix TestMutexProfile by relaxing the expected state condition.
We fix TestEmptyCallStack by creating a new profile with a different
name every time the test runs.

For #25520

Change-Id: I8e50cd9526eb650c8989457495ff90a24ce07863
Reviewed-on: https://go-review.googlesource.com/114495
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/pprof/pprof_test.go