Move TestOutputFormat and TestSummaryFormat into ExecutionOptions.

This breaks a dependency cycle between ExecutionOptions and TestStrategy.

PiperOrigin-RevId: 305231464
diff --git a/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java b/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
index 1a1c1bc..4c2728d 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
@@ -27,6 +27,7 @@
 import com.google.devtools.common.options.BoolOrEnumConverter;
 import com.google.devtools.common.options.Converters;
 import com.google.devtools.common.options.Converters.CommaSeparatedNonEmptyOptionListConverter;
+import com.google.devtools.common.options.EnumConverter;
 import com.google.devtools.common.options.Option;
 import com.google.devtools.common.options.OptionDocumentationCategory;
 import com.google.devtools.common.options.OptionEffectTag;
@@ -239,33 +240,31 @@
   public PathFragment testTmpDir;
 
   @Option(
-    name = "test_output",
-    defaultValue = "summary",
-    converter = TestStrategy.TestOutputFormat.Converter.class,
-    documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
-    effectTags = {OptionEffectTag.UNKNOWN},
-    help =
-        "Specifies desired output mode. Valid values are 'summary' to output only test status "
-            + "summary, 'errors' to also print test logs for failed tests, 'all' to print logs "
-            + "for all tests and 'streamed' to output logs for all tests in real time "
-            + "(this will force tests to be executed locally one at a time regardless of "
-            + "--test_strategy value)."
-  )
-  public TestStrategy.TestOutputFormat testOutput;
+      name = "test_output",
+      defaultValue = "summary",
+      converter = TestOutputFormat.Converter.class,
+      documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
+      effectTags = {OptionEffectTag.UNKNOWN},
+      help =
+          "Specifies desired output mode. Valid values are 'summary' to output only test status "
+              + "summary, 'errors' to also print test logs for failed tests, 'all' to print logs "
+              + "for all tests and 'streamed' to output logs for all tests in real time "
+              + "(this will force tests to be executed locally one at a time regardless of "
+              + "--test_strategy value).")
+  public TestOutputFormat testOutput;
 
   @Option(
-    name = "test_summary",
-    defaultValue = "short",
-    converter = TestStrategy.TestSummaryFormat.Converter.class,
-    documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
-    effectTags = {OptionEffectTag.UNKNOWN},
-    help =
-        "Specifies the desired format ot the test summary. Valid values are 'short' to print "
-            + "information only about tests executed, 'terse', to print information only about "
-            + "unsuccessful tests that were run, 'detailed' to print detailed information about "
-            + "failed test cases, and 'none' to omit the summary."
-  )
-  public TestStrategy.TestSummaryFormat testSummary;
+      name = "test_summary",
+      defaultValue = "short",
+      converter = TestSummaryFormat.Converter.class,
+      documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
+      effectTags = {OptionEffectTag.UNKNOWN},
+      help =
+          "Specifies the desired format ot the test summary. Valid values are 'short' to print "
+              + "information only about tests executed, 'terse', to print information only about "
+              + "unsuccessful tests that were run, 'detailed' to print detailed information about "
+              + "failed test cases, and 'none' to omit the summary.")
+  public TestSummaryFormat testSummary;
 
   @Option(
     name = "resource_autosense",
@@ -478,6 +477,38 @@
               + "test log. Otherwise, Bazel generates a test.xml as part of the test action.")
   public boolean splitXmlGeneration;
 
