Skip to content
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

test: add fuzz testing #253

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,26 @@ you must also update the snapshot for the Windows environment.
In this case, you can create a pull request for draft mode and execute `/snapshot` to create a diff file for Windows.
Generated diff can be copied into a file and applied by `git diff <file-name>` command.

#### Fuzz testing
We use fuzz testing to verify the implementation of our parser.

You can find resources related to fuzz testing in Rust in the following links:

* [Rust Fuzz Book](https://rust-fuzz.github.io/book/introduction.html)
* [Instrumentation-based Code Coverage - The rustc book](https://doc.rust-lang.org/stable/rustc/instrument-coverage.html)

If you want to quickly run the fuzz tests with libfuzzer, you can use the following commands:

```bash
# Install cargo-fuzz
cargo +nightly install cargo-fuzz
# Start a series of fuzz tests
cargo +nightly fuzz run -j $(nproc) parse_dynein_format -- -dict=fuzz/fuzz_dict
cargo +nightly fuzz run -j $(nproc) parse_remove_action -- -dict=fuzz/fuzz_dict
cargo +nightly fuzz run -j $(nproc) parse_set_action -- -dict=fuzz/fuzz_dict
cargo +nightly fuzz run -j $(nproc) parse_sort_key_with_fallback -- -dict=fuzz/fuzz_dict
cargo +nightly fuzz run -j $(nproc) parse_sort_key_with_suggest -- -dict=fuzz/fuzz_dict
```

## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
Expand Down
21 changes: 21 additions & 0 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ repository = "https://github.com/awslabs/dynein"
keywords = ["cli", "dynamodb", "aws"]
categories = ["command-line-utilities"]

[lib]
name = "dylib"
path = "src/lib.rs"

[[bin]]
name = "dy"
path = "src/main.rs"

[features]
default = []

[dependencies]
arbitrary = { version = "1", features = ["derive"], optional = true }
aws-config = "1.4.0"
aws-sdk-dynamodb = "1.28.0"
aws-sdk-ec2 = "1.42.0"
Expand Down
4 changes: 4 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target
corpus
artifacts
coverage
Loading