Skip to content

Commit

Permalink
registering timeout handler synchronously (#3810)
Browse files Browse the repository at this point in the history
  • Loading branch information
linzhp committed Jan 3, 2024
1 parent 5540b97 commit 5b9d2c0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions go/tools/bzltestutil/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import (
)

func RegisterTimeoutHandler() {
// When the Bazel test timeout is reached, Bazel sends a SIGTERM. We
// panic just like native go test would so that the user gets stack
// traces of all running go routines.
// See https://github.com/golang/go/blob/e816eb50140841c524fd07ecb4eaa078954eb47c/src/testing/testing.go#L2351
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
go func() {
// When the Bazel test timeout is reached, Bazel sends a SIGTERM. We
// panic just like native go test would so that the user gets stack
// traces of all running go routines.
// See https://github.com/golang/go/blob/e816eb50140841c524fd07ecb4eaa078954eb47c/src/testing/testing.go#L2351
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
<-c
debug.SetTraceback("all")
panic("test timed out")
Expand Down

0 comments on commit 5b9d2c0

Please sign in to comment.