Move execute implementation up to TestRunnerAction

Instead, add methods to TestActionContext to construct a TestRunnerSpawn
and inform about test_keep_going.

As of this point, the high-level test execution process is now shared
between Bazel and Blaze. This is in preparation for implementing async
test execution.

PiperOrigin-RevId: 236107062
diff --git a/src/test/java/com/google/devtools/build/lib/exec/SpawnActionContextMapsTest.java b/src/test/java/com/google/devtools/build/lib/exec/SpawnActionContextMapsTest.java
index d757799..322f6d9 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/SpawnActionContextMapsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/SpawnActionContextMapsTest.java
@@ -35,7 +35,6 @@
 import com.google.devtools.build.lib.util.RegexFilter.RegexFilterConverter;
 import com.google.devtools.build.lib.vfs.Path;
 import com.google.devtools.build.lib.view.test.TestStatus.TestResultData;
-import java.io.IOException;
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
@@ -162,15 +161,19 @@
   @ExecutionStrategy(contextType = TestActionContext.class, name = "actest")
   private static class ACTest implements TestActionContext {
     @Override
-    public List<SpawnResult> exec(
-        TestRunnerAction action, ActionExecutionContext actionExecutionContext)
-        throws ExecException, InterruptedException {
+    public TestRunnerSpawn createTestRunnerSpawn(
+        TestRunnerAction testRunnerAction, ActionExecutionContext actionExecutionContext) {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isTestKeepGoing() {
       throw new UnsupportedOperationException();
     }
 
     @Override
     public TestResult newCachedTestResult(
-        Path execRoot, TestRunnerAction action, TestResultData cached) throws IOException {
+        Path execRoot, TestRunnerAction action, TestResultData cached) {
       throw new UnsupportedOperationException();
     }
   }
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 5ea50c6..28e636d 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
@@ -26,6 +26,7 @@
 import com.google.common.collect.MoreCollectors;
 import com.google.devtools.build.lib.actions.ActionContext;
 import com.google.devtools.build.lib.actions.ActionExecutionContext;
+import com.google.devtools.build.lib.actions.ActionExecutionException;
 import com.google.devtools.build.lib.actions.ActionInputPrefetcher;
 import com.google.devtools.build.lib.actions.ActionKeyContext;
 import com.google.devtools.build.lib.actions.Artifact;
@@ -34,6 +35,7 @@
 import com.google.devtools.build.lib.actions.SpawnResult;
 import com.google.devtools.build.lib.actions.SpawnResult.Status;
 import com.google.devtools.build.lib.analysis.ConfiguredTarget;
+import com.google.devtools.build.lib.analysis.test.TestActionContext;
 import com.google.devtools.build.lib.analysis.test.TestProvider;
 import com.google.devtools.build.lib.analysis.test.TestResult;
 import com.google.devtools.build.lib.analysis.test.TestRunnerAction;
@@ -153,6 +155,14 @@
     return action;
   }
 
+  private List<SpawnResult> execute(
+      TestRunnerAction testRunnerAction,
+      ActionExecutionContext actionExecutionContext,
+      TestActionContext testActionContext)
+      throws ActionExecutionException, InterruptedException {
+    return testRunnerAction.execute(actionExecutionContext, testActionContext).spawnResults();
+  }
+
   @Test
   public void testRunTestOnce() throws Exception {
     ExecutionOptions executionOptions = ExecutionOptions.DEFAULTS;
@@ -185,7 +195,7 @@
 
     // actual StandaloneTestStrategy execution
     List<SpawnResult> spawnResults =
-        standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext);
+        execute(testRunnerAction, actionExecutionContext, standaloneTestStrategy);
 
     assertThat(spawnResults).contains(expectedSpawnResult);
     TestResult result = standaloneTestStrategy.postedResult;
@@ -253,7 +263,7 @@
 
     // actual StandaloneTestStrategy execution
     List<SpawnResult> spawnResults =
-        standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext);
+        execute(testRunnerAction, actionExecutionContext, standaloneTestStrategy);
 
     assertThat(spawnResults).containsExactly(failSpawnResult, passSpawnResult).inOrder();
 
@@ -319,7 +329,7 @@
 
     // actual StandaloneTestStrategy execution
     List<SpawnResult> spawnResults =
-        standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext);
+        execute(testRunnerAction, actionExecutionContext, standaloneTestStrategy);
 
     assertThat(spawnResults).contains(expectedSpawnResult);
 
@@ -377,7 +387,7 @@
 
     // actual StandaloneTestStrategy execution
     List<SpawnResult> spawnResults =
-        standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext);
+        execute(testRunnerAction, actionExecutionContext, standaloneTestStrategy);
 
     // check that the rigged SpawnResult was returned
     assertThat(spawnResults).contains(expectedSpawnResult);
@@ -460,7 +470,7 @@
 
     // actual StandaloneTestStrategy execution
     List<SpawnResult> spawnResults =
-        standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext);
+        execute(testRunnerAction, actionExecutionContext, standaloneTestStrategy);
 
     // check that the rigged SpawnResult was returned
     assertThat(spawnResults).contains(expectedSpawnResult);
@@ -558,7 +568,7 @@
 
     // actual StandaloneTestStrategy execution
     List<SpawnResult> spawnResults =
-        standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext);
+        execute(testRunnerAction, actionExecutionContext, standaloneTestStrategy);
 
     // check that the rigged SpawnResult was returned
     assertThat(spawnResults).containsExactly(testSpawnResult, xmlGeneratorSpawnResult);
@@ -613,7 +623,7 @@
 
     // actual StandaloneTestStrategy execution
     List<SpawnResult> spawnResults =
-        standaloneTestStrategy.exec(testRunnerAction, actionExecutionContext);
+        execute(testRunnerAction, actionExecutionContext, standaloneTestStrategy);
 
     // check that the rigged SpawnResult was returned
     assertThat(spawnResults).contains(expectedSpawnResult);