diff options
Diffstat (limited to 'src/test/java/com/google')
4 files changed, 23 insertions, 25 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ActionResultTest.java b/src/test/java/com/google/devtools/build/lib/actions/ActionResultTest.java index 986e6e89a6..87081ea417 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/ActionResultTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/ActionResultTest.java @@ -13,12 +13,11 @@ // limitations under the License. package com.google.devtools.build.lib.actions; -import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; -import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableList; import java.time.Duration; -import java.util.Set; +import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -29,7 +28,7 @@ public final class ActionResultTest { @Test public void testCumulativeCommandExecutionTime_NoSpawnResults() { - Set<SpawnResult> spawnResults = ImmutableSet.of(); + List<SpawnResult> spawnResults = ImmutableList.of(); ActionResult actionResult = ActionResult.create(spawnResults); assertThat(actionResult.cumulativeCommandExecutionWallTime()).isEmpty(); assertThat(actionResult.cumulativeCommandExecutionUserTime()).isEmpty(); @@ -45,7 +44,7 @@ public final class ActionResultTest { .setSystemTime(Duration.ofMillis(42)) .setStatus(SpawnResult.Status.SUCCESS) .build(); - Set<SpawnResult> spawnResults = ImmutableSet.of(spawnResult); + List<SpawnResult> spawnResults = ImmutableList.of(spawnResult); ActionResult actionResult = ActionResult.create(spawnResults); assertThat(actionResult.cumulativeCommandExecutionWallTime()).isPresent(); assertThat(actionResult.cumulativeCommandExecutionWallTime()).hasValue(Duration.ofMillis(1984)); @@ -78,7 +77,7 @@ public final class ActionResultTest { .setSystemTime(Duration.ofMillis(2)) .setStatus(SpawnResult.Status.SUCCESS) .build(); - Set<SpawnResult> spawnResults = ImmutableSet.of(spawnResult1, spawnResult2, spawnResult3); + List<SpawnResult> spawnResults = ImmutableList.of(spawnResult1, spawnResult2, spawnResult3); ActionResult actionResult = ActionResult.create(spawnResults); assertThat(actionResult.cumulativeCommandExecutionWallTime()).isPresent(); assertThat(actionResult.cumulativeCommandExecutionWallTime()).hasValue(Duration.ofMillis(1984)); @@ -96,7 +95,7 @@ public final class ActionResultTest { new SpawnResult.Builder().setStatus(SpawnResult.Status.SUCCESS).build(); SpawnResult spawnResult3 = new SpawnResult.Builder().setStatus(SpawnResult.Status.SUCCESS).build(); - Set<SpawnResult> spawnResults = ImmutableSet.of(spawnResult1, spawnResult2, spawnResult3); + List<SpawnResult> spawnResults = ImmutableList.of(spawnResult1, spawnResult2, spawnResult3); ActionResult actionResult = ActionResult.create(spawnResults); assertThat(actionResult.cumulativeCommandExecutionWallTime()).isEmpty(); assertThat(actionResult.cumulativeCommandExecutionUserTime()).isEmpty(); 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 53ab069b1b..e6c7ee9683 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 @@ -34,7 +34,7 @@ import com.google.devtools.build.lib.testutil.TestSpec; import com.google.devtools.build.lib.vfs.FileSystem; import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem; import java.util.Collection; -import java.util.Set; +import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -72,8 +72,8 @@ public class AbstractSpawnStrategyTest { when(spawnRunner.exec(any(Spawn.class), any(SpawnExecutionPolicy.class))) .thenReturn(spawnResult); - Set<SpawnResult> spawnResults = new TestedSpawnStrategy(spawnRunner) - .exec(SIMPLE_SPAWN, actionExecutionContext); + List<SpawnResult> spawnResults = + new TestedSpawnStrategy(spawnRunner).exec(SIMPLE_SPAWN, actionExecutionContext); assertThat(spawnResults).containsExactly(spawnResult); @@ -90,7 +90,7 @@ public class AbstractSpawnStrategyTest { .thenReturn(result); try { - // Ignoring the Set<SpawnResult> return value. + // Ignoring the List<SpawnResult> return value. new TestedSpawnStrategy(spawnRunner).exec(SIMPLE_SPAWN, actionExecutionContext); fail("Expected SpawnExecException"); } catch (SpawnExecException e) { @@ -109,8 +109,8 @@ public class AbstractSpawnStrategyTest { when(actionExecutionContext.getContext(eq(SpawnCache.class))).thenReturn(cache); when(actionExecutionContext.getExecRoot()).thenReturn(fs.getPath("/execroot")); - Set<SpawnResult> spawnResults = new TestedSpawnStrategy(spawnRunner) - .exec(SIMPLE_SPAWN, actionExecutionContext); + List<SpawnResult> spawnResults = + new TestedSpawnStrategy(spawnRunner).exec(SIMPLE_SPAWN, actionExecutionContext); assertThat(spawnResults).containsExactly(spawnResult); verify(spawnRunner, never()).exec(any(Spawn.class), any(SpawnExecutionPolicy.class)); } @@ -130,8 +130,8 @@ public class AbstractSpawnStrategyTest { when(spawnRunner.exec(any(Spawn.class), any(SpawnExecutionPolicy.class))) .thenReturn(spawnResult); - Set<SpawnResult> spawnResults = new TestedSpawnStrategy(spawnRunner) - .exec(SIMPLE_SPAWN, actionExecutionContext); + List<SpawnResult> spawnResults = + new TestedSpawnStrategy(spawnRunner).exec(SIMPLE_SPAWN, actionExecutionContext); assertThat(spawnResults).containsExactly(spawnResult); @@ -155,7 +155,7 @@ public class AbstractSpawnStrategyTest { when(spawnRunner.exec(any(Spawn.class), any(SpawnExecutionPolicy.class))).thenReturn(result); try { - // Ignoring the Set<SpawnResult> return value. + // Ignoring the List<SpawnResult> return value. new TestedSpawnStrategy(spawnRunner).exec(SIMPLE_SPAWN, actionExecutionContext); fail("Expected SpawnExecException"); } catch (SpawnExecException e) { 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 fd20daa223..04ef2f1f20 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 @@ -20,8 +20,8 @@ import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.ActionExecutionContext; import com.google.devtools.build.lib.actions.Artifact; @@ -44,7 +44,6 @@ import java.io.IOException; import java.io.OutputStream; import java.time.Duration; import java.util.List; -import java.util.Set; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -124,12 +123,12 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase { .setStatus(Status.SUCCESS) .setWallTime(Duration.ofMillis(10)) .build(); - when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableSet.of(expectedSpawnResult)); + when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableList.of(expectedSpawnResult)); when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext); // actual StandaloneTestStrategy execution - Set<SpawnResult> spawnResults = + List<SpawnResult> spawnResults = standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext); // check that the rigged SpawnResult was returned @@ -206,7 +205,7 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase { when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext); // actual StandaloneTestStrategy execution - Set<SpawnResult> spawnResults = + List<SpawnResult> spawnResults = standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext); // check that the rigged SpawnResult was returned @@ -277,11 +276,11 @@ public final class StandaloneTestStrategyTest extends BuildViewTestCase { when(actionExecutionContext.getFileOutErr()).thenReturn(outErr); SpawnResult expectedSpawnResult = new SpawnResult.Builder().setStatus(Status.SUCCESS).build(); - when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableSet.of(expectedSpawnResult)); + when(spawnActionContext.exec(any(), any())).thenReturn(ImmutableList.of(expectedSpawnResult)); when(actionExecutionContext.getSpawnActionContext(any())).thenReturn(spawnActionContext); // actual StandaloneTestStrategy execution - Set<SpawnResult> spawnResults = + List<SpawnResult> spawnResults = standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext); // check that the rigged SpawnResult was returned diff --git a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java index 10b0f35bef..342680b700 100644 --- a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java +++ b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java @@ -60,7 +60,7 @@ import com.google.devtools.common.options.OptionsParser; import java.io.IOException; import java.util.Arrays; import java.util.Collection; -import java.util.Set; +import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -171,7 +171,7 @@ public class StandaloneSpawnStrategyTest { assertThat(err()).isEmpty(); } - private Set<SpawnResult> run(Spawn spawn) throws Exception { + private List<SpawnResult> run(Spawn spawn) throws Exception { return executor.getSpawnActionContext(spawn.getMnemonic()).exec(spawn, createContext()); } |