-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version)?
go version devel +d9270ecb3a Fri Feb 24 19:09:41 2017 +0000 linux/amd64
What operating system and processor architecture are you using (go env)?
linux/amd64, doesn't matter really
What did you do?
Write a bunch of parallel subtests. Run them with different values of -parallel N.
package foo
import "testing"
func TestFoo(t *testing.T) {
for _, s := range []string{
"sub1", "sub2", "sub3", "sub4",
} {
t.Run(s, func(t *testing.T) {
t.Parallel()
println("output")
})
}
}
What did you expect to see?
$ go test -v
=== RUN TestFoo
=== RUN TestFoo/sub1
=== RUN TestFoo/sub2
=== RUN TestFoo/sub3
=== RUN TestFoo/sub4
output
output
output
output
[...]
$ go test -v -parallel 1
=== RUN TestFoo
=== RUN TestFoo/sub1
output
=== RUN TestFoo/sub2
output
=== RUN TestFoo/sub3
output
=== RUN TestFoo/sub4
output
[...]
What did you see instead?
Second command does not separate subtest outputs:
$ go test -v -parallel 1
=== RUN TestFoo
=== RUN TestFoo/sub1
=== RUN TestFoo/sub2
=== RUN TestFoo/sub3
=== RUN TestFoo/sub4
output
output
output
output
[...]
I realise this example is very stupid, but the current behavior is confusing. -parallel does take effect, but go test prints all the === RUN lines at once regardless. It's hard to tell when each subtest actually starts executing.
And, for my particular problem, I can't tell what output is from what subtest with -parallel 1 since the outputs aren't delimited by each of their === RUN lines.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.