Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: panic + Skip is not reported as a failure, though Error + Skip is #53259

Closed
prashantv opened this issue Jun 6, 2022 · 2 comments
Closed
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@prashantv
Copy link
Contributor

prashantv commented Jun 6, 2022

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

$ go version
go version go1.18.3 darwin/arm64

Also reproduced on Go Playground using 1.17, 1.18, and latest dev branch.

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/prashant/Library/Caches/go-build"
GOENV="/Users/prashant/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/prashant/go/pkg/mod"
GONOPROXY="github.com/chronosphereio"
GONOSUMDB="github.com/chronosphereio"
GOOS="darwin"
GOPATH="/Users/prashant/go"
GOPRIVATE="github.com/chronosphereio"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/prashant/.gimme/versions/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/prashant/.gimme/versions/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/prashant/tmp/panic-skip/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2f/kn4pgn0x5dv1nqm97qh06sch0000gp/T/go-build1443169597=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Called t.Skip inside of a cleanup function, for a test that failed due to a panic.

func TestCleanupSkipPanic(t *testing.T) {
	t.Cleanup(func() {
		t.Skip("skip: t.Failed() = ", t.Failed())
	})
	panic("fail")
}

See playground for other similar tests and how they behave:
https://go.dev/play/p/zK1cXf5iAG5

What did you expect to see?

Expected the test to be marked as failed due to the panic.

What did you see instead?

The test was marked as skipped, and the cleanup function (or defer) reported the test as not failed.

=== RUN   TestCleanupSkipPanic
    prog.go:21: skip: t.Failed() =  false
--- SKIP: TestCleanupSkipPanic (0.00s)
@cherrymui cherrymui changed the title testing: Panic + Skip is not reported as a failure, though Error + Skip is testing: panic + Skip is not reported as a failure, though Error + Skip is Jun 6, 2022
@cherrymui cherrymui added this to the Backlog milestone Jun 6, 2022
@cherrymui cherrymui added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 6, 2022
@cherrymui
Copy link
Member

cherrymui commented Jun 6, 2022

cc @bcmills

@seankhliao
Copy link
Member

seankhliao commented Jun 7, 2022

Duplicate of #49929

@seankhliao seankhliao marked this as a duplicate of #49929 Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants