• Diogo Pinela's avatar
    testing: allow marking subtest and subbenchmark functions as Helpers · 15f2cbf4
    Diogo Pinela authored
    Since subtests and subbenchmarks run in a separate goroutine, and thus
    a separate stack, this entails capturing the stack trace at the point
    tb.Run is called. The work of getting the file and line information from
    this stack is only done when needed, however.
    
    Continuing the search into the parent test also requires temporarily
    holding its mutex. Since Run does not hold it while waiting for the
    subtest to complete, there should be no risk of a deadlock due to this.
    
    Fixes #24128
    
    Change-Id: If0bb169f3ac96bd48794624e619ade7edb599f83
    Reviewed-on: https://go-review.googlesource.com/108658
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarMarcel van Lohuizen <mpvl@golang.org>
    15f2cbf4
helper_test.go 1.63 KB