-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a fuzzing task for the rust parser. This is run as release to avoid various debug assertions in the project. I've had this running on my workstation and it hasn't found anything, but it is useful to keep in CI to catch regressions. I recongize that fuzzing adds extra time to the pipeline, so I did a few things to try and minimize the impact. * First, it is a seperate, parallel workflow. Since the main build and test is a debug build and fuzz is a release build there is very little wasted work in rebuilding. * Second, I added caches for both tasks. This should help keep build time town in general. * The time the fuzzing task will run is capped at 2 minutes. This is pretty short. This was picked to not be too much longer than previous runs. This is a bit of a trade off. The longer this value is, the better the coverage. Later I will take a look at having it excercise more parser configuration options to get better coverage. At first I just wanted to try and cover the default case well.
- Loading branch information
Showing
9 changed files
with
96 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
target/ | ||
.DS_Store | ||
out/ | ||
.idea |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
corpus | ||
artifacts | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "cooklang-fuzz" | ||
version = "0.0.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
libfuzzer-sys = "0.4" | ||
|
||
[dependencies.cooklang] | ||
path = ".." | ||
|
||
[[bin]] | ||
name = "fuzz_parser" | ||
path = "fuzz_targets/fuzz_parser.rs" | ||
test = false | ||
doc = false | ||
bench = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![no_main] | ||
|
||
use libfuzzer_sys::fuzz_target; | ||
|
||
use cooklang::{CooklangParser, Extensions, Converter}; | ||
|
||
fuzz_target!(|contents: &str| { | ||
let parser = CooklangParser::new(Extensions::all(), Converter::default()); | ||
let _ = parser.parse(&contents); | ||
}); |