Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(coverage): caching for coverage #9366

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
39c5922
fix(`coverage`): write coverage artifacts to separate dir
yash-atreya Nov 20, 2024
215ac18
Merge branch 'master' into yash/fix-8840
yash-atreya Nov 21, 2024
20b09e8
adjust cache path for coverage
yash-atreya Nov 21, 2024
581cf4c
partial test
yash-atreya Nov 21, 2024
a0d7e19
enable cache
yash-atreya Nov 21, 2024
c59364a
don't assume recompilation
yash-atreya Nov 21, 2024
66cfb3d
fix(`coverage`): dont recompile when cache exists
yash-atreya Nov 21, 2024
730b26d
Merge branch 'master' into yash/fix-8840
yash-atreya Nov 21, 2024
0eadcfa
account for cached compiled artifacts at once
yash-atreya Nov 22, 2024
9902adf
test with multi solc versions
yash-atreya Nov 22, 2024
0433863
fix(`forge clean`): remove cache/coverage dir
yash-atreya Nov 22, 2024
e90a354
add test
klkvr Nov 22, 2024
7d639e6
fix(`coverage`): account for `build_id` in source identification (#9…
yash-atreya Nov 27, 2024
2b1af19
fix
yash-atreya Nov 29, 2024
498e427
rm version as key in report
yash-atreya Nov 29, 2024
06f01dc
rm version key from ContractId and report.items
yash-atreya Nov 29, 2024
38db689
fix: scale anchor.items_id
yash-atreya Nov 29, 2024
a6edce9
fix: rm dependence of coverage on version
yash-atreya Nov 29, 2024
8297739
fix: respect artifact.build_id while processing hitmaps
yash-atreya Nov 29, 2024
13d3fd7
fix: respect element idx
yash-atreya Nov 29, 2024
973cfe0
key source_ids by version and path
yash-atreya Dec 2, 2024
2eaab46
Merge branch 'master' into yash/fix-8840
yash-atreya Dec 2, 2024
1624587
nit
yash-atreya Dec 2, 2024
860ff71
Merge branch 'master' into yash/fix-8840
yash-atreya Dec 13, 2024
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
11 changes: 11 additions & 0 deletions crates/forge/bin/cmd/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ impl CoverageArgs {
fn build(&self, config: &Config) -> Result<(Project, ProjectCompileOutput)> {
// Set up the project
let mut project = config.create_project(false, false)?;

// Set a different artifacts path for coverage. `out/coverage`.
// This is done to avoid overwriting the artifacts of the main build that maybe built with
// different optimizer settings or --via-ir. Optimizer settings are disabled for
// coverage builds.
let coverage_artifacts_path = project.artifacts_path().join("coverage");
project.paths.artifacts = coverage_artifacts_path.clone();
project.paths.build_infos = coverage_artifacts_path.join("build-info");
yash-atreya marked this conversation as resolved.
Show resolved Hide resolved

if self.ir_minimum {
// print warning message
sh_warn!("{}", concat!(
Expand Down Expand Up @@ -124,6 +133,8 @@ impl CoverageArgs {
project.settings.solc.via_ir = None;
}

sh_warn!("optimizer settings have been disabled for accurate coverage reports")?;

let output = ProjectCompiler::default()
.compile(&project)?
.with_stripped_file_prefixes(project.root());
Expand Down
Loading