Skip to content
Myr

README.md

This file

Path

fuzz/README.md

52 lines · 1.6 KiB · Markdown

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 5f5da48 point at it.

globset: support nested alternatesLuke Sandbergbefore adoption5f5da48

lines 1–52why, one step back
1# Fuzz Testing
23## Introduction45Fuzz testing produces pseudo-random / arbitrary data that is used to find6stability issues within a code base. While Rust provides a strong type system,7this does not guarantee that an object will convert properly from one struct8to another. It is the responsibility of the developer to ensure that a struct9is converted properly. Fuzz testing will generate input within the domain of10each property. This arbitrary data can then be used to convert from ObjectA11to ObjectB and then back. This type of testing will help catch bugs that the12type system is not able to see.1314## Installation1516This crate relies on the `cargo-fuzz` component. To install this component,17run the following from the `fuzz` directory:1819```bash20cargo install cargo-fuzz21```2223## Listing Targets2425Once installed, fuzz targets can be listed by running the following command:2627```bash28cargo fuzz list29```3031This command will print out a list of all targets that can be tested.3233## Running Fuzz Tests3435To run a fuzz test, the target must be specified:3637```bash38cargo fuzz run <target>39```4041Note that the above will run the fuzz test indefinitely. Use the42`-max_total_time=<num seconds>` flag to specify how many seconds the test43should run for:4445```bash46cargo fuzz run <target> -- -max_total_time=547```4849The above command will run the fuzz test for five seconds. If the test50completes without error it will show how many tests were run successfully.51The test will abort and return a non-zero error code if it is able to produce52an error. The arbitrary input will be displayed in the event of a failure.