]> Cypherpunks repositories - gostls13.git/commit
cmd/test2json: emit Benchmark name output early
authorRuss Cox <rsc@golang.org>
Mon, 8 Jan 2018 17:11:00 +0000 (12:11 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 9 Jan 2018 01:53:38 +0000 (01:53 +0000)
commit9044f018ec7bf35ac030dc5aec1acd7d18d6691c
treefc12357dd45e0096525eed882eb3b4398d550dc9
parenta99deed39bb945cba922bd312435fdf309b42a13
cmd/test2json: emit Benchmark name output early

When benchmarks run, they print lines like:

  BenchmarkGenericNoMatch-8   3000000 385 ns/op

The first field, padded by spaces and followed by a tab,
is printed when the benchmark begins running.
The rest of the line is printed when the benchmark ends.
Tools and people can watch the timing of these prints
to see which benchmark is running.

To allow tools consuming json output to continue to be
able to see which benchmark is running, this CL adds a
special case to the usual "line at a time" behavior to flush
the benchmark name if it is observed separately from the
rest of the line.

Fixes #23352.

Change-Id: I7b6410698d78034eec18745d7f57b7d8e9575dbb
Reviewed-on: https://go-review.googlesource.com/86695
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/internal/test2json/test2json.go
src/cmd/internal/test2json/testdata/benchshort.json [new file with mode: 0644]
src/cmd/internal/test2json/testdata/benchshort.test [new file with mode: 0644]