-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
What version of Go are you using (go version)?
go version devel +32764f7726 Wed May 31 17:59:09 2017 +0100 linux/amd64
Also on 1.8.3.
What operating system and processor architecture are you using (go env)?
not relevant
What did you do?
While investigating #19280, I ran go test -parallel=0 and go test -parallel=-1 (on some trivial parallel tests) to see what would happen without any changes to the testing package.
What did you expect to see?
An error, like "N must be a positive integer".
What did you see instead?
$ go test -v -parallel=0
=== RUN TestParA
=== RUN TestParB
=== RUN TestParC
=== RUN TestParC/C0
=== RUN TestParC/C1
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
testing.(*T).Run(0xc420090000, 0x535462, 0x8, 0x53d5c0, 0x468801)
/home/mvdan/tip/src/testing/testing.go:791 +0x2fc
testing.runTests.func1(0xc420090000)
/home/mvdan/tip/src/testing/testing.go:1005 +0x6c
testing.tRunner(0xc420090000, 0xc42003bde8)
/home/mvdan/tip/src/testing/testing.go:747 +0xd0
testing.runTests(0xc42000a060, 0x5dd6e0, 0x3, 0x3, 0xc4200443b0)
/home/mvdan/tip/src/testing/testing.go:1003 +0x2c1
testing.(*M).Run(0xc42003bf20, 0xc42003bf78)
/home/mvdan/tip/src/testing/testing.go:922 +0x111
main.main()
_/home/mvdan/par/_test/_testmain.go:48 +0xdb
goroutine 5 [chan receive]:
testing.(*T).Parallel(0xc4200900f0)
/home/mvdan/tip/src/testing/testing.go:677 +0x127
_/home/mvdan/par.TestParA(0xc4200900f0)
/home/mvdan/par/f_test.go:6 +0x2b
testing.tRunner(0xc4200900f0, 0x53d5b0)
/home/mvdan/tip/src/testing/testing.go:747 +0xd0
created by testing.(*T).Run
/home/mvdan/tip/src/testing/testing.go:790 +0x2de
goroutine 6 [chan receive]:
testing.(*T).Parallel(0xc4200901e0)
/home/mvdan/tip/src/testing/testing.go:677 +0x127
_/home/mvdan/par.TestParB(0xc4200901e0)
/home/mvdan/par/f_test.go:11 +0x2b
testing.tRunner(0xc4200901e0, 0x53d5b8)
/home/mvdan/tip/src/testing/testing.go:747 +0xd0
created by testing.(*T).Run
/home/mvdan/tip/src/testing/testing.go:790 +0x2de
goroutine 7 [chan receive]:
testing.tRunner.func1(0xc4200902d0)
/home/mvdan/tip/src/testing/testing.go:723 +0x13c
testing.tRunner(0xc4200902d0, 0x53d5c0)
/home/mvdan/tip/src/testing/testing.go:749 +0xda
created by testing.(*T).Run
/home/mvdan/tip/src/testing/testing.go:790 +0x2de
goroutine 8 [chan receive]:
testing.(*testContext).waitParallel(0xc42000e2d0)
/home/mvdan/tip/src/testing/testing.go:834 +0x9f
testing.(*T).Parallel(0xc4200903c0)
/home/mvdan/tip/src/testing/testing.go:678 +0x13f
_/home/mvdan/par.TestParC.func1(0xc4200903c0)
/home/mvdan/par/f_test.go:18 +0x34
testing.tRunner(0xc4200903c0, 0xc420044450)
/home/mvdan/tip/src/testing/testing.go:747 +0xd0
created by testing.(*T).Run
/home/mvdan/tip/src/testing/testing.go:790 +0x2de
goroutine 9 [chan receive]:
testing.(*testContext).waitParallel(0xc42000e2d0)
/home/mvdan/tip/src/testing/testing.go:834 +0x9f
testing.(*T).Parallel(0xc4200904b0)
/home/mvdan/tip/src/testing/testing.go:678 +0x13f
_/home/mvdan/par.TestParC.func1(0xc4200904b0)
/home/mvdan/par/f_test.go:18 +0x34
testing.tRunner(0xc4200904b0, 0xc420044490)
/home/mvdan/tip/src/testing/testing.go:747 +0xd0
created by testing.(*T).Run
/home/mvdan/tip/src/testing/testing.go:790 +0x2de
exit status 2
FAIL _/home/mvdan/par 0.004s
The tests themselves are silly examples - this is reproducible with any set of parallel tests. If none of the tests call t.Parallel() the panic doesn't occur, supposedly because N isn't used at all.
I realise this is somewhat expected, but we should error instead of panicking. Happy to work on a CL if my thinking is correct.
/cc @mpvl @josharian
Reactions are currently unavailable