]> Cypherpunks repositories - gostls13.git/commit
runtime/pprof: improve output of TestLabelSystemstack
authorAustin Clements <austin@google.com>
Wed, 4 Jan 2023 17:31:23 +0000 (12:31 -0500)
committerAustin Clements <austin@google.com>
Mon, 9 Jan 2023 20:25:17 +0000 (20:25 +0000)
commitd9f23cfe78eadcdbde31fd931e90bebb72455648
tree95c940255a8975c519a91e1efff1ef1be03dd248
parent8232a09e3ed7d315a90ac059ee542ecaf0f6b4c2
runtime/pprof: improve output of TestLabelSystemstack

The current output of TestLabelSystemstack is a bit cryptic. This CL
improves various messages and hopefully simplifies the logic in the
test.

Simplifying the logic leads to three changes in possible outcomes,
which I verified by running the logic before and after this change
through all 2^4 possibilities (https://go.dev/play/p/bnfb-OQCT4j):

1. If a sample both must be labeled and must not be labeled, the test
now reports that explicitly rather than giving other confusing output.

2. If a sample must not be labeled but is, the current logic will
print two identical error messages. The new logic prints only one.

3. If the test finds no frames at all that it recognizes, but the
sample is labeled, it will currently print a confusing "Sample labeled
got true want false" message. The new logic prints nothing. We've seen
this triggered by empty stacks in profiles.

Fixes #51550. This bug was caused by case 3 above, where it was
triggered by a profile label on an empty stack. It's valid for empty
stacks to appear in a profile if we sample a goroutine just as it's
exiting (and that goroutine may have a profile label), so the test
shouldn't fail in this case.

Change-Id: I1593ec4ac33eced5bb89572a3ba7623e56f2fb3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/460516
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/runtime/pprof/pprof_test.go