-
-
Notifications
You must be signed in to change notification settings - Fork 582
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
Added fuzzer to be run with OSS-Fuzz #772
Conversation
Codecov Report
@@ Coverage Diff @@
## main #772 +/- ##
=======================================
Coverage 96.37% 96.37%
=======================================
Files 17 17
Lines 2703 2703
Branches 309 309
=======================================
Hits 2605 2605
Misses 79 79
Partials 19 19 Continue to review full report at Codecov.
|
Cool! So the idea here which I think I'm OK with is to get something here that we can run and iterate on without needing to touch the upstream OSS-Fuzz repo, right? I think to @Zac-HD's point what's here so far likely wouldn't "do" much utility wise but with some tweaks hopefully would. So we could just push forward and work on those tweaks. I do think much as it might seem annoying, that we should address the coverage failure -- meaning, it would be good to have a "test" that executes the fuzzer for some extremely tiny amount, just so that we know any API changes don't suddenly silently break integration with OSS-Fuzz. Does that make sense to you / seem like it'd be non-totally-terrible to do? The hardest part may be that module here which may need stubbing that's OSS-Fuzz specific? Let me know thoughts otherwise I can think myself about what that might look like, but yeah do think it'd be nice if somewhere locally here in CI we knew this script continued to function. |
I understand your concern although having integrated loads of projects into OSS-Fuzz it's a first to actually write tests that tests the fuzzers. How about doing the following approach - I added a |
Yep, no iterations needed from you on OSS-Fuzz. Also, we are collaborating with the OSS-Fuzz folks so you can ping me whenever if you think there is something going that needs fixing in OSS-Fuzz and I will handle it for you. But by default you will not need to touch OSS-Fuzz. |
I think even if this were 2 seconds rather than 600 seconds that my concern would be addressed. It's just "make sure the thing runs" any time someone makes a change to it. |
The reason I set 600 seconds is because OSS-Fuzz sets it as a minimum (https://google.github.io/oss-fuzz/getting-started/continuous-integration/#integrating-into-your-repository) |
It's not really a minimum, that's the docs saying any less than that and it's not very useful for fuzzing not that it will fail the build or anything -- let's set it to 30 seconds I think. Looks like it's failing now though for some config reason? |
I recon this is because the project is not ready integrated in OSS-Fuzz (we are waiting for this to merge) |
Ah fair enough. Can you maybe make that job not fail the build then (that might be reasonable even going forward perhaps)? After that sounding like we're close to merge. |
Could you clarify on this one - am not sure I understand (this is the first time I integrate a CI job). Do you mean make it not fail by merging things in OSS-Fuzz, or do you mean not fail by changing something in the |
I think I got a solution you were looking for now @Julian - now the CIFuzz job will exit with success in case the |
Hooray. Will have a close look in the morning when I've got a clean mind but think that's perfect! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nice way to ensure everything is covered is to run the fuzz harness as a test function! Specifically:
- Rename the file as e.g.
test_foo_fuzz.py
, so thatpytest
collects it; - Adjust the glob pattern in the OSS-Fuzz config to detect
*fuzz.py
instead offuzz_*.py
- Move
import atheris
into theif __name__ == "__main__":
block, so that it's a fuzz-time but not a test-time dependency
And then it'll be covered as expected (modulo perhaps a coverage pragma on the __name__
branch...)
@DavidKorczynski apologies for the delay here, have been dealing with some other stuff first, but hopefully will get to merging this by the end of the weekend. |
No problem @Julian - please take your time and handle this when it makes sense to you. There is no stress from my side. |
* main: Reskip the PyPy-on-Windows tests. Try the Twisted prerelease, which hopefully obviates installing IOCP. No, don't use venv. Fix test to windows path matching Test via PyPy3.7 Unskip most of the skipped windows builds. Update pre-commit.
Run only against main for now, save some time on PRs.
Hypothesis isn't a current testing dependency, so as this was before (where it was named test_* and discovered by the test runner) there are CI failures for the normal test suite run. In the future hypothesis will likely become a normal testing dependency and then we can run this as well, but for now, only run it in the CIFuzz job.
@DavidKorczynski apologies here that this slipped, but I'm likely about to merge as soon as CI passes (which I put some minor changes in for). I did re-rename this back to You'll obviously see when/if I merge in a bit after I see the build go green. |
Wohoooo - we got it done :)! google/oss-fuzz#4996 Thanks @Zac-HD for the input and thanks @Julian for getting it merged in. |
Thank you! |
Adds a fuzzer as a step to integrating into OSS-Fuzz.
Cross-referencing
@Julian I now added more structure to it by way of Hypothesis and am happy to put more effort in. I think it would be nice to get it up and running on OSS-Fuzz though, so we can start to see when results happen.
@Zac-HD Thanks for your assistance in the other issue. Will keep digging into Hypothesis!