(
&self,
fuzzer_code: Option<&Path>,
fuzzer_binary: &Path,
corpus_dir: Vec<&Path>,
)
| 485 | } |
| 486 | |
| 487 | pub fn collect_code_coverage( |
| 488 | &self, |
| 489 | fuzzer_code: Option<&Path>, |
| 490 | fuzzer_binary: &Path, |
| 491 | corpus_dir: Vec<&Path>, |
| 492 | ) -> Result<CodeCoverage> { |
| 493 | let work_dir = get_file_dirname(fuzzer_binary); |
| 494 | let profdata: PathBuf = crate::deopt::Deopt::get_coverage_file_by_dir(&work_dir); |
| 495 | if profdata.exists() { |
| 496 | std::fs::remove_file(&profdata)?; |
| 497 | } |
| 498 | |
| 499 | self.execute_cov_fuzzer_pool(fuzzer_binary, corpus_dir, &profdata)?; |
| 500 | if !profdata.exists() { |
| 501 | eyre::bail!("Failed to generate profdata file: {profdata:?}"); |
| 502 | } |
| 503 | |
| 504 | let cov = self.obtain_cov_from_profdata(&profdata)?; |
| 505 | if let Some(fuzzer_code) = fuzzer_code { |
| 506 | let lcov = |
| 507 | self.obtain_fuzzer_cov_from_profdata(&profdata, fuzzer_code, fuzzer_binary)?; |
| 508 | let cov = cov.set_fuzzer_lines(lcov); |
| 509 | return Ok(cov); |
| 510 | } |
| 511 | Ok(cov) |
| 512 | } |
| 513 | |
| 514 | pub fn symbolize_sancov_file(fuzzer_binary: &Path, sancov_file: &Path) -> Result<Option<Sancov>> { |
| 515 | let cmd = Command::new("sancov") |
no test coverage detected