no_std support

This commit is contained in:
Dominik Maier 2020-11-21 17:10:29 +01:00
parent 8247be32f9
commit 41d3711ac7
2 changed files with 14 additions and 3 deletions

View File

@ -6,6 +6,10 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["std"]
std = []
[dependencies]
afl = { path = "../../" }

View File

@ -1,6 +1,11 @@
use std::boxed::Box;
use std::cell::RefCell;
use std::rc::Rc;
#![cfg_attr(not(feature = "std"), no_std)]
#[macro_use]
extern crate alloc;
use alloc::boxed::Box;
use alloc::rc::Rc;
use core::cell::RefCell;
use afl::corpus::{Corpus, InMemoryCorpus, Testcase};
use afl::engines::{DefaultEngine, DefaultState, Engine, State};
@ -62,5 +67,7 @@ pub extern "C" fn afl_libfuzzer_main() {
.fuzz_one(&mut state)
.expect(&format!("Error in iter {}", i));
}
#[cfg(feature = "std")]
println!("OK");
}