fuzzgen: Generate multiple functions per testcase (#5765)
* fuzzgen: Generate multiple functions per testcase * fuzzgen: Fix typo Co-authored-by: Jamey Sharp <jamey@minilop.net> --------- Co-authored-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
@@ -114,16 +114,16 @@ impl TestFileCompiler {
|
||||
Self::with_host_isa(flags)
|
||||
}
|
||||
|
||||
/// Registers all functions in a [TestFile]. Additionally creates a trampoline for each one
|
||||
/// of them.
|
||||
pub fn add_testfile(&mut self, testfile: &TestFile) -> Result<()> {
|
||||
/// Declares and compiles all functions in `functions`. Additionally creates a trampoline for
|
||||
/// each one of them.
|
||||
pub fn add_functions(&mut self, functions: &[Function]) -> Result<()> {
|
||||
// Declare all functions in the file, so that they may refer to each other.
|
||||
for (func, _) in &testfile.functions {
|
||||
for func in functions {
|
||||
self.declare_function(func)?;
|
||||
}
|
||||
|
||||
// Define all functions and trampolines
|
||||
for (func, _) in &testfile.functions {
|
||||
for func in functions {
|
||||
self.define_function(func.clone())?;
|
||||
self.create_trampoline_for_function(func)?;
|
||||
}
|
||||
@@ -131,6 +131,20 @@ impl TestFileCompiler {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Registers all functions in a [TestFile]. Additionally creates a trampoline for each one
|
||||
/// of them.
|
||||
pub fn add_testfile(&mut self, testfile: &TestFile) -> Result<()> {
|
||||
let functions = testfile
|
||||
.functions
|
||||
.iter()
|
||||
.map(|(f, _)| f)
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
self.add_functions(&functions[..])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Declares a function an registers it as a linkable and callable target internally
|
||||
pub fn declare_function(&mut self, func: &Function) -> Result<()> {
|
||||
let next_id = self.defined_functions.len() as u32;
|
||||
|
||||
Reference in New Issue
Block a user