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: add flag to show only test names, not other -test.v output #21926

Closed
natefinch opened this issue Sep 18, 2017 · 8 comments
Closed

cmd/go: add flag to show only test names, not other -test.v output #21926

natefinch opened this issue Sep 18, 2017 · 8 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@natefinch
Copy link
Contributor

I want to be able to show individual tests being run without printing out t.Log messages unless a test fails. There's currently no way to do that AFAICT.

I use t.Log a lot to write debugging info to make it easier to figure out why tests fail, including dumping server log messages into t.Log. Printing this out for passing tests makes the output far too noisy. However, I really value being able to see the list of all individual tests that are run and their execution times. This can make it easier to look back at old test runs and see if a test has gotten slower over time, etc.

Adding a new flag that'll work like -v for the purposes of showing what tests are run would be super awesome IMO.

@ianlancetaylor ianlancetaylor changed the title go test: add flag to show test names like -v cmd/go: add flag to show only test names, not other -test.v output Sep 18, 2017
@ianlancetaylor ianlancetaylor added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 18, 2017
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Sep 18, 2017
@davecheney
Copy link
Contributor

davecheney commented Sep 18, 2017 via email

@natefinch
Copy link
Contributor Author

natefinch commented Sep 19, 2017

I don't think that (grep) is really possible. I still want to see log output when a test fails. That's the great thing about t.Log. I don't think there's any way to grep such that I still get log output. Note that I am mainly thinking of using this on a CI server. Locally, I may be able to come up with a grep call that would strip all logging... But I'd have to rerun tests to get log output once I notice some failing. And that's not really an option on a CI server.

@robpike
Copy link
Contributor

robpike commented Sep 19, 2017

I'm not completely opposed but it does sound a lot like featuritis to me. Grep is your friend. Let other tools do some of the lifting.

@natefinch
Copy link
Contributor Author

natefinch commented Sep 19, 2017 via email

@davecheney
Copy link
Contributor

davecheney commented Sep 19, 2017

How about this?

zapf(~/src/tt) % go test -v
=== RUN   TestSucceeding
--- PASS: TestSucceeding (0.00s)
=== RUN   TestFailing
--- FAIL: TestFailing (0.00s)
	test_test.go:10: whoops, about to fail
	test_test.go:11: ker-bham!
FAIL
exit status 1
FAIL	tt	0.006s
zapf(~/src/tt) % go test -v 2>&1 | grep "^=== RUN"
=== RUN   TestSucceeding
=== RUN   TestFailing

@davecheney
Copy link
Contributor

Or this

% go test -list Test
TestSucceeding
TestFailing
ok  	tt	0.005s

@natefinch
Copy link
Contributor Author

The former requires me to run my tests twice and still forces me to wade through masses of logs to find log output for the failing tests. The second mostly works (if I then run go test without -v), it at least gives me the list of tests that'll run, but doesn't give me execution times of individual tests.

I just wish the two features were separated - the "always show logging" and "show individual tests being run".

@rsc
Copy link
Contributor

rsc commented Oct 23, 2017

Once we do machine-readable test output you can split this as many different ways as you want. Let's plan for that instead of adding more control knobs here.

@rsc rsc closed this as completed Oct 23, 2017
@golang golang locked and limited conversation to collaborators Oct 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

6 participants