17 unstable releases (7 breaking)

0.11.2 Jun 11, 2024
0.10.2 Mar 4, 2024
0.10.0 Sep 28, 2023
0.9.1 May 15, 2023
0.4.1 Jan 22, 2020

#415 in Testing

Download history 2009/week @ 2024-04-04 1499/week @ 2024-04-11 2224/week @ 2024-04-18 2340/week @ 2024-04-25 3815/week @ 2024-05-02 3524/week @ 2024-05-09 3998/week @ 2024-05-16 6138/week @ 2024-05-23 6929/week @ 2024-05-30 7516/week @ 2024-06-06 6086/week @ 2024-06-13 6543/week @ 2024-06-20 5310/week @ 2024-06-27 8683/week @ 2024-07-04 9212/week @ 2024-07-11 8869/week @ 2024-07-18

33,545 downloads per month
Used in 31 crates (5 directly)

MIT license

180KB
5K SLoC

bolero

Build Status Latest version Documentation License

fuzz and property testing front-end for Rust

Book

A copy of the Bolero Book can be found here: http://camshaft.github.io/bolero

Quick Start

  1. Install subcommand and add a dependency

    $ cargo add --dev bolero
    $ cargo install -f cargo-bolero
    
  2. Write a test using bolero::check! macro:

    pub fn buggy_add(x: u32, y: u32) -> u32 {
        if x == 12976 && y == 14867 {
            return x.wrapping_sub(y);
        }
        return x.wrapping_add(y);
    }
    
    #[test]
    fn fuzz_add() {
        bolero::check!()
            .with_type()
            .cloned()
            .for_each(|(a, b)| buggy_add(a, b) == a.wrapping_add(b));
    }
    
  3. Run the test with cargo bolero

    $ cargo bolero test fuzz_add
    
    # ... some moments later ...
    
    ======================== Test Failure ========================
    
    Input:
    (
        12976,
        14867,
    )
    
    Error:
    test returned `false`
    
    ==============================================================
    

Linux Installation

cargo-bolero needs a couple of libraries installed to compile. If these libraries aren't available the requirement can be relaxed by executing cargo install cargo-bolero --no-default-features -f

Debian/Ubuntu

$ sudo apt install binutils-dev libunwind-dev

Dependencies

~7.5MB
~152K SLoC