fuzzgen: Fuzz ISA flags (#6001)
This commit is contained in:
@@ -179,9 +179,10 @@ impl TestCase {
|
||||
|
||||
// TestCase is meant to be consumed by a runner, so we make the assumption here that we're
|
||||
// generating a TargetIsa for the host.
|
||||
let builder =
|
||||
let mut builder =
|
||||
builder_with_options(true).expect("Unable to build a TargetIsa for the current host");
|
||||
let flags = gen.generate_flags(builder.triple().architecture)?;
|
||||
gen.set_isa_flags(&mut builder, IsaFlagGen::Host)?;
|
||||
let isa = builder.finish(flags)?;
|
||||
|
||||
// When generating functions, we allow each function to call any function that has
|
||||
|
||||
@@ -48,13 +48,15 @@ impl FunctionWithIsa {
|
||||
// a supported one, so that the same fuzz input works across different build
|
||||
// configurations.
|
||||
let target = u.choose(isa::ALL_ARCHITECTURES)?;
|
||||
let builder = isa::lookup_by_name(target).map_err(|_| arbitrary::Error::IncorrectFormat)?;
|
||||
let mut builder =
|
||||
isa::lookup_by_name(target).map_err(|_| arbitrary::Error::IncorrectFormat)?;
|
||||
let architecture = builder.triple().architecture;
|
||||
|
||||
let mut gen = FuzzGen::new(u);
|
||||
let flags = gen
|
||||
.generate_flags(architecture)
|
||||
.map_err(|_| arbitrary::Error::IncorrectFormat)?;
|
||||
gen.set_isa_flags(&mut builder, IsaFlagGen::All)?;
|
||||
let isa = builder
|
||||
.finish(flags)
|
||||
.map_err(|_| arbitrary::Error::IncorrectFormat)?;
|
||||
|
||||
Reference in New Issue
Block a user