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

all: T.FailNow used in goroutines in standard library tests #17900

Closed
dominikh opened this issue Nov 12, 2016 · 3 comments
Closed

all: T.FailNow used in goroutines in standard library tests #17900

dominikh opened this issue Nov 12, 2016 · 3 comments

Comments

@dominikh
Copy link
Member

Per the documentation on testing.T, the methods FailNow, Fatal, Fatalf, SkipNow, Skip, and Skipf must be called from the same goroutine that is running the test. This requirement is violated by various tests in the standard library.

The following is a list of all goroutines spawned in tests that call T.FailNow. The list was generated from revision 2f49726.

src/runtime/chan_test.go:209:3
src/runtime/chan_test.go:306:4
src/runtime/chan_test.go:306:4
src/net/http/serve_test.go:2476:2
src/net/http/serve_test.go:2629:2
src/net/http/serve_test.go:2670:2
src/runtime/trace/trace_stack_test.go:85:2
src/runtime/trace/trace_test.go:256:2
src/runtime/trace/trace_test.go:256:2
src/runtime/trace/trace_test.go:256:2
src/database/sql/sql_test.go:2514:2
src/net/rpc/server_test.go:690:3
src/log/syslog/syslog_test.go:368:3
src/crypto/tls/handshake_server_test.go:201:2
src/crypto/tls/tls_test.go:294:2
src/crypto/tls/tls_test.go:294:2
src/sync/cond_test.go:135:2
src/sync/cond_test.go:162:2
src/sync/pool_test.go:121:3
src/net/dnsclient_unix_test.go:667:2
src/net/dnsclient_unix_test.go:667:2
src/net/dnsclient_unix_test.go:667:2
src/net/dnsclient_unix_test.go:667:2
src/sync/atomic/atomic_test.go:1216:3
src/sync/atomic/atomic_test.go:1216:3
src/sync/atomic/atomic_test.go:1259:3
src/sync/atomic/atomic_test.go:1259:3
src/sync/atomic/atomic_test.go:1305:3
src/sync/atomic/atomic_test.go:1353:3
src/os/exec/exec_test.go:431:2
@cespare
Copy link
Contributor

cespare commented Nov 12, 2016

@dominikh did you use a tool to find these?

@dominikh
Copy link
Member Author

@cespare The output is from a work in progress check for staticcheck (dominikh/go-staticcheck@7f04f97)

@gopherbot
Copy link

CL https://golang.org/cl/33243 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 15, 2017
FiloSottile pushed a commit to FiloSottile/go that referenced this issue Oct 12, 2018
Fixes golang#17900.

Change-Id: I42cda6ac9cf48ed739d3a015a90b3cb15edf8ddf
Reviewed-on: https://go-review.googlesource.com/33243
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
FiloSottile pushed a commit to FiloSottile/go that referenced this issue Oct 12, 2018
Fixes golang#17900.

Change-Id: I42cda6ac9cf48ed739d3a015a90b3cb15edf8ddf
Reviewed-on: https://go-review.googlesource.com/33243
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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