[9.1.0] Add short_uncached and detailed_uncached options to --test_summary#28341
Merged
iancha1992 merged 1 commit intobazelbuild:release-9.0.0from Jan 22, 2026
Conversation
…ry` (bazelbuild#28290) These options exclude cached test results from the summary. With `short` (default) ``` vscode ➜ /workspaces/bazel/bazel (uncached-test-summary-options) $ bazel-bin/src/bazel test //src/test/java/com/google/devtools/build/lib/runtime:RuntimeTests --test_filter=shortUncachedOption_allPassed INFO: Analyzed target //src/test/java/com/google/devtools/build/lib/runtime:RuntimeTests (0 packages loaded, 0 targets configured). INFO: Found 1 test target... Target //src/test/java/com/google/devtools/build/lib/runtime:RuntimeTests up-to-date: bazel-bin/src/test/java/com/google/devtools/build/lib/runtime/RuntimeTests bazel-bin/src/test/java/com/google/devtools/build/lib/runtime/RuntimeTests.jar INFO: Elapsed time: 0.770s, Critical Path: 0.00s INFO: 1 process: 1 action cache hit, 1 internal. INFO: Build completed successfully, 1 total action //src/test/java/com/google/devtools/build/lib/runtime:RuntimeTests (cached) PASSED in 2.8s Executed 0 out of 1 test: 1 test passes. There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are. ``` With `short_uncached` ``` vscode ➜ /workspaces/bazel/bazel (uncached-test-summary-options) $ bazel-bin/src/bazel test //src/test/java/com/google/devtools/build/lib/runtime:RuntimeTests --test_filter=shortUncachedOption_allPassed --test_summary=short_uncached INFO: Analyzed target //src/test/java/com/google/devtools/build/lib/runtime:RuntimeTests (0 packages loaded, 0 targets configured). INFO: Found 1 test target... Target //src/test/java/com/google/devtools/build/lib/runtime:RuntimeTests up-to-date: bazel-bin/src/test/java/com/google/devtools/build/lib/runtime/RuntimeTests bazel-bin/src/test/java/com/google/devtools/build/lib/runtime/RuntimeTests.jar INFO: Elapsed time: 0.264s, Critical Path: 0.00s INFO: 1 process: 1 action cache hit, 1 internal. INFO: Build completed successfully, 1 total action Executed 0 out of 1 test: 1 test passes. There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are. ``` Resolves bazelbuild#28062 RELNOTES: Reporting of cached test results can now be suppressed with `--test_summary=short_uncached` or `--test_summary=detailed_uncached`. Closes bazelbuild#28290. PiperOrigin-RevId: 857282700 Change-Id: Iaea823462344a6118bd5a112d734df5c35a1e152
There was a problem hiding this comment.
Code Review
This pull request introduces short_uncached and detailed_uncached options to the --test_summary flag, allowing users to exclude cached test results from the summary output. The changes include updates to ExecutionOptions for new enum values and their descriptions, refactoring in TestStrategy and TerminalTestResultNotifier to handle the new summary formats using ImmutableSet for better readability and maintainability, and corresponding updates to test cases. A few typos in method names (getUnkownTestCases to getUnknownTestCases) were also corrected, which is a significant improvement for code correctness.
|
|
||
| stats.totalTestCases += summary.getTotalTestCases(); | ||
| stats.totalUnknownTestCases += summary.getUnkownTestCases(); | ||
| stats.totalUnknownTestCases += summary.getUnknownTestCases(); |
| } | ||
|
|
||
| public int getUnkownTestCases() { | ||
| public int getUnknownTestCases() { |
|
|
||
| assertThat(summary.getTotalTestCases()).isEqualTo(1); | ||
| assertThat(summary.getUnkownTestCases()).isEqualTo(1); | ||
| assertThat(summary.getUnknownTestCases()).isEqualTo(1); |
|
|
||
| assertThat(summary.getTotalTestCases()).isEqualTo(2); | ||
| assertThat(summary.getUnkownTestCases()).isEqualTo(0); | ||
| assertThat(summary.getUnknownTestCases()).isEqualTo(0); |
Comment on lines
227
to
239
| case DETAILED: | ||
| printSummary( | ||
| summaries, | ||
| /* showAllTests= */ true, | ||
| /* showNoStatusTests= */ true, | ||
| /* showAllTestCases= */ true); | ||
| break; | ||
|
|
||
| case DETAILED_UNCACHED: | ||
| case SHORT: | ||
| printSummary( | ||
| summaries, | ||
| /* showAllTests= */ true, | ||
| /* showNoStatusTests= */ false, | ||
| /* showAllTestCases= */ false); | ||
| break; | ||
|
|
||
| case SHORT_UNCACHED: | ||
| case TERSE: | ||
| printSummary( | ||
| summaries, | ||
| /* showAllTests= */ false, | ||
| /* showNoStatusTests= */ false, | ||
| /* showAllTestCases= */ false); | ||
| { | ||
| boolean showAllTests = SHOW_ALL_TESTS_FORMATS.contains(testSummaryFormat); | ||
| boolean showNoStatusTests = SHOW_NO_STATUS_TESTS_FORMATS.contains(testSummaryFormat); | ||
| boolean showAllTestCases = SHOW_ALL_TEST_CASES_FORMATS.contains(testSummaryFormat); | ||
| boolean showCachedTests = SHOW_CACHED_TESTS_FORMATS.contains(testSummaryFormat); | ||
| printSummary( | ||
| summaries, showAllTests, showNoStatusTests, showAllTestCases, showCachedTests); | ||
| break; |
There was a problem hiding this comment.
| TestSummaryFormat testSummaryFormat = options.getOptions(ExecutionOptions.class).testSummary; | ||
| if (testSummaryFormat == DETAILED || testSummaryFormat == TESTCASE) { | ||
| if (testSummaryFormat == DETAILED | ||
| || testSummaryFormat == DETAILED_UNCACHED |
| Label labelA = Label.parseCanonical("//foo/bar:baz" + i); | ||
| when(testSummary.getFailedTestCases()).thenReturn(ImmutableList.of()); | ||
| when(testSummary.getStatus()).thenReturn(BlazeTestStatus.FAILED_TO_BUILD); | ||
| when(testSummary.actionRan()).thenReturn(false); |
Contributor
Author
appears to be unrelated. |
Contributor
Author
appears to be unrelated. |
meisterT
approved these changes
Jan 20, 2026
short_uncached and detailed_uncached options to --test_summaryshort_uncached and detailed_uncached options to --test_summary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These options exclude cached test results from the summary.
With
short(default)With
short_uncachedResolves #28062
RELNOTES: Reporting of cached test results can now be suppressed with
--test_summary=short_uncachedor--test_summary=detailed_uncached.Backport of #28290.