(fuzzer_binary: &Path)
| 581 | } |
| 582 | |
| 583 | pub fn dump_fuzzer_coverage(fuzzer_binary: &Path) -> Result<String> { |
| 584 | let fuzzer_dir = get_file_dirname(fuzzer_binary); |
| 585 | let profdata: PathBuf = crate::deopt::Deopt::get_coverage_file_by_dir(&fuzzer_dir); |
| 586 | if !profdata.exists() { |
| 587 | eyre::bail!( |
| 588 | "Get coverage sanitizer message failed! profdata does not exist! {profdata:?}" |
| 589 | ) |
| 590 | } |
| 591 | let output = Command::new("llvm-cov") |
| 592 | .current_dir(fuzzer_dir) |
| 593 | .arg("show") |
| 594 | .arg(fuzzer_binary) |
| 595 | .arg(format!("--instr-profile={}", profdata.to_string_lossy())) |
| 596 | .arg("-name=LLVMFuzzerTestOneInput") |
| 597 | .stdout(Stdio::piped()) |
| 598 | .stderr(Stdio::piped()) |
| 599 | .output()?; |
| 600 | if !output.status.success() { |
| 601 | eyre::bail!( |
| 602 | "Get coverage sanitizer message failed! {}", |
| 603 | String::from_utf8_lossy(&output.stderr) |
| 604 | ) |
| 605 | } |
| 606 | let msg = String::from_utf8_lossy(&output.stdout).to_string(); |
| 607 | Ok(msg) |
| 608 | } |
| 609 | |
| 610 | /// parse line coverage of fuzzer (not library) from lcov data |
| 611 | pub fn parse_fuzzer_lcov_data(lcov: &str, file: &Path) -> Result<Vec<CovLine>> { |
no test coverage detected