+  /** An enum for specifying different formats of test output. */
+  public enum TestOutputFormat {
+    SUMMARY, // Provide summary output only.
+    ERRORS, // Print output from failed tests to the stderr after the test failure.
+    ALL, // Print output from all tests to the stderr after the test completion.
+    STREAMED; // Stream output for each test.
+
+    /** Converts to {@link TestOutputFormat}. */
+    public static class Converter extends EnumConverter<TestOutputFormat> {
+      public Converter() {
+        super(TestOutputFormat.class, "test output");
+      }
+    }
+  }
+
+  /** An enum for specifying different formatting styles of test summaries. */
+  public enum TestSummaryFormat {
+    SHORT, // Print information only about tests.
+    TERSE, // Like "SHORT", but even shorter: Do not print PASSED and NO STATUS tests.
+    DETAILED, // Print information only about failed test cases.
+    NONE, // Do not print summary.
+    TESTCASE; // Print summary in test case resolution, do not print detailed information about
+    // failed test cases.
+
+    /** Converts to {@link TestSummaryFormat}. */
+    public static class Converter extends EnumConverter<TestSummaryFormat> {
+      public Converter() {
+        super(TestSummaryFormat.class, "test summary");
+      }
+    }
+  }
+
   /** Converter for the --flaky_test_attempts option. */
   public static class TestAttemptsConverter extends PerLabelOptions.PerLabelOptionsConverter {
     private static final int MIN_VALUE = 1;
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 996df02..a82fd1d 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
@@ -296,7 +296,7 @@
     Path err = resolvedPaths.getTestStderr();
     FileOutErr testOutErr = new FileOutErr(out, err);
     Closeable streamed = null;
-    if (executionOptions.testOutput.equals(TestOutputFormat.STREAMED)) {
+    if (executionOptions.testOutput.equals(ExecutionOptions.TestOutputFormat.STREAMED)) {
       streamed =
           createStreamedTestOutput(
               Reporter.outErrForReporter(actionExecutionContext.getEventHandler()), out);
diff --git a/src/main/java/com/google/devtools/build/lib/exec/TestLogHelper.java b/src/main/java/com/google/devtools/build/lib/exec/TestLogHelper.java
index 589c85c..0a47aef 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/TestLogHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/TestLogHelper.java
@@ -14,7 +14,7 @@
 package com.google.devtools.build.lib.exec;
 
 import com.google.common.io.ByteStreams;
-import com.google.devtools.build.lib.exec.TestStrategy.TestOutputFormat;
+import com.google.devtools.build.lib.exec.ExecutionOptions.TestOutputFormat;
 import com.google.devtools.build.lib.util.OS;
 import com.google.devtools.build.lib.vfs.Path;
 import java.io.BufferedOutputStream;
@@ -38,8 +38,8 @@
    * test has passed or not.
    */
   public static boolean shouldOutputTestLog(TestOutputFormat outputMode, boolean hasPassed) {
-    return (outputMode == TestOutputFormat.ALL)
-        || (!hasPassed && (outputMode == TestOutputFormat.ERRORS));
+    return (outputMode == ExecutionOptions.TestOutputFormat.ALL)
+        || (!hasPassed && (outputMode == ExecutionOptions.TestOutputFormat.ERRORS));
   }
 
   /**
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 97ef786..2afdce3 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
@@ -46,7 +46,6 @@
 import com.google.devtools.build.lib.view.test.TestStatus.BlazeTestStatus;
 import com.google.devtools.build.lib.view.test.TestStatus.TestCase;
 import com.google.devtools.build.lib.view.test.TestStatus.TestResultData;
-import com.google.devtools.common.options.EnumConverter;
 import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
@@ -102,38 +101,6 @@
     directory.createDirectoryAndParents();
   }
 
-  /** An enum for specifying different formats of test output. */
-  public enum TestOutputFormat {
-    SUMMARY, // Provide summary output only.
-    ERRORS, // Print output from failed tests to the stderr after the test failure.
-    ALL, // Print output from all tests to the stderr after the test completion.
-    STREAMED; // Stream output for each test.
-
-    /** Converts to {@link TestOutputFormat}. */
-    public static class Converter extends EnumConverter<TestOutputFormat> {
-      public Converter() {
-        super(TestOutputFormat.class, "test output");
-      }
-    }
-  }
-
-  /** An enum for specifying different formatting styles of test summaries. */
-  public enum TestSummaryFormat {
-    SHORT, // Print information only about tests.
-    TERSE, // Like "SHORT", but even shorter: Do not print PASSED and NO STATUS tests.
-    DETAILED, // Print information only about failed test cases.
-    NONE, // Do not print summary.
-    TESTCASE; // Print summary in test case resolution, do not print detailed information about
-    // failed test cases.
-
-    /** Converts to {@link TestSummaryFormat}. */
-    public static class Converter extends EnumConverter<TestSummaryFormat> {
-      public Converter() {
-        super(TestSummaryFormat.class, "test summary");
-      }
-    }
-  }
-
   public static final PathFragment TEST_TMP_ROOT = PathFragment.create("_tmp");
 
   // Used for generating unique temporary directory names. Contains the next numeric index for every
@@ -325,8 +292,8 @@
   protected TestCase parseTestResult(Path resultFile) {
     /* xml files. We avoid parsing it unnecessarily, since test results can potentially consume
     a large amount of memory. */
-    if ((executionOptions.testSummary != TestSummaryFormat.DETAILED)
-        && (executionOptions.testSummary != TestSummaryFormat.TESTCASE)) {
+    if ((executionOptions.testSummary != ExecutionOptions.TestSummaryFormat.DETAILED)
+        && (executionOptions.testSummary != ExecutionOptions.TestSummaryFormat.TESTCASE)) {
       return null;
     }