tree: e5abb802e88f848d9d3becd55f1ee890da7c6837 [path history] [tgz]
  1. .gitignore
  2. Cargo.toml
  3. fuzz_reader.rs
  4. fuzz_writer.rs
  5. README.md
core/fuzz/README.md

Fuzz Test for OpenDAL

fuzz test are used to test the robustness of the code.

Setup

To run the fuzz tests, please copy the .env.example, which is at project root, to .env and change the values on need.

Take fs for example, we need to change to enable fuzz test on fs on /tmp.

OPENDAL_TEST=fs
OPENDAL_FS_ROOT=/path/to/dir/

into

OPENDAL_TEST=fs
OPENDAL_FS_ROOT=/tmp/

Run

List all fuzz targets.

cargo +nightly fuzz list

Build fuzz targets.

cargo +nightly fuzz build

Run a fuzz target(such as reader).

cargo +nightly fuzz run fuzz_reader

Crash Reproduction

If you want to reproduce a crash, you first need to obtain the Base64 encoded code, which usually appears at the end of a crash report, and store it in a file.

Alternatively, if you already have the crash file, you can skip this step.

echo "Base64" > .crash

Print the std::fmt::Debug output for an input.

cargo +nightly fuzz fmt fuzz_target .crash

Rerun the fuzz test with the input.

cargo +nightly fuzz run fuzz_target .crash

For more details, please visit cargo fuzz or run the command cargo fuzz --help.