Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a TestRunner that uses fuzzer for random generation. #117

Closed
Eh2406 opened this issue Dec 28, 2018 · 1 comment
Closed

Add a TestRunner that uses fuzzer for random generation. #117

Eh2406 opened this issue Dec 28, 2018 · 1 comment
Labels
feature-request This issue is requesting new functionality

Comments

@Eh2406
Copy link

Eh2406 commented Dec 28, 2018

If I understand correctly a big part of what a Strategy does is convert randomness from a TestRunner into a specific type, so that a test can be run on it. And a large part of the work in running cargo-fuzz is making a fuzz_target that takes &[u8] and converts it into something worth testing. So if we had an alternative TestRunner that could use &[u8] as its source of randomness, then it would be easy write a fuzz_target that can use the excellent syntax of proptest to define its assertions. (and possibly get shrinking for free.) To put it differently this would allow code reuse between the growing library/ecosystem of proptest Strategys and the ecosystem of fuzz testing.

cc blt/bughunt-rust#2
cc https://blog.troutwine.us/2018/10/08/hunting-for-bugs-in-rust/

@AltSysrq AltSysrq added feature-request This issue is requesting new functionality v-0.9.1 labels Feb 11, 2019
@AltSysrq
Copy link
Collaborator

I believe 0.9.1 has what's needed here.

let entropy: &[u8] = get_some_bytes();
let mut runner = TestRunner::new_with_rng(
    Config::default(),
    TestRng::from_seed(RngAlgorithm::PassThrough, entropy));

Please reopen if this addition isn't sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue is requesting new functionality
Projects
None yet
Development

No branches or pull requests

2 participants