From c67de117379f4d1c889c7581a0a76aa0979c2083 Mon Sep 17 00:00:00 2001 From: David Pizzuto Date: Fri, 27 Jun 2025 15:17:44 -0700 Subject: [PATCH] gtest: Reword fail_if_no_test_selected_message for sharding and filtering. Users have shown some confusion about the interaction between this flag, sharding, and --gtest_filter, so let's provide some more information. PiperOrigin-RevId: 776734799 Change-Id: Icdcf6aa056988095f15588758994604d326c0567 --- googletest/src/gtest.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index dafd968ed..804af4657 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -6092,7 +6092,11 @@ bool UnitTestImpl::RunAllTests() { constexpr char kNoTestsSelectedMessage[] = "No tests were selected to run. Please make sure at least one test " "exists and is not disabled! If the test is sharded, you may have " - "defined more shards than test cases, which is wasteful."; + "defined more shards than test cases, which is wasteful. If you also " + "defined --gtest_filter, that filter is taken into account, so " + "shards with no matching test cases will hit this error. Either " + "disable sharding, set --gtest_fail_if_no_test_selected=false, or " + "remove the filter to resolve this error."; ColoredPrintf(GTestColor::kRed, "%s\n", kNoTestsSelectedMessage); return false; }