MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / is_program_fuzz_correct

Method is_program_fuzz_correct

src/execution/sanitize.rs:80–100  ·  view source on GitHub ↗

linked with LibFuzzer and AddressSanitizer, to check whether code is correct.

(&self, program_path: &Path)

Source from the content-addressed store, hash-verified

78
79 /// linked with LibFuzzer and AddressSanitizer, to check whether code is correct.
80 pub fn is_program_fuzz_correct(&self, program_path: &Path) -> Result<Option<ProgramError>> {
81 log::trace!("test program is fuzz correct: {program_path:?}");
82 let work_dir = get_file_dirname(program_path);
83 let time_logger = TimeUsage::new(work_dir.clone());
84
85 let binary_out = program_path.with_extension("out");
86
87 // execute fuzzer for duration timeout.
88 let corpus_dir: PathBuf = [work_dir, "corpus".into()].iter().collect();
89 crate::deopt::utils::create_dir_if_nonexist(&corpus_dir)?;
90
91 let res = self.execute_fuzzer(
92 &binary_out,
93 vec![&corpus_dir, &self.deopt.get_library_shared_corpus_dir()?],
94 );
95 time_logger.log("fuzz")?;
96 if let Err(err) = res {
97 return Ok(Some(ProgramError::Fuzzer(err.to_string())));
98 }
99 Ok(None)
100 }
101
102 pub fn is_program_coverage_correct(&self, program_path: &Path) -> Result<Option<ProgramError>> {
103 log::trace!("test program is coverage correct: {program_path:?}");

Callers 1

Calls 5

get_file_dirnameFunction · 0.85
create_dir_if_nonexistFunction · 0.85
FuzzerClass · 0.85
execute_fuzzerMethod · 0.80
logMethod · 0.80

Tested by

no test coverage detected