This fuzzer can generate rust programs by mutating existing rust programs.
The programs generated by RustMutFuzz will remain type-safe if the input programs were also type-safe. It works by replacing each expression with a new expressions of the same type.
The purpose of RustMutFuzz is to test Rust's code generator. It generates input programs to run through the compiler. Preserving the type safety of the input programs ensures that all the generated programs will get past the typechecker, which means they can reach the code generator. Without that type safety, the generated programs would just be testing the typechecker.
Example fuzzer usage:
cargo run -- --input PATH_TO_INPUT_FILES --output OUTPUT_PATH --programs 10 --max-depth 3 --stop-prob 0.5
The above command will generate rust 10 programs for each input file it finds.
You can also use test_check to test the output of the generated programs against their associated original programs.
Example test_check usage:
cd test_check
cargo run -- --input PATH_TO_GENERATED_FILES --output-dir WHERE_TO_OUTPUT_THE_RESULTS --original PATH_TO_ORIGINAL_FILES