tests-fuzz/README.md
cargo install cargo-fuzz
.env.example, which is at project root, to .env and change the values on need.Set the GreptimeDB MySQL address.
GT_MYSQL_ADDR = localhost:4002
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/
cargo fuzz list --fuzz-dir tests-fuzz
cargo fuzz run fuzz_create_table --fuzz-dir tests-fuzz -D -s none
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 -D -s none
Rerun the fuzz test with the input. You can override fuzz input with environment variables. For example, to override fuzz input like:
FuzzInput {
seed: 6666,
actions: 175
}
you can run with GT_FUZZ_OVERRIDE_SEED=6666 and GT_FUZZ_OVERRIDE_ACTIONS=175:
GT_FUZZ_OVERRIDE_SEED=6666 GT_FUZZ_OVERRIDE_ACTIONS=175 cargo fuzz run fuzz_target .crash --fuzz-dir tests-fuzz -D -s none
For more details, visit cargo fuzz or run the command cargo fuzz --help.
For fuzz_repartition_metric_table, dump artifacts are written under one run directory.
<logical_table>.table-data.csv<logical_table>.trace.sqlseed.metaSQL trace behavior:
started_at_ms and elapsed_ms.action_idx, started_at_ms, elapsed_ms, and SQL text.Run directory lifecycle: