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: go test -list should be able to list all tests recursively #59465

Closed
disconnect3d opened this issue Apr 6, 2023 · 2 comments
Closed
Labels

Comments

@disconnect3d
Copy link

(I proposed this and a few other suggestions here but since I haven't got any feedback, I am submitting this one as a separate issue here)

Hi,

It would be nice to have an ability to list ALL tests and/or fuzzing harnesses in ALL packages/subpackages of a given module/project with the go test -list ./... command.

Currently, this reports no Go files in /Users/user/go/src/github.com/xxx/yyy for me and a workaround for this can be iterating over all directories manually and listing all the tests, for example with the following command:

find . -type d -exec bash -c "cd {} && go test -list . && cd -" \;

Also, it seems that Go commands can traverse all subpackages since go list -test ./... seems to be able to do that, but the problem is it does not list tests (or fuzzing harnesses) but only the test binaries.

The proposed feature would be useful for automatic fuzzing, e.g., to be able to list all harnesses and spawn fuzzers on the fly based on the list.

Additionally, it would be nice to be able to control the output somehow: what matters the most is 1) test package name, 2) test/fuzz harness name, since this is what is eventually needed to run the test/fuzzing harness. All other output like ok github.com/xxx/yyy/subpath1/subpath2 0.333s is not useful at all.

@seankhliao
Copy link
Member

note the -list takes an argument
so go test -list . ./....

it'll never be able to list everything, subtests require code execution to find.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2023
@disconnect3d
Copy link
Author

note the -list takes an argument
so go test -list . ./....

Oh interesting, that works, thanks. Though, this was kinda unexpected to me as I was used that many other commands and Go tools accept just "./...", heh.

it'll never be able to list everything, subtests require code execution to find.

I'm personally okay with code execution as long as I would get the whole list ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants