Skip to content

[9.1.0] Add short_uncached and detailed_uncached options to --test_summary#28341

Merged
iancha1992 merged 1 commit intobazelbuild:release-9.0.0from
Silic0nS0ldier:uncached-test-summary-options_9.0.0
Jan 22, 2026
Merged

[9.1.0] Add short_uncached and detailed_uncached options to --test_summary#28341
iancha1992 merged 1 commit intobazelbuild:release-9.0.0from
Silic0nS0ldier:uncached-test-summary-options_9.0.0

Conversation

@Silic0nS0ldier
Copy link
Contributor

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 #28062

RELNOTES: Reporting of cached test results can now be suppressed with --test_summary=short_uncached or --test_summary=detailed_uncached.

Backport of #28290.

…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
@Silic0nS0ldier Silic0nS0ldier requested a review from a team as a code owner January 20, 2026 13:37
@github-actions github-actions bot added team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Jan 20, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line fixes a typo from getUnkownTestCases to getUnknownTestCases. This is a critical correction for method naming consistency and clarity.

}

public int getUnkownTestCases() {
public int getUnknownTestCases() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line fixes a typo from getUnkownTestCases to getUnknownTestCases. This is a critical correction for method naming consistency and clarity.


assertThat(summary.getTotalTestCases()).isEqualTo(1);
assertThat(summary.getUnkownTestCases()).isEqualTo(1);
assertThat(summary.getUnknownTestCases()).isEqualTo(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line fixes a typo from getUnkownTestCases to getUnknownTestCases. This is a critical correction for method naming consistency and clarity.


assertThat(summary.getTotalTestCases()).isEqualTo(2);
assertThat(summary.getUnkownTestCases()).isEqualTo(0);
assertThat(summary.getUnknownTestCases()).isEqualTo(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line fixes a typo from getUnkownTestCases to getUnknownTestCases. This is a critical correction for method naming consistency and clarity.

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The refactoring of the switch statement to use ImmutableSet constants (SHOW_ALL_TESTS_FORMATS, etc.) significantly improves the readability and maintainability of this logic. It clearly delineates which TestSummaryFormat options correspond to which display behaviors.

TestSummaryFormat testSummaryFormat = options.getOptions(ExecutionOptions.class).testSummary;
if (testSummaryFormat == DETAILED || testSummaryFormat == TESTCASE) {
if (testSummaryFormat == DETAILED
|| testSummaryFormat == DETAILED_UNCACHED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Adding DETAILED_UNCACHED to this condition ensures that the detailed test case statistics are correctly printed when this new summary format is selected. This is a necessary functional update.

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Adding when(testSummary.actionRan()).thenReturn(false); is crucial for accurately testing the short_uncached and detailed_uncached functionalities, as it simulates a cached test result that should be filtered out by these new options.

@Silic0nS0ldier
Copy link
Contributor Author

CI failure: https://buildkite.com/bazel/bazel-bazel-github-presubmit/builds/31376/steps/canvas?jid=019bdba0-ad52-4ce5-a561-5eda8fff433f#019bdba0-ad52-4ce5-a561-5eda8fff433f/L580

(14:40:41) ERROR: The module extension '@@rules_python+//python/extensions:config.bzl%config' does not exist in the lockfile

appears to be unrelated.

@Silic0nS0ldier
Copy link
Contributor Author

CI failure: https://buildkite.com/bazel/bazel-bazel-github-presubmit/builds/31376/steps/canvas?jid=019bdba0-ad68-40ec-b44a-75dc1fdc17d8#019bdba0-ad68-40ec-b44a-75dc1fdc17d8

//src/test/java/com/google/devtools/build/lib/authandtls/credentialhelper:credentialhelper FAILED in 3 out of 3 in 58.0s

appears to be unrelated.

@iancha1992 iancha1992 added this to the 9.0.0 release blockers milestone Jan 20, 2026
@iancha1992 iancha1992 added the soft-release-blocker Soft release blockers that are nice to have, but shouldn't block the release if it's the last one. label Jan 20, 2026
@iancha1992 iancha1992 changed the title [9.0.0] Add short_uncached and detailed_uncached options to --test_summary [9.1.0] Add short_uncached and detailed_uncached options to --test_summary Jan 20, 2026
@iancha1992 iancha1992 enabled auto-merge (squash) January 22, 2026 20:05
@iancha1992 iancha1992 merged commit 87aad18 into bazelbuild:release-9.0.0 Jan 22, 2026
46 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

soft-release-blocker Soft release blockers that are nice to have, but shouldn't block the release if it's the last one. team-Configurability platforms, toolchains, cquery, select(), config transitions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants