Fixed all fuzzer targets (some API changes)
This commit is contained in:
@@ -12,5 +12,5 @@ fuzz_target!(|func: Func| {
|
|||||||
let _ = env_logger::try_init();
|
let _ = env_logger::try_init();
|
||||||
log::debug!("func:\n{:?}", func);
|
log::debug!("func:\n{:?}", func);
|
||||||
let env = regalloc2::fuzzing::func::machine_env();
|
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");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
use libfuzzer_sys::arbitrary::{Arbitrary, Result, Unstructured};
|
||||||
use libfuzzer_sys::fuzz_target;
|
use libfuzzer_sys::fuzz_target;
|
||||||
use libfuzzer_sys::arbitrary::{Arbitrary, Unstructured, Result};
|
|
||||||
|
|
||||||
use regalloc2::fuzzing::func::{Func, Options};
|
|
||||||
use regalloc2::checker::Checker;
|
use regalloc2::checker::Checker;
|
||||||
|
use regalloc2::fuzzing::func::{Func, Options};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct TestCase {
|
struct TestCase {
|
||||||
@@ -18,7 +18,9 @@ struct TestCase {
|
|||||||
impl Arbitrary for TestCase {
|
impl Arbitrary for TestCase {
|
||||||
fn arbitrary(u: &mut Unstructured) -> Result<TestCase> {
|
fn arbitrary(u: &mut Unstructured) -> Result<TestCase> {
|
||||||
Ok(TestCase {
|
Ok(TestCase {
|
||||||
func: Func::arbitrary_with_options(u, &Options {
|
func: Func::arbitrary_with_options(
|
||||||
|
u,
|
||||||
|
&Options {
|
||||||
reused_inputs: true,
|
reused_inputs: true,
|
||||||
fixed_regs: true,
|
fixed_regs: true,
|
||||||
clobbers: true,
|
clobbers: true,
|
||||||
@@ -27,7 +29,8 @@ impl Arbitrary for TestCase {
|
|||||||
block_params: true,
|
block_params: true,
|
||||||
always_local_uses: false,
|
always_local_uses: false,
|
||||||
reftypes: true,
|
reftypes: true,
|
||||||
})?,
|
},
|
||||||
|
)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +40,7 @@ fuzz_target!(|testcase: TestCase| {
|
|||||||
let _ = env_logger::try_init();
|
let _ = env_logger::try_init();
|
||||||
log::debug!("func:\n{:?}", func);
|
log::debug!("func:\n{:?}", func);
|
||||||
let env = regalloc2::fuzzing::func::machine_env();
|
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);
|
let mut checker = Checker::new(&func);
|
||||||
checker.prepare(&out);
|
checker.prepare(&out);
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ impl Arbitrary for TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fuzz_target!(|t: 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");
|
validate_ssa(&t.f, &cfginfo).expect("invalid SSA");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user