diff --git a/src/agent/onefuzz-agent/src/tasks/coverage/generic.rs b/src/agent/onefuzz-agent/src/tasks/coverage/generic.rs index 7f546e4c1e..e6690c7975 100644 --- a/src/agent/onefuzz-agent/src/tasks/coverage/generic.rs +++ b/src/agent/onefuzz-agent/src/tasks/coverage/generic.rs @@ -11,6 +11,7 @@ use anyhow::{Context, Result}; use async_trait::async_trait; use coverage::block::CommandBlockCov; use coverage::cache::ModuleCache; +use coverage::cobertura::cobertura; use coverage::code::{CmdFilter, CmdFilterDef}; use coverage::debuginfo::DebugInfo; use onefuzz::expand::{Expand, PlaceHolder}; @@ -30,6 +31,7 @@ use crate::tasks::heartbeat::{HeartbeatSender, TaskHeartbeatClient}; const MAX_COVERAGE_RECORDING_ATTEMPTS: usize = 2; const COVERAGE_FILE: &str = "coverage.json"; const SOURCE_COVERAGE_FILE: &str = "source-coverage.json"; +const COBERTURA_COVERAGE_FILE: &str = "cobertura-coverage.xml"; const MODULE_CACHE_FILE: &str = "module-cache.json"; const DEFAULT_TARGET_TIMEOUT: Duration = Duration::from_secs(5); @@ -362,6 +364,16 @@ impl<'a> TaskContext<'a> { .await .with_context(|| format!("writing source coverage to {}", path.display()))?; + let path = self + .config + .coverage + .local_path + .join(COBERTURA_COVERAGE_FILE); + let cobertura_source_coverage = cobertura(src_coverage)?; + fs::write(&path, &cobertura_source_coverage) + .await + .with_context(|| format!("writing cobertura source coverage to {}", path.display()))?; + self.config.coverage.sync_push().await?; Ok(())