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

Add coverage_stats metric to inner loop to increase output. #3607

Merged
Merged
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions src/agent/onefuzz-task/src/tasks/coverage/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,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 All @@ -148,7 +147,6 @@ impl CoverageTask {

info!("report initial coverage");
context.report_coverage_stats().await;

context.heartbeat.alive();

for dir in &self.config.readonly_inputs {
Expand All @@ -157,10 +155,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 @@ -170,13 +164,8 @@ impl CoverageTask {
context.heartbeat.alive();
}

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

info!("report coverage");
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 @@ -446,6 +435,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 @@ -571,8 +562,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
Loading