Skip to content

Commit

Permalink
Remove --microcoverage support
Browse files Browse the repository at this point in the history
This feature is unused and depends on emma, which is obsolete.

PiperOrigin-RevId: 153713051
  • Loading branch information
cushon authored and vladmos committed Apr 24, 2017
1 parent 3f5442d commit 3ead6bb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -699,19 +699,6 @@ public static class Options extends FragmentOptions implements Cloneable {
)
public boolean collectCodeCoverage;

@Option(
name = "microcoverage",
defaultValue = "false",
category = "testing",
help =
"If specified with coverage, Blaze will collect microcoverage (per test method "
+ "coverage) information during tests. Only targets that match "
+ "--instrumentation_filter will be affected. Usually this option should not be "
+ "specified directly - 'blaze coverage --microcoverage' command should be used "
+ "instead."
)
public boolean collectMicroCoverage;

@Option(
name = "coverage_support",
converter = LabelConverter.class,
Expand Down Expand Up @@ -2413,10 +2400,6 @@ public boolean isCodeCoverageEnabled() {
return options.collectCodeCoverage;
}

public boolean isMicroCoverageEnabled() {
return options.collectMicroCoverage;
}

public boolean isLLVMCoverageMapFormatEnabled() {
return options.useLLVMCoverageMapFormat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,10 @@ private TestParams createTestAction(int shards) {
coverageArtifacts.add(coverageArtifact);
}

Artifact microCoverageArtifact = null;
if (collectCodeCoverage && config.isMicroCoverageEnabled()) {
microCoverageArtifact = ruleContext.getPackageRelativeArtifact(
targetName.getRelative(shardRunDir + "coverage.micro.dat"), root);
}

env.registerAction(new TestRunnerAction(
ruleContext.getActionOwner(), inputs, testRuntime,
testLog, cacheStatus,
coverageArtifact, microCoverageArtifact,
coverageArtifact,
testProperties, testEnv, executionSettings,
shard, run, config, ruleContext.getWorkspaceName(),
useTestRunner));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa
private final PathFragment testInfrastructureFailure;
private final PathFragment baseDir;
private final Artifact coverageData;
private final Artifact microCoverageData;
private final TestTargetProperties testProperties;
private final TestTargetExecutionSettings executionSettings;
private final int shardNum;
Expand Down Expand Up @@ -123,7 +122,6 @@ private static ImmutableList<Artifact> list(Artifact... artifacts) {
Artifact testLog,
Artifact cacheStatus,
Artifact coverageArtifact,
Artifact microCoverageArtifact,
TestTargetProperties testProperties,
Map<String, String> extraTestEnv,
TestTargetExecutionSettings executionSettings,
Expand All @@ -135,13 +133,12 @@ private static ImmutableList<Artifact> list(Artifact... artifacts) {
super(owner, inputs,
// Note that this action only cares about the runfiles, not the mapping.
new RunfilesSupplierImpl(PathFragment.create("runfiles"), executionSettings.getRunfiles()),
list(testLog, cacheStatus, coverageArtifact, microCoverageArtifact));
list(testLog, cacheStatus, coverageArtifact));
this.runtime = runtime;
this.configuration = Preconditions.checkNotNull(configuration);
this.testLog = testLog;
this.cacheStatus = cacheStatus;
this.coverageData = coverageArtifact;
this.microCoverageData = microCoverageArtifact;
this.shardNum = shardNum;
this.runNumber = runNumber;
this.testProperties = Preconditions.checkNotNull(testProperties);
Expand Down Expand Up @@ -207,9 +204,6 @@ public List<ActionInput> getSpawnOutputs() {
outputs.add(ActionInputHelper.fromPath(getUndeclaredOutputsAnnotationsPath()));
if (isCoverageMode()) {
outputs.add(getCoverageData());
if (isMicroCoverageMode()) {
outputs.add(getMicroCoverageData());
}
}
return outputs;
}
Expand Down Expand Up @@ -358,8 +352,6 @@ protected void deleteOutputs(Path execRoot) throws IOException {

// We cannot use coverageData artifact since it may be null. Generate coverage name instead.
execRoot.getRelative(baseDir.getChild(coveragePrefix + ".dat")).delete();
// We cannot use microcoverageData artifact since it may be null. Generate filename instead.
execRoot.getRelative(baseDir.getChild(coveragePrefix + ".micro.dat")).delete();

// Delete files fetched from remote execution.
execRoot.getRelative(baseDir.getChild("test.zip")).delete();
Expand Down Expand Up @@ -441,12 +433,6 @@ public void setupEnvVariables(Map<String, String> env, int timeoutInSeconds) {
env.put("COVERAGE_MANIFEST", getCoverageManifest().getExecPathString());
env.put("COVERAGE_DIR", getCoverageDirectory().getPathString());
env.put("COVERAGE_OUTPUT_FILE", getCoverageData().getExecPathString());
if (isMicroCoverageMode()) {
env.put("MICROCOVERAGE_REQUESTED", "true");
env.put("MICROCOVERAGE_OUTPUT_FILE", getMicroCoverageData().getExecPathString());
} else {
env.put("MICROCOVERAGE_REQUESTED", "false");
}
}
}

Expand Down Expand Up @@ -575,18 +561,6 @@ public boolean isCoverageMode() {
return coverageData != null;
}

/**
* @return microcoverage data artifact or null if code coverage was not requested.
*/
@Nullable public Artifact getMicroCoverageData() {
return microCoverageData;
}

/** Returns true if micro-coverage data should be gathered. */
public boolean isMicroCoverageMode() {
return microCoverageData != null;
}

/**
* Returns a directory to temporarily store coverage results for the given action relative to the
* execution root. This directory is used to store all coverage results related to the test
Expand Down

0 comments on commit 3ead6bb

Please sign in to comment.