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

cmd/go: go test -json sends pass event for a test that panics #38226

Closed
firelizzard18 opened this issue Apr 2, 2020 · 2 comments
Closed

cmd/go: go test -json sends pass event for a test that panics #38226

firelizzard18 opened this issue Apr 2, 2020 · 2 comments

Comments

@firelizzard18
Copy link
Contributor

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

$ go version
go version go1.14 windows/amd64

Does this issue reproduce with the latest release?

Yes, as of 1.14

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

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=REDACTED
set GOENV=REDACTED
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=REDACTED
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=REDACTED
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=REDACTED=/tmp/go-build -gno-record-gcc-switches

What did you do?

I ran go test -json for a package with tests, one of which panicked. For example:

package x_test

import "testing"

func TestPanic(t *testing.T) {
	panic("oh no")
}

What did you expect to see?

...
{"Time":"2020-04-02T18:47:26.8397057-05:00","Action":"fail","Package":"bug","Test":"TestPanic","Elapsed":0.218}

What did you see instead?

...
{"Time":"2020-04-02T18:47:26.8397057-05:00","Action":"pass","Package":"bug","Test":"TestPanic","Elapsed":0.218}

The full output of go test:

--- FAIL: TestPanic (0.00s)
panic: oh no [recovered]
        panic: oh no

goroutine 19 [running]:
testing.tRunner.func1.1(0x521320, 0x57b9d0)
        c:/go/src/testing/testing.go:941 +0x3d7
testing.tRunner.func1(0xc0000e8120)
        c:/go/src/testing/testing.go:944 +0x400
panic(0x521320, 0x57b9d0)
        c:/go/src/runtime/panic.go:967 +0x16b
bug_test.TestPanic(0xc0000e8120)
        REDACTED/x_test.go:6 +0x40
testing.tRunner(0xc0000e8120, 0x55d640)
        c:/go/src/testing/testing.go:992 +0xe3
created by testing.(*T).Run
        c:/go/src/testing/testing.go:1043 +0x35e
exit status 2
FAIL    bug     0.224s
@jayconrod
Copy link
Contributor

Could you try with Go 1.14.1? This sounds like #37555, which was backported in #37671.

Closing because I'm pretty sure this is a duplicate, but please comment if that's not the case.

@firelizzard18
Copy link
Contributor Author

It does appear to be fixed in 1.14.1, thanks

@golang golang locked and limited conversation to collaborators Apr 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants