1
1
mirror of https://github.com/oxalica/nil.git synced 2024-10-27 04:19:40 +03:00

Setup fuzzer for parser

This commit is contained in:
oxalica 2022-08-09 15:14:02 +08:00
parent f2006b83d1
commit 9f9dc6a9ae
4 changed files with 43 additions and 0 deletions

View File

@ -44,5 +44,13 @@
export NIL_PATH="$(cargo metadata --format-version=1 | jq -r .target_directory)/release/nil"
'';
};
devShells.fuzz = pkgs.mkShell {
packages = [
rustPkgs.rust-nightly_2022-08-01
pkgs.cargo-fuzz
];
RUST_BACKTRACE = 1;
};
});
}

4
syntax/fuzz/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
target
corpus
artifacts
Cargo.lock

25
syntax/fuzz/Cargo.toml Normal file
View File

@ -0,0 +1,25 @@
[package]
name = "syntax-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.4"
[dependencies.syntax]
path = ".."
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "parser"
path = "fuzz_targets/parser.rs"
test = false
doc = false

View File

@ -0,0 +1,6 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|text: &str| {
syntax::parse_file(text);
});