]> Cypherpunks repositories - gostls13.git/commit
runtime: fix flake in TestCgoPprofThread
authorRhys Hiltner <rhys@justin.tv>
Tue, 7 Dec 2021 21:32:24 +0000 (13:32 -0800)
committerMichael Pratt <mpratt@google.com>
Wed, 8 Dec 2021 15:45:29 +0000 (15:45 +0000)
commit46db6aa1573def4ba06dbf5c38e704d85dc303b6
tree8b12de1740f6c3a91f70da5fe01edf9be80e95dd
parent3042ba34db86853c7035046716c4a00b2dbef2ed
runtime: fix flake in TestCgoPprofThread

If the test's main goroutine receives a SIGPROF while creating the
C-owned thread for the test, that sample will appear in the resulting
profile. The root end of that stack will show a set of Go functions. The
leaf end will be the C functions returned by the SetCgoTraceback
handler, which will confuse the test runner.

Add a label to the main goroutine while it calls in to C, so all profile
samples that triggered the SetCgoTraceback handler are either correct,
or can easily be excluded from the test's analysis. (The labels will not
apply to the resulting C-owned thread, which does not use goroutines.)

Fixes #43174

Change-Id: Ica3100ca0f191dcf91b30b0084e8541c5a25689f
Reviewed-on: https://go-review.googlesource.com/c/go/+/370135
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/runtime/crash_cgo_test.go
src/runtime/testdata/testprogcgo/threadpprof.go