aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2017-02-09 14:42:37 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2017-02-09 15:12:08 +0000
commit92f182bd1058ac05db8592d3f390826d2f94ed98 (patch)
treec21cad5d8b5b09ef12c88d93ebecb1a7415bd723 /src/main/java
parent1509cc8f07228a87184ee032b6a8d624b7d4e189 (diff)
Remove the first argument of TestStrategy.getArgs.
All callers were performing identical steps before calling getArgs - move the functionality into getArgs instead. -- PiperOrigin-RevId: 147028753 MOS_MIGRATED_REVID=147028753
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java4
3 files changed, 8 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
index db711bcff7..5e33a9ba77 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
@@ -17,7 +17,6 @@ package com.google.devtools.build.lib.exec;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
-import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.BaseSpawn;
import com.google.devtools.build.lib.actions.EnvironmentalExecException;
import com.google.devtools.build.lib.actions.ExecException;
@@ -113,10 +112,9 @@ public class StandaloneTestStrategy extends TestStrategy {
info.put("timeout", "" + getTimeout(action));
info.putAll(action.getTestProperties().getExecutionInfo());
- Artifact testSetup = action.getRuntimeArtifact(TEST_SETUP_BASENAME);
Spawn spawn =
new BaseSpawn(
- getArgs(testSetup.getExecPathString(), COLLECT_COVERAGE, action),
+ getArgs(COLLECT_COVERAGE, action),
env,
info,
new RunfilesSupplierImpl(
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 f84754f57f..114d60e68b 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
@@ -21,6 +21,7 @@ import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
import com.google.common.io.Closeables;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
+import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.analysis.config.BinTools;
@@ -155,21 +156,22 @@ public abstract class TestStrategy implements TestActionContext {
* Generates a command line to run for the test action, taking into account coverage and {@code
* --run_under} settings.
*
- * @param testScript the setup script that invokes the test
* @param coverageScript a script interjected between setup script and rest of command line to
* collect coverage data. If this is an empty string, it is ignored.
* @param testAction The test action.
* @return the command line as string list.
*/
- protected List<String> getArgs(
- String testScript, String coverageScript, TestRunnerAction testAction) {
+ protected List<String> getArgs(String coverageScript, TestRunnerAction testAction)
+ throws ExecException {
List<String> args = Lists.newArrayList();
if (OS.getCurrent() == OS.WINDOWS) {
args.add(testAction.getShExecutable().getPathString());
args.add("-c");
args.add("$0 $*");
}
- args.add(testScript);
+
+ Artifact testSetup = testAction.getRuntimeArtifact(TEST_SETUP_BASENAME);
+ args.add(testSetup.getExecPathString());
TestTargetExecutionSettings execSettings = testAction.getExecutionSettings();
List<String> execArgs = new ArrayList<>();
diff --git a/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java b/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
index 030234d359..d4a0fa8140 100644
--- a/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
@@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.hash.HashCode;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
-import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.actions.ExecutionStrategy;
import com.google.devtools.build.lib.actions.Executor;
@@ -193,8 +192,7 @@ public class WorkerTestStrategy extends StandaloneTestStrategy {
}
private List<String> getStartUpArgs(TestRunnerAction action) throws ExecException {
- Artifact testSetup = action.getRuntimeArtifact(TEST_SETUP_BASENAME);
- List<String> args = getArgs(testSetup.getExecPathString(), "", action);
+ List<String> args = getArgs(/*coverageScript=*/ "", action);
ImmutableList.Builder<String> startupArgs = ImmutableList.builder();
// Add test setup with no echo to prevent stdout corruption.
startupArgs.add(args.get(0)).add("--no_echo");