linked with LibFuzzer and AddressSanitizer, to check whether code is correct.
(&self, program_path: &Path)
| 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:?}"); |
no test coverage detected