Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Add coverage_stats metric to inner loop to increase output. (#3607)
Browse files Browse the repository at this point in the history
* add

* Adding coverage output to every iteration of coverage task.

* Updating calls.

* Removing seen_input check.
  • Loading branch information
nharper285 authored Oct 31, 2023
1 parent ca6f3cd commit 82fffbe
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/agent/onefuzz-task/src/tasks/coverage/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ impl CoverageTask {

let heartbeat = self.config.common.init_heartbeat(None).await?;
let job_result = self.config.common.init_job_result().await?;
let mut seen_inputs = false;

let target_exe_path =
try_resolve_setup_relative_path(&self.config.common.setup_dir, &self.config.target_exe)
Expand Down Expand Up @@ -158,10 +157,6 @@ impl CoverageTask {
dir.init_pull().await?;
let dir_count = context.record_corpus(&dir.local_path).await?;

if dir_count > 0 {
seen_inputs = true;
}

info!(
"recorded coverage for {} inputs from {}",
dir_count,
Expand All @@ -171,12 +166,8 @@ impl CoverageTask {
context.heartbeat.alive();
}

if seen_inputs {
context.save_and_sync_coverage().await?;
}

context.save_and_sync_coverage().await?;
context.report_coverage_stats().await;

context.heartbeat.alive();

if let Some(queue) = &self.config.input_queue {
Expand Down Expand Up @@ -451,6 +442,8 @@ impl<'a> TaskContext<'a> {
// make sure we save & sync coverage every 10 inputs
if count % 10 == 0 {
self.save_and_sync_coverage().await?;
info!("report coverage");
self.report_coverage_stats().await;
}
}
} else {
Expand Down Expand Up @@ -576,8 +569,8 @@ impl<'a> Processor for TaskContext<'a> {
self.heartbeat.alive();

self.record_input(input).await?;
self.report_coverage_stats().await;
self.save_and_sync_coverage().await?;
self.report_coverage_stats().await;

Ok(())
}
Expand Down

0 comments on commit 82fffbe

Please sign in to comment.