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

cmd/go: test: -bench never buffers output #13194

Closed
tamird opened this issue Nov 9, 2015 · 4 comments
Closed

cmd/go: test: -bench never buffers output #13194

tamird opened this issue Nov 9, 2015 · 4 comments

Comments

@tamird
Copy link
Contributor

tamird commented Nov 9, 2015

From src/cmd/go/test.go:

    // stream test output (no buffering) when no package has
    // been given on the command line (implicit current directory)
    // or when benchmarking.
    // Also stream if we're showing output anyway with a
    // single package under test or if parallelism is set to 1.
    // In these cases, streaming the output produces the same result
    // as not streaming, just more immediately.
    testStreamOutput = len(pkgArgs) == 0 || testBench ||
        (testShowPass && (len(pkgs) == 1 || buildP == 1))

I think the testBench exemption should be removed, but I thought I'd file an issue before submitting the change.

@ianlancetaylor ianlancetaylor changed the title cmd/go/test: -bench never buffers output cmd/go: test: -bench never buffers output Nov 9, 2015
@ianlancetaylor
Copy link
Contributor

Why should it be removed?

@tamird
Copy link
Contributor Author

tamird commented Nov 9, 2015

In our case, the stuff under test likes to log more verbosely than is useful for passing tests and benchmarks. For the same reason that we like having these logs elided when the tests are passing, we also want the logs elided when the benchmarks pass.

@ianlancetaylor
Copy link
Contributor

But benchmarks neither pass nor fail.

Having the go tool stream output when benchmarking seems clearly useful. And as far as I can tell, simply deleting testBench from the conditional means that benchmarking output will not be shown by default, which seems clearly not useful. If we had a way for the go tool to distinguish test and bench output, perhaps we could do something; that leads us toward issues #2981 and #12826.

I'm going to close this issue in favor of those, but feel free to reopen if you think I have misunderstood.

@tamird
Copy link
Contributor Author

tamird commented Nov 9, 2015

But benchmarks neither pass nor fail.

Benchmarks can fail just like tests; https://godoc.org/testing#B.Error

And as far as I can tell, simply deleting testBench from the conditional means that benchmarking output will not be shown by default, which seems clearly not useful.

Ah, yes, that's indeed the result.

@golang golang locked and limited conversation to collaborators Nov 10, 2016
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