-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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 -fuzz='^FuzzName$'
uses default value of -run flag and runs all regular tests as well
#50432
Comments
Interesting to see that we have a test which specifically locks this behavior in: go/src/cmd/go/testdata/script/test_fuzz_chatty.txt Lines 35 to 42 in 95b240b
It seems like it was added in b894834 by @katiehockman. It sounds like a relatively straightforward fix, be it amending the docs, or updating the code to follow the docs. The simplest fix in terms of code might be to have |
@katiehockman in terms of docs, it probably was only the draft proposal that made me think the behaviour wasn’t matching the design, or perhaps something I saw in the old
EDIT: I've also now read through the latest https://pkg.go.dev/testing@master#hdr-Fuzzing which probably should have been my starting point, rather than https://go.dev/doc/fuzz/ as it does explain and even has "The -fuzz and -run flags can both be set, in order to fuzz a target but skip the execution of all other tests" I guess one of the unexpected parts of the current behaviour is that even if I've already run through all of the tests myself via It's a shame we can't preserve the testcache ignoring |
That's an interesting idea. I can see your point about that fact that running One possible issue is that the binary isn't exactly the same, because running /cc @golang/fuzzing |
Bump. Can we get this poor UX fixed? It is annoying and unexpected that passing in |
I would also like to offer some other suggestions regarding UX of fuzzing:
I understand that this issue may not be the best place to discuss any of those. Please point me/move this post elsewhere if there is a better place to discuss them. Also, sorry for not doing an exhaustive research if those were already discussed or planned. |
gotip test -fuzz='^FuzzName$'
appears to run regular tests as wellgo test -fuzz='^FuzzName$'
uses default value of -run flag and runs all regular tests as well
What version of Go are you using (
gotip version
)?Does this issue reproduce with the latest release?
Yes, this was reproduced on latest tip (95b240b) and had also been seen to reproduce on my previously installed version of gotip from Sep 22nd (09d3df0) too
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
gotip test -fuzz=FuzzName
as per the docs, but was surprised to find it taking a long time to run-v
to see the output and noted that all of my others tests were being run tooWhat did you expect to see?
I expected
-fuzz=^FuzzName$
to match the docs and spec and behave like-run=^TestName$
:What did you see instead?
gotip test
proceeded to execute all of my regular tests in addition to the single fuzzing test that I'd specified. A workaround was to change the cmd togotip test -fuzz='^FuzzName$' -run='^FuzzName$'
and then it behaved as expected, running a single fuzzing test and nothing else.The text was updated successfully, but these errors were encountered: