Commit f8176f81 authored by Rahul Chaudhry's avatar Rahul Chaudhry Committed by Ian Lance Taylor

cmd/go: stream test output if parallelism is set to 1.

"go test -v" buffers output if more than one package is
being tested to avoid mixing the outputs from multiple
tests running in parallel. It currently enables streaming
if there's only a single package under test.

It is ok to stream output from multiple tests if we know
that they're not going to be running in parallel.

To see the difference: go test -v -p=1 runtime fmt -short

Change-Id: Idc24575c899eac30d553e0bf52b86f90e189392d
Reviewed-on: https://go-review.googlesource.com/4153Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent acfe3a59
...@@ -346,11 +346,11 @@ func runTest(cmd *Command, args []string) { ...@@ -346,11 +346,11 @@ func runTest(cmd *Command, args []string) {
// been given on the command line (implicit current directory) // been given on the command line (implicit current directory)
// or when benchmarking. // or when benchmarking.
// Also stream if we're showing output anyway with a // Also stream if we're showing output anyway with a
// single package under test. In that case, streaming the // single package under test or if parallelism is set to 1.
// output produces the same result as not streaming, // In these cases, streaming the output produces the same result
// just more immediately. // as not streaming, just more immediately.
testStreamOutput = len(pkgArgs) == 0 || testBench || testStreamOutput = len(pkgArgs) == 0 || testBench ||
(len(pkgs) <= 1 && testShowPass) (testShowPass && (len(pkgs) == 1 || buildP == 1))
var b builder var b builder
b.init() b.init()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment