mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 05:12:54 +00:00
* feat: implement unstable_fuzz_create_table_standalone * chore: use drop database * docs: update docs * chore: add ci config * chore: add feature gate * fix: fix clippy * chore: update ci * Apply suggestions from code review * feat: reduce num * Apply suggestions from code review * chore: apply suggestions from CR * Apply suggestions from code review * chore: reduce `wait_timeout` in health check * Update .env.example * refactor: use `init_greptime_connections_via_env` * refactor: use `init_greptime_connections_via_env` --------- Co-authored-by: tison <wander4096@gmail.com>
Fuzz Test for GreptimeDB
Setup
- Install the fuzz cli first.
cargo install cargo-fuzz
- Start GreptimeDB
- Copy the
.env.example, which is at project root, to.envand change the values on need.
For stable fuzz tests
Set the GreptimeDB MySQL address.
GT_MYSQL_ADDR = localhost:4002
For unstable fuzz tests
Set the binary path of the GreptimeDB:
GT_FUZZ_BINARY_PATH = /path/to/
Change the instance root directory(the default value: /tmp/unstable_greptime/)
GT_FUZZ_INSTANCE_ROOT_DIR = /path/to/
Run
- List all fuzz targets
cargo fuzz list --fuzz-dir tests-fuzz
- Run a fuzz target.
cargo fuzz run fuzz_create_table --fuzz-dir tests-fuzz
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 fuzz fmt fuzz_target .crash --fuzz-dir tests-fuzz
Rerun the fuzz test with the input.
cargo fuzz run fuzz_target .crash --fuzz-dir tests-fuzz
For more details, visit cargo fuzz or run the command cargo fuzz --help.