Skip to content

testing: test.timeout uses panic(), returning an exitcode of 0 #21371

@mordyovits

Description

@mordyovits

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8.1 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/movits/gocode"
GORACE=""
GOROOT="/home/movits/go"
GOTOOLDIR="/home/movits/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build095751258=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

if you set a test.timeout on the cmdline when using go test, and you hit the timeout, the testing code calls panic to stop and print a stack trace:

panic(fmt.Sprintf("test timed out after %v", *timeout))

However, this causes the execution to exit with an exitcode of 0, unlike all other failure scenarios.

What did you expect to see?

An exitcode of 1. As with this comment:

// Run runs the tests. It returns an exit code to pass to os.Exit.

// Run runs the tests. It returns an exit code to pass to os.Exit.

IOW, failure usually means a non-zero exitcode--except in the case of timeout. (Or perhaps other panic()s too?)

What did you see instead?

And exitcode of 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions