Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
97: Add fuzzing r=matklad a=matklad Results are mixed: fuzzer found a manually injected `if text.starts_with('}') { panic!() }` failure, as well as "nobody needs indent larger than 80" implementation limitation. However, fuzzer wasn't able to replicate #93 :-( If we want to run this on CI, we should add something like *somewhere*, but I am a little confused about our CI infra. I think I can add this to the end of `ci.sh`, but, ideally, this should run as a parallel CI job ``` rustup run nightly -- cargo fuzz run fmt -- -max_total_time=300 ``` closes #88 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
- Loading branch information
Showing
10 changed files
with
283 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,3 @@ rnix = { git = "https://gitlab.com/jD91mZM2/rnix.git" } | |
|
||
[dev-dependencies] | ||
unindent = "0.1.3" | ||
|
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,3 @@ | ||
Cargo.lock | ||
target | ||
corpus |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "nixpkgs-fmt-fuzz" | ||
version = "0.0.1" | ||
authors = [] | ||
publish = false | ||
edition = "2018" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
nixpkgs-fmt = { path = "../" } | ||
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" } | ||
|
||
# Prevent this from interfering with workspaces | ||
[workspace] | ||
members = ["."] | ||
|
||
[[bin]] | ||
name = "fmt" | ||
path = "fuzz_targets/fmt.rs" |
Binary file not shown.
Binary file not shown.
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] | ||
|
||
#[macro_use] | ||
extern crate libfuzzer_sys; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
if let Ok(text) = std::str::from_utf8(data) { | ||
nixpkgs_fmt::reformat_string(text); | ||
} | ||
}); |
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