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 proper tests for CI #69
Comments
@ner0x652 want to work on this? |
@Manishearth If it doesn't need beyond intermediate level of Rust knowledge, then YES! (tomorrow after work) |
It would mostly be a shell script that does the steps above. We'd probably check in the test crate to be fuzzed. |
Willing to help if you need any. |
Good! 👍 |
@Manishearth left 2 links on IRC, in case you didn't see them here is what I wrote: # This script leaves in /scripts, go to parent, this should be needed only locally
cd ..
mkdir etc && cd etc
cargo new testcrate
cd testcrate
testcrate_lib_source="
pub fn test_func(slice: &[u8]) {
if slice.len() == 7 {
panic!(\"I'm afraid of number 7\");
}
}
"
echo "$testcrate_lib_source" > src/lib.rs
cargo build
cargo-fuzz init
fuzzer_script_source="
#![no_main]
extern crate libfuzzer_sys;
extern crate testcrate;
use testcrate::test_func;
#[export_name=\"rust_fuzzer_test_input\"]
pub extern fn go(data: &[u8]) {
test_func(data);
}
"
echo "$fuzzer_script_source" > fuzz/fuzzers/fuzzer_script_1.rs
cargo-fuzz run fuzzer_script_1 And this is the new travis.yml language: rust
rust:
- stable
- beta
- nightly
os:
- linux
matrix:
fast_finish: true
notifications:
email: false
deploy:
provider: script
script: scripts/deploy.sh
on:
branch: master Is this (close to) what you were thinking of? |
Just check in the testcrate into Also, use sed to replace the body of |
Fixed in #92 . Thanks, @ner0x652 ! |
Thank you @Manishearth , too! |
It should cd to a test crate directory, that contains a single function which panics on an input of size 6 or something, then fuzz init, edit the fuzz target to call this function, run the fuzz target, and ensure a crashfile is produced of the correct length.
The text was updated successfully, but these errors were encountered: