Skip to content

Commit

Permalink
[bazelbuild#6764] Fix coverage display when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoader committed Sep 17, 2024
1 parent 2fd56e9 commit 4c4b0d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ public static BlazeInfo create(
ExecutionRootPath.createAncestorRelativePath(
executionRoot, new File(getOrThrow(blazeInfoMap, blazeTestlogsKey(buildSystemName))));
File outputBase = new File(getOrThrow(blazeInfoMap, OUTPUT_BASE_KEY).trim());
File outputPath = new File(getOrThrow(blazeInfoMap, OUTPUT_PATH_KEY).trim());
return AutoValue_BlazeInfo.builder()
.setBlazeInfoMap(blazeInfoMap)
.setExecutionRoot(executionRoot)
.setBlazeBin(blazeBin)
.setBlazeGenfiles(blazeGenfiles)
.setBlazeTestlogs(blazeTestlogs)
.setOutputBase(outputBase)
.setOutputPath(outputPath)
.autoBuild();
}

Expand Down Expand Up @@ -140,6 +142,8 @@ public File getBlazeTestlogsDirectory() {

public abstract File getOutputBase();

public abstract File getOutputPath();

public String getStarlarkSemantics() {
return getBlazeInfoMap().get(STARLARK_SEMANTICS);
}
Expand Down Expand Up @@ -181,12 +185,15 @@ public abstract static class Builder {

public abstract Builder setOutputBase(File value);

public abstract Builder setOutputPath(File value);

public abstract BlazeInfo autoBuild();

// A build method to populate the blazeInfoMap
public BlazeInfo build(BuildSystemName buildSystemName) {
BlazeInfo blazeInfo = autoBuild();
blazeInfoMapBuilder().put(OUTPUT_BASE_KEY, blazeInfo.getOutputBase().getPath());
blazeInfoMapBuilder().put(OUTPUT_PATH_KEY, blazeInfo.getOutputPath().getPath());
blazeInfoMapBuilder().put(EXECUTION_ROOT_KEY, blazeInfo.getExecutionRoot().getPath());
File execRoot = new File(blazeInfo.getExecutionRoot().getAbsolutePath());
blazeInfoMapBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static ImmutableList<String> getBlazeFlags() {
}

public static File getOutputFile(BlazeInfo blazeInfo) {
File coverageRoot = new File(blazeInfo.getOutputBase(), "_coverage");
File coverageRoot = new File(blazeInfo.getOutputPath(), "_coverage");
return new File(coverageRoot, "_coverage_report.dat");
}
}

0 comments on commit 4c4b0d3

Please sign in to comment.