container/stub: remove function call in handleExit
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m21s
Test / Hpkg (push) Successful in 4m21s
Test / Sandbox (race detector) (push) Successful in 4m44s
Test / Hakurei (race detector) (push) Successful in 5m24s
Test / Hakurei (push) Successful in 2m26s
Test / Flake checks (push) Successful in 1m36s
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m21s
Test / Hpkg (push) Successful in 4m21s
Test / Sandbox (race detector) (push) Successful in 4m44s
Test / Hakurei (race detector) (push) Successful in 5m24s
Test / Hakurei (push) Successful in 2m26s
Test / Flake checks (push) Successful in 1m36s
This gets inlined and does not cause problems usually but turns out -coverpkg uninlines it and breaks the recovery. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -12,20 +12,13 @@ const (
|
||||
)
|
||||
|
||||
// HandleExit must be deferred before calling with the stub.
|
||||
func (s *Stub[K]) HandleExit() { handleExit(s.TB, true) }
|
||||
|
||||
func handleExit(t testing.TB, root bool) {
|
||||
func HandleExit(t testing.TB) {
|
||||
switch r := recover(); r {
|
||||
case PanicExit:
|
||||
break
|
||||
|
||||
case panicFailNow:
|
||||
if root {
|
||||
t.FailNow()
|
||||
} else {
|
||||
t.Fail()
|
||||
}
|
||||
break
|
||||
t.FailNow()
|
||||
|
||||
case panicFatal, panicFatalf, nil:
|
||||
break
|
||||
@@ -34,3 +27,18 @@ func handleExit(t testing.TB, root bool) {
|
||||
panic(r)
|
||||
}
|
||||
}
|
||||
|
||||
// handleExitNew handles exits from goroutines created by [Stub.New].
|
||||
func handleExitNew(t testing.TB) {
|
||||
switch r := recover(); r {
|
||||
case PanicExit, panicFatal, panicFatalf, nil:
|
||||
break
|
||||
|
||||
case panicFailNow:
|
||||
t.Fail()
|
||||
break
|
||||
|
||||
default:
|
||||
panic(r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user