Fixed all fuzzer targets (some API changes)

This commit is contained in:
Chris Fallin
2021-05-19 18:25:34 -07:00
parent f1c6dfe807
commit f56676fb8d
3 changed files with 18 additions and 15 deletions

View File

@@ -12,5 +12,5 @@ fuzz_target!(|func: Func| {
let _ = env_logger::try_init();
log::debug!("func:\n{:?}", func);
let env = regalloc2::fuzzing::func::machine_env();
let _out = regalloc2::ion::run(&func, &env).expect("regalloc did not succeed");
let _out = regalloc2::ion::run(&func, &env, false).expect("regalloc did not succeed");
});

View File

@@ -4,11 +4,11 @@
*/
#![no_main]
use libfuzzer_sys::arbitrary::{Arbitrary, Result, Unstructured};
use libfuzzer_sys::fuzz_target;
use libfuzzer_sys::arbitrary::{Arbitrary, Unstructured, Result};
use regalloc2::fuzzing::func::{Func, Options};
use regalloc2::checker::Checker;
use regalloc2::fuzzing::func::{Func, Options};
#[derive(Clone, Debug)]
struct TestCase {
@@ -18,7 +18,9 @@ struct TestCase {
impl Arbitrary for TestCase {
fn arbitrary(u: &mut Unstructured) -> Result<TestCase> {
Ok(TestCase {
func: Func::arbitrary_with_options(u, &Options {
func: Func::arbitrary_with_options(
u,
&Options {
reused_inputs: true,
fixed_regs: true,
clobbers: true,
@@ -27,7 +29,8 @@ impl Arbitrary for TestCase {
block_params: true,
always_local_uses: false,
reftypes: true,
})?,
},
)?,
})
}
}
@@ -37,7 +40,7 @@ fuzz_target!(|testcase: TestCase| {
let _ = env_logger::try_init();
log::debug!("func:\n{:?}", func);
let env = regalloc2::fuzzing::func::machine_env();
let out = regalloc2::ion::run(&func, &env).expect("regalloc did not succeed");
let out = regalloc2::ion::run(&func, &env, true).expect("regalloc did not succeed");
let mut checker = Checker::new(&func);
checker.prepare(&out);

View File

@@ -37,6 +37,6 @@ impl Arbitrary for TestCase {
}
fuzz_target!(|t: TestCase| {
let cfginfo = CFGInfo::new(&t.f);
let cfginfo = CFGInfo::new(&t.f).expect("could not create CFG info");
validate_ssa(&t.f, &cfginfo).expect("invalid SSA");
});