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

[dev.fuzz] proposal: replace -keepfuzzing with -[test.]failfast #45690

Closed
AlekSi opened this issue Apr 22, 2021 · 6 comments
Closed

[dev.fuzz] proposal: replace -keepfuzzing with -[test.]failfast #45690

AlekSi opened this issue Apr 22, 2021 · 6 comments
Labels
FrozenDueToAge fuzz Issues related to native fuzzing support NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@AlekSi
Copy link
Contributor

AlekSi commented Apr 22, 2021

-keepfuzzing
    Keep running the target if a crasher is found. (default false)
-failfast
    do not start new tests after the first test failure

Is it possible to change -failfast's implicit value from false to true if -fuzz flag is passed? If yes, I think -keepfuzzing flag could be removed as it means virtually the same thing.

@AlekSi
Copy link
Contributor Author

AlekSi commented Apr 22, 2021

@gopherbot fuzz

@gopherbot gopherbot added the fuzz Issues related to native fuzzing support label Apr 22, 2021
@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 26, 2021
@cherrymui
Copy link
Member

cc @katiehockman

@cherrymui cherrymui added this to the Unplanned milestone Apr 26, 2021
@katiehockman
Copy link
Contributor

The problem with using test.failfast is that the default value, false, would be incorrect when fuzzing. If we translate that to fuzzing, a default where "do not start new tests after the first test failure" is false would mean that the fuzzing engine should keep running after the first test failure. That's the opposite of the default behavior of fuzzing today, where it panics and stops after it finds the first crash. There could be an argument to be made that the default behavior should change, in which case it may make sense to combine the flags, but that's a different conversation.

@AlekSi
Copy link
Contributor Author

AlekSi commented Apr 26, 2021

The problem with using test.failfast is that the default value, false, would be incorrect when fuzzing.

Yes, that why I asked if we can change "implicit value from false to true if -fuzz flag is passed"? We do change the default value of -timeout flag at #44483 (comment), so maybe we should do the same there?

@katiehockman
Copy link
Contributor

Yes, that why I asked if we can change "implicit value from false to true if -fuzz flag is passed"?

We could, but keep in mind that the current behavior of go test -fuzz is to run all the other tests in that package, and all of the seed corpus, and if all of those succeed, start to fuzz. We could consider changing that, but let's assume for now that this is the behavior that we want. I could see a user wanting to run go test -fuzz=FuzzFoo -failfast=false -keepfuzzing=false, which would mean "Run the unit tests and report all failures that occurred. If those succeeded, then start fuzzing, and stop when you find the first crasher." That wouldn't be possible if we combine the flags into one.

Consider the default behavior:
Someone runs go test -fuzz=FuzzFoo, which defaults to -failfast=true since -fuzz is set. That means that if any of the unit tests fail, then it will fail fast and won't run the rest of the unit tests. That would surprise me, personally. As a user, I would want all of the unit tests and the seed corpus to be run in the exact same way with go test -fuzz as it would with go test by default, with the only difference being that the fuzzing engine will run if all of the tests pass.

@AlekSi
Copy link
Contributor Author

AlekSi commented Apr 27, 2021

Thank you for the explanation; I understand it now and agree with you. I am closing the issue.

As a side note, we did a workshop about fuzzing using dev.fuzz on GopherCon Russia last Sunday (in Russian), and it went great! Looking forward to dev.fuzz being shipped.

@AlekSi AlekSi closed this as completed Apr 27, 2021
@golang golang locked and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge fuzz Issues related to native fuzzing support NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants