Ensure Runner name is always set.
RELNOTES: None.
PiperOrigin-RevId: 190617155
diff --git a/src/test/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategyTest.java b/src/test/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategyTest.java
index c4d3b5b..42de712 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategyTest.java
@@ -69,7 +69,8 @@
public void testZeroExit() throws Exception {
when(actionExecutionContext.getContext(eq(SpawnCache.class))).thenReturn(SpawnCache.NO_CACHE);
when(actionExecutionContext.getExecRoot()).thenReturn(fs.getPath("/execroot"));
- SpawnResult spawnResult = new SpawnResult.Builder().setStatus(Status.SUCCESS).build();
+ SpawnResult spawnResult =
+ new SpawnResult.Builder().setStatus(Status.SUCCESS).setRunnerName("test").build();
when(spawnRunner.exec(any(Spawn.class), any(SpawnExecutionPolicy.class)))
.thenReturn(spawnResult);
@@ -87,7 +88,11 @@
when(actionExecutionContext.getContext(eq(SpawnCache.class))).thenReturn(SpawnCache.NO_CACHE);
when(actionExecutionContext.getExecRoot()).thenReturn(execRoot);
SpawnResult result =
- new SpawnResult.Builder().setStatus(Status.NON_ZERO_EXIT).setExitCode(1).build();
+ new SpawnResult.Builder()
+ .setStatus(Status.NON_ZERO_EXIT)
+ .setExitCode(1)
+ .setRunnerName("test")
+ .build();
when(spawnRunner.exec(any(Spawn.class), any(SpawnExecutionPolicy.class)))
.thenReturn(result);
@@ -105,7 +110,8 @@
@Test
public void testCacheHit() throws Exception {
SpawnCache cache = mock(SpawnCache.class);
- SpawnResult spawnResult = new SpawnResult.Builder().setStatus(Status.SUCCESS).build();
+ SpawnResult spawnResult =
+ new SpawnResult.Builder().setStatus(Status.SUCCESS).setRunnerName("test").build();
when(cache.lookup(any(Spawn.class), any(SpawnExecutionPolicy.class)))
.thenReturn(SpawnCache.success(spawnResult));
when(actionExecutionContext.getContext(eq(SpawnCache.class))).thenReturn(cache);
@@ -128,7 +134,8 @@
when(actionExecutionContext.getContext(eq(SpawnCache.class))).thenReturn(cache);
when(actionExecutionContext.getExecRoot()).thenReturn(fs.getPath("/execroot"));
- SpawnResult spawnResult = new SpawnResult.Builder().setStatus(Status.SUCCESS).build();
+ SpawnResult spawnResult =
+ new SpawnResult.Builder().setStatus(Status.SUCCESS).setRunnerName("test").build();
when(spawnRunner.exec(any(Spawn.class), any(SpawnExecutionPolicy.class)))
.thenReturn(spawnResult);
@@ -154,7 +161,11 @@
when(actionExecutionContext.getContext(eq(SpawnCache.class))).thenReturn(cache);
when(actionExecutionContext.getExecRoot()).thenReturn(fs.getPath("/execroot"));
SpawnResult result =
- new SpawnResult.Builder().setStatus(Status.NON_ZERO_EXIT).setExitCode(1).build();
+ new SpawnResult.Builder()
+ .setStatus(Status.NON_ZERO_EXIT)
+ .setExitCode(1)
+ .setRunnerName("test")
+ .build();
when(spawnRunner.exec(any(Spawn.class), any(SpawnExecutionPolicy.class))).thenReturn(result);
try {
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 57ad243..34058a42 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
@@ -125,6 +125,7 @@
new SpawnResult.Builder()
.setStatus(Status.SUCCESS)
.setWallTime(Duration.ofMillis(10))
+ .setRunnerName("test")
.build();
when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableList.of(expectedSpawnResult));
@@ -200,7 +201,11 @@
when(actionExecutionContext.getFileOutErr()).thenReturn(outErr);
SpawnResult expectedSpawnResult =
- new SpawnResult.Builder().setStatus(Status.NON_ZERO_EXIT).setExitCode(1).build();
+ new SpawnResult.Builder()
+ .setStatus(Status.NON_ZERO_EXIT)
+ .setExitCode(1)
+ .setRunnerName("test")
+ .build();
when(spawnActionContext.exec(any(), any()))
.thenThrow(
new SpawnExecException(
@@ -283,7 +288,8 @@
FileOutErr outErr = new FileOutErr(outPath, errPath);
when(actionExecutionContext.getFileOutErr()).thenReturn(outErr);
- SpawnResult expectedSpawnResult = new SpawnResult.Builder().setStatus(Status.SUCCESS).build();
+ SpawnResult expectedSpawnResult =
+ new SpawnResult.Builder().setStatus(Status.SUCCESS).setRunnerName("test").build();
when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableList.of(expectedSpawnResult));
when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext);