Skip to content

Commit

Permalink
Fuzzing tests for Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
XuJiandong committed May 9, 2024
1 parent 6c92179 commit 846d025
Show file tree
Hide file tree
Showing 22 changed files with 2,385 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fuzzing/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
fuzzer
coverage
fuzz-*.log
crash-*
*.profraw
coverage_dir
manually-gen
target
corpus
artifacts
7 changes: 7 additions & 0 deletions fuzzing/c/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fuzzer
coverage
fuzz-*.log
crash-*
*.profraw
coverage_dir
manually-gen
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions fuzzing/rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
reader.html
data.html
37 changes: 37 additions & 0 deletions fuzzing/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions fuzzing/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "molecule-fuzzing"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
molecule = { path = "../../bindings/rust" }
19 changes: 19 additions & 0 deletions fuzzing/rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

### Introduction

See https://rust-fuzz.github.io/book/introduction.html

### Run
```
cargo fuzz run data
```

### Coverage Report

```
cargo fuzz coverage data
cargo cov -- show target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/data \
--format=html \
-instr-profile=fuzz/coverage/data/coverage.profdata \
> data.html
```
4 changes: 4 additions & 0 deletions fuzzing/rust/fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target
corpus
artifacts
coverage
94 changes: 94 additions & 0 deletions fuzzing/rust/fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions fuzzing/rust/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "molecule-fuzzer"
version = "0.1.0"
publish = false
edition = "2021"

[package.metadata]
cargo-fuzz = true

[dependencies]
libfuzzer-sys = "0.4"

[dependencies.molecule-fuzzing]
path = ".."

[[bin]]
name = "data"
path = "fuzz_targets/data.rs"
test = false
doc = false
bench = false
Loading

0 comments on commit 846d025

Please sign in to comment.