aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java36
1 files changed, 4 insertions, 32 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
index 96d8798c68..1cf2033600 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
@@ -58,15 +58,8 @@ import javax.annotation.Nullable;
/** A strategy for executing a {@link TestRunnerAction}. */
public abstract class TestStrategy implements TestActionContext {
- public static final PathFragment COVERAGE_TMP_ROOT = new PathFragment("_coverage");
-
public static final String TEST_SETUP_BASENAME = "test-setup.sh";
- /** Returns true if coverage data should be gathered. */
- protected static boolean isCoverageMode(TestRunnerAction action) {
- return action.getCoverageData() != null;
- }
-
/**
* Ensures that all directories used to run test are in the correct state and their content will
* not result in stale files.
@@ -74,7 +67,7 @@ public abstract class TestStrategy implements TestActionContext {
protected void prepareFileSystem(
TestRunnerAction testAction, Path tmpDir, Path coverageDir, Path workingDirectory)
throws IOException {
- if (isCoverageMode(testAction)) {
+ if (testAction.isCoverageMode()) {
recreateDirectory(coverageDir);
}
recreateDirectory(tmpDir);
@@ -161,27 +154,6 @@ public abstract class TestStrategy implements TestActionContext {
public abstract void exec(TestRunnerAction action, ActionExecutionContext actionExecutionContext)
throws ExecException, InterruptedException;
- /** Returns true if coverage data should be gathered. */
- protected static boolean isMicroCoverageMode(TestRunnerAction action) {
- return action.getMicroCoverageData() != null;
- }
-
- /**
- * Returns directory to 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 execution with
- * exception of the locally generated *.gcda files. Those are stored separately using relative
- * path within coverage directory.
- *
- * <p>Coverage directory name for the given test runner action is constructed as: {@code $(blaze
- * info execution_root)/_coverage/target_path/test_log_name} where {@code test_log_name} is
- * usually a target name but potentially can include extra suffix, such as a shard number (if test
- * execution was sharded).
- */
- protected static PathFragment getCoverageDirectory(TestRunnerAction action) {
- return COVERAGE_TMP_ROOT.getRelative(
- FileSystemUtils.removeExtension(action.getTestLog().getRootRelativePath()));
- }
-
/**
* Returns mutable map of default testing shell environment. By itself it is incomplete and is
* modified further by the specific test strategy implementations (mostly due to the fact that
@@ -212,13 +184,13 @@ public abstract class TestStrategy implements TestActionContext {
env.put(TEST_BRIDGE_TEST_FILTER_ENV, testFilter);
}
- if (isCoverageMode(action)) {
+ if (action.isCoverageMode()) {
env.put(
"COVERAGE_MANIFEST",
action.getExecutionSettings().getInstrumentedFileManifest().getExecPathString());
// Instruct remote-runtest.sh/local-runtest.sh not to cd into the runfiles directory.
env.put("RUNTEST_PRESERVE_CWD", "1");
- env.put("MICROCOVERAGE_REQUESTED", isMicroCoverageMode(action) ? "true" : "false");
+ env.put("MICROCOVERAGE_REQUESTED", action.isMicroCoverageMode() ? "true" : "false");
}
return env;
@@ -246,7 +218,7 @@ public abstract class TestStrategy implements TestActionContext {
TestTargetExecutionSettings execSettings = testAction.getExecutionSettings();
List<String> execArgs = new ArrayList<>();
- if (!coverageScript.isEmpty() && isCoverageMode(testAction)) {
+ if (!coverageScript.isEmpty() && testAction.isCoverageMode()) {
execArgs.add(coverageScript);
}