Sharded tests interact awkwardly with --gtest_fail_if_no_test_selected, but we
can't speak clearly enough to the use cases to complicate the mental model, so
instead we attempt to clarify the simplest approach to debugging a single test
when sharding and --gtest_fail_if_no_test_selected are both in use: unset the
flag.
PiperOrigin-RevId: 829609266
Change-Id: I090d5bfac979171532249e9312feef8d9aad5f16
For `EXPECT_THAT` matcher usage, showing only the first failure meant
that users would sometimes have to make a fix and run the test again
only to notice that there's another failure. It's better to show more
failures so that the user can fix several issues in one go.
In practice, very little code actually wants the short circuiting here,
only a handful of cases with custom matchers used like
`AllOf(BoundsCheck(), UncheckedAccess())`. These cases are fixable by
refactoring `UncheckedAccess()` to instead also apply a bounds check to
fail the matcher rather than crash. Notably, this change doesn't affect
`AnyOf`, so another workaround is to change `AllOf(m1, m2, ...)` into
`Not(AnyOf(Not(m1), Not(m2), ...))`.
PiperOrigin-RevId: 826316273
Change-Id: Ie8186f75c10443d8da35b5d07b6a8cd9ae85b451
where it does not work when it is in ${TMP} and also fix the quoting
which was causing it to incorrectly receive the argument
https://github.com/bazelbuild/bazel/issues/27156
PiperOrigin-RevId: 826083231
Change-Id: If8f069c42c62434893db27bdaae0b0e25b67839d
This allows for simpler migration of function args to smart pointers without needing all changes to tests to be atomic.
PiperOrigin-RevId: 818635600
Change-Id: I9434685d9640f82b98d0b5261701b78c93d3ec1e
This also adds the dependencies of rules_cc to WORKSPACE.
bzlmod automatically pulls in dependencies.
skylib is removed as it is pulled in by a deps function.
PiperOrigin-RevId: 808659470
Change-Id: Idc41cad7b05019793d4a1898bdb80bc4797da5cf
Replace an internal link to AbslStringify's documentation with the equivalent public link.
PiperOrigin-RevId: 779085254
Change-Id: I2cbd2b6262a5ced06f166d4fcc7c08796e5a60af
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
There are two cases that prompt this behavior:
- All test cases in the binary are disabled.
- There are more shards defined than test cases, so some shards are empty.
The result in each case is the same: the test runner needs to spin up
additional processes that do nothing, which is wasteful, especially when tests
need expensive resources.
PiperOrigin-RevId: 769176856
Change-Id: Ifa399a0b7b68e4add5a94ca148b32b2938a8666d
While ConditionalPrintAsText gets a char pointer and the string length, it used to only pass the pointer to operator<<. That does not work for strings that are not zero terminated, because operator<< has to resort to strlen, which happily overflows the string buffer.
This CL wraps the char pointer and the length in a string_view and passes that to operator<< to fix that issue.
PiperOrigin-RevId: 765137769
Change-Id: Ie97067ce9d5b23175a512945fee943a8b95a94ff
This is a followup to a previous change switching std::u8string,
std::u16string, and std::u32string to print as string literals instead
of an array of characters. Also update the PrintCharsAsStringTo<Char>()
helper to handle cases where the pointer to the string data is null;
unlike std::basic_string<Char>, std::basic_string_view<Char>'s data()
is allowed to return nullptr.
The new PrintTo overloads complicate the PrintTo(internal::StringView)
overload, which needs to be disabled if internal::StringView is an alias
for std::string_view to avoid multiple definitions with the same
overload. Simply omitting the unconditional PrintTo(std::string_view)
overload is a worse option though, as this results in std::string_view
not printing nicely if internal::StringView is not an alias for
std::string_view.
PiperOrigin-RevId: 762020327
Change-Id: I92f5bdbacba89e97bbcc0fef3ca9261ea5a788d3
and std::variant now that the absl types are aliases of the
std types
PiperOrigin-RevId: 761136061
Change-Id: I702c3e1e8c58d003b8f4da99e7c84c9e5dbe1863
Clang has recently added "warnings when mixing different charN_t types" [1].
The rationale is that "charN_t represent code units of different UTF encodings.
Therefore the values of 2 different charN_t objects do not represent the same
characters."
Note that the warning here may be legitimate - from https://github.com/google/googletest/issues/4762:
"[...] This is incorrect for values that do not represent valid codepoints."
For the time being, silence the warning by being more explicit about the
conversion being intentional by using static_cast.
Link: https://github.com/llvm/llvm-project/pull/138708 [1]
PiperOrigin-RevId: 760644157
Change-Id: I2e6cc1871975455cecac8731b2f93fd5beeaf0e1
* Use abseil-cpp@20250512.0, which requires C++17 and
removes any/optional/variant polyfills
* Test C++23
* Support/test GCC15
* Use Bazel vendor mode to reduce reliance on GitHub
PiperOrigin-RevId: 759184924
Change-Id: Ifb866cdd7faf1e5be475b44f69870745e21a3104
This helps avoid a situation where someone sets up a parameterized test but forgets to actually use the parameter.
PiperOrigin-RevId: 758455362
Change-Id: Ie4db03e82b6a4e1787be96f154b3fbb25657ae64