aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/exec
diff options
context:
space:
mode:
authorGravatar shahan <shahan@google.com>2018-03-15 14:18:46 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-15 14:20:29 -0700
commit18726b7e62ab40fa7d1531af7f72fca17abcdb0a (patch)
tree5da2d9407b172bfefc58202ca6901bc54040490b /src/test/java/com/google/devtools/build/lib/exec
parent31032f5a089ded7ebeeb2786eb91864ac58e3306 (diff)
Begins cleanup to allow ActionFS to be injected into all action executions.
PiperOrigin-RevId: 189244665
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/exec')
-rw-r--r--src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java b/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java
index 856f000ccd..57ad24332d 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/StandaloneTestStrategyTest.java
@@ -15,6 +15,7 @@
package com.google.devtools.build.lib.exec;
import static com.google.common.truth.Truth.assertThat;
+import static com.google.devtools.build.lib.testutil.TestConstants.WORKSPACE_NAME;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
@@ -24,6 +25,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
+import com.google.devtools.build.lib.actions.ActionInput;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.SpawnActionContext;
import com.google.devtools.build.lib.actions.SpawnResult;
@@ -117,6 +119,7 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
when(actionExecutionContext.getClientEnv()).thenReturn(ImmutableMap.of());
when(actionExecutionContext.getEventHandler()).thenReturn(reporter);
when(actionExecutionContext.getEventBus()).thenReturn(eventBus);
+ when(actionExecutionContext.getInputPath(any())).thenAnswer(this::getInputPathMock);
SpawnResult expectedSpawnResult =
new SpawnResult.Builder()
@@ -189,6 +192,8 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
when(actionExecutionContext.getClientEnv()).thenReturn(ImmutableMap.of());
when(actionExecutionContext.getEventHandler()).thenReturn(reporter);
when(actionExecutionContext.getEventBus()).thenReturn(eventBus);
+ when(actionExecutionContext.getInputPath(any())).thenAnswer(this::getInputPathMock);
+
Path outPath = tmpDirRoot.getRelative("test-out.txt");
Path errPath = tmpDirRoot.getRelative("test-err.txt");
FileOutErr outErr = new FileOutErr(outPath, errPath);
@@ -272,6 +277,7 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
when(actionExecutionContext.getClientEnv()).thenReturn(ImmutableMap.of());
when(actionExecutionContext.getEventHandler()).thenReturn(reporter);
when(actionExecutionContext.getEventBus()).thenReturn(eventBus);
+ when(actionExecutionContext.getInputPath(any())).thenAnswer(this::getInputPathMock);
Path outPath = tmpDirRoot.getRelative("test-out.txt");
Path errPath = tmpDirRoot.getRelative("test-err.txt");
FileOutErr outErr = new FileOutErr(outPath, errPath);
@@ -307,4 +313,10 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase {
}
assertThat(errPath.exists()).isFalse();
}
+
+ private Path getInputPathMock(InvocationOnMock invocation) {
+ return outputBase
+ .getRelative("execroot/" + WORKSPACE_NAME)
+ .getRelative(invocation.getArgumentAt(0, ActionInput.class).getExecPath());
+ }
}