• Dan Scales's avatar
    misc, runtime, test: extra tests and benchmarks for defer · 225f484c
    Dan Scales authored
    Add a bunch of extra tests and benchmarks for defer, in preparation for new
    low-cost (open-coded) implementation of defers (see #34481),
    
     - New file defer_test.go that tests a bunch more unusual defer scenarios,
       including things that might have problems for open-coded defers.
     - Additions to callers_test.go actually verifying what the stack trace looks like
       for various panic or panic-recover scenarios.
     - Additions to crash_test.go testing several more crash scenarios involving
       recursive panics.
     - New benchmark in runtime_test.go measuring speed of panic-recover
     - New CGo benchmark in cgo_test.go calling from Go to C back to Go that
       shows defer overhead
    
    Updates #34481
    
    Change-Id: I423523f3e05fc0229d4277dd00073289a5526188
    Reviewed-on: https://go-review.googlesource.com/c/go/+/197017
    Run-TryBot: Dan Scales <danscales@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarKeith Randall <khr@golang.org>
    Reviewed-by: default avatarAustin Clements <austin@google.com>
    225f484c
defer_test.go 4.23 KB