4634 Commits

Author SHA1 Message Date
Abseil Team
af4c3cfcb3 Automated Code Change
PiperOrigin-RevId: 955017590
Change-Id: I5125f56376603462fb63796fec1fbc50fd4d935f
2026-07-27 21:57:20 -07:00
Abseil Team
ecb18f0b03 Automated Code Change
PiperOrigin-RevId: 955003621
Change-Id: I83518a7f947d9f7d9b89fe14e1219d32bcdc95a3
2026-07-27 21:17:32 -07:00
Abseil Team
b78aa5ee64 Automated Code Change
PiperOrigin-RevId: 953750672
Change-Id: I9314622e998cb9d17eec0dc1baeb6d8bc8a801fd
2026-07-24 23:56:31 -07:00
Abseil Team
56cf341d9c Remove useless casts in gtest-internal-inl.h
Fixes: #4711
PiperOrigin-RevId: 953674507
Change-Id: Id744824553157d54eade6de5a542a5783fefd1d8
2026-07-24 19:31:32 -07:00
Copybara-Service
136a6b8865 Merge pull request #4994 from edge90:fix/onceaction-tuple-sfinae-order
PiperOrigin-RevId: 953630264
Change-Id: Iad16b5ee9a92ccb6b580733be18dbeb85371e66d
2026-07-24 17:31:32 -07:00
Abseil Team
425811f10e Undo make string matchers work with std::wstring_view due to internal breakages
Reopens: #4912
PiperOrigin-RevId: 953470061
Change-Id: Ie979aa352f0ecbfb27dec5a41aae4b668cf7541b
2026-07-24 11:27:08 -07:00
Copybara-Service
679a61d3a8 Merge pull request #5035 from K-S-Manikandan:fix-cmake-uninit-var
PiperOrigin-RevId: 953425063
Change-Id: I76419008d1469e91f98622056524bd0d46ad0eb8
2026-07-24 10:06:23 -07:00
Abseil Team
80b3670e1a Maintain constness in assertions & expectations to resolve operator bool() cv-qualifier inconsistency between ASSERT_FALSE/EXPECT_FALSE vs. ASSERT_TRUE/EXPECT_TRUE
Currently, these macros do not behave consistently in how they convert objects to bool, adding extra const qualifiers or using operator!(). This causes them to produce unexpected behavior on types such as the following:

```
struct example {
    operator bool() { throw std::runtime_error("constness not propagated"); }
    operator bool() const { return ...; }
};
```

This change preserves the qualifiers of the evaluated objects and makes the evaluation strategy uniform across macros.

Fixes: #4832
PiperOrigin-RevId: 953424646
Change-Id: I670a72eec11272c3b68d7eb6f739a15da227acde
2026-07-24 10:05:36 -07:00
Copybara-Service
44f4904703 Merge pull request #4798 from scivision:oneapi
PiperOrigin-RevId: 953424235
Change-Id: I2b69feb3e9e001847c90db6cb596d89ad394b3c5
2026-07-24 10:04:54 -07:00
Abseil Team
fef8e5e23b Make string matchers work with std::wstring_view
Fixes: #4912
PiperOrigin-RevId: 953423131
Change-Id: Id288c01c9d1bd9c92ce78b89ec3e8587f4ffc2a7
2026-07-24 10:03:44 -07:00
Abseil Team
a798392000 Avoid triggering -Wzero-as-null-pointer-constant in HandleExceptionsInMethodIfSupported()
Fixes: #2916
PiperOrigin-RevId: 953422776
Change-Id: Ic5a167e93d611adb184c516a6383dcc119e11fd7
2026-07-24 10:02:58 -07:00
Copybara-Service
c914e89e2a Merge pull request #4877 from charles-lunarg:fix_CMake_option_gtest_force_shared_crt
PiperOrigin-RevId: 953422334
Change-Id: I769777aa8b4a886638a178b4e446677711f00240
2026-07-24 10:02:11 -07:00
Abseil Team
0dbcd8d006 Fix typo in docs/gmock_cheat_sheet.md
Closes: #4735
PiperOrigin-RevId: 953422159
Change-Id: I6c0c227ee4a997d346091fee32bd9b23bcc760ab
2026-07-24 10:01:33 -07:00
Abseil Team
a901203eff Display the Win32 error code when GetTempFileName() fails on Windows to aid debugging
Closes: #4578
Fixes: #4566
PiperOrigin-RevId: 953335097
Change-Id: Ibc6ed3f2695cafb230e245dca625413f12536323
2026-07-24 06:29:02 -07:00
Copybara-Service
d4e2591485 Merge pull request #5033 from UditDewan:fix/absolute-install-includedir
PiperOrigin-RevId: 953333932
Change-Id: I1f3dfb118bb2a7e3b4ae64fcc4206baf4c8e7f4b
2026-07-24 06:25:48 -07:00
Abseil Team
7ec05f657d Handle both -F and /F formats in GoogleTest CMake command lines as MSVC accepts both
This is the legacy fix for https://github.com/google/googletest/issues/4731, and to prevent similar breakages in the future with other flags.

The modern fix will be handled separately.

PiperOrigin-RevId: 953333662
Change-Id: I7c58b0123170878f0fe6909cabd5decc922b38f1
2026-07-24 06:25:09 -07:00
Copybara-Service
a503186d79 Merge pull request #5039 from alvinjaison:fix/premature-exit-file-null-deref
PiperOrigin-RevId: 952921022
Change-Id: Ic7c587ad76eb56a9995043c86ee09c64afd52504
2026-07-23 13:21:28 -07:00
Abseil Team
7f7595f67d Make GTEST_DEFINE... macros also declare the flag to avoid triggering -Wmissing-variable-declarations
The alternate implementation based on ABSL_FLAG() already does this internally, so this resolves the inconsistency.

Fixes: #4897
PiperOrigin-RevId: 952840499
Change-Id: I7b8f61d2e9a97ffcd3db091abc373c9d9b48db79
2026-07-23 10:39:55 -07:00
Alvin Jaison
e331081278 Fix null pointer dereference in ScopedPrematureExitFile When TEST_PREMATURE_EXIT_FILE is set to a path that cannot be opened for writing (e.g., non-existent directory or insufficient permissions), posix::FOpen returns NULL. Previously, fwrite and fclose were called unconditionally on the result, causing a segmentation fault. This change: - Adds a null check before calling fwrite/fclose - Tracks whether the file was successfully created via a file_created_ flag, so the destructor only attempts removal when the file actually exists This matches the existing comment's stated intent that I/O errors should be silently ignored. 2026-07-23 09:24:19 +01:00
Copybara-Service
08da6214b8 Merge pull request #5036 from Tachi107:cmake-pthread-flag
PiperOrigin-RevId: 952246866
Change-Id: Idccc63f83a51d6c143966d45fa197677ea58ca16
2026-07-22 11:49:28 -07:00
Andrea Pappacoda
1be4946590 Prefer -pthread flag on CMake
In the past, GoogleTest could not set this flag unconditionally as it
would break CUDA on CMake versions older than 3.13. As the project now
requires at least CMake 3.16, it's safe to enable and finally prefer
-pthread to -lpthread.

This does not make any difference on systems with glibc 2.34 as newer,
as libpthread is part of libc now.

Properly fixes #2482
2026-07-21 19:24:45 -03:00
Mike Kruskal
30a3151b0c Fix broken tests due to deprecation warning
PiperOrigin-RevId: 951523081
Change-Id: I145c6066a202629e5d0c89453d726495dd535290
2026-07-21 09:06:28 -07:00
Manikandan K. S.
51109ebb47 fix: initialize cxx_strict_flags before compiler branches
cxx_strict_flags was omitted in several compiler conditional blocks
(such as MSVC, SunPro, XL, and HP), leading to a CMake developer
warning about an uninitialized variable when dev warnings are enabled.

Fixes #4071
2026-07-19 18:34:59 +05:30
uditDewan
fcd5e26089 Fix exported include paths for absolute CMAKE_INSTALL_INCLUDEDIR
The INSTALL_INTERFACE include directory was written as
$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}, which unconditionally
prepends the install prefix. When CMAKE_INSTALL_INCLUDEDIR is an
absolute path, the exported GTestTargets.cmake ends up with an invalid
doubled path such as "/usr/local//usr/local/include", and find_package
consumers fail at configure time with "Imported target includes
non-existent path".

Relative paths inside $<INSTALL_INTERFACE:...> are already interpreted
relative to the installation prefix, so the explicit $<INSTALL_PREFIX>/
prefix is redundant for relative values and wrong for absolute ones.
Dropping it keeps the exported path identical for relative values
(${_IMPORT_PREFIX}/include) and uses absolute values as-is.

Fixes #4817
2026-07-18 14:59:31 -04:00
Abseil Team
fa005b296f Set up inlining for InvokeWithoutArgs when passed a functor.
Actions can now be implicitly constructed from zero-argument callables. There is no need to create wrapper objects using InvokeWithoutArgs().

PiperOrigin-RevId: 949656497
Change-Id: Ida2bc38e446e7b33aaf185ec593caf2a1959138e
2026-07-17 10:58:22 -07:00
Copybara-Service
4141c384aa Merge pull request #4939 from fresh3nough:fix/cmake-python3-find-4847
PiperOrigin-RevId: 949359007
Change-Id: I3935301d293d9165db7dcda0c64cc821bdfe5186
2026-07-16 22:01:49 -07:00
Bogdan Graur
a25f43576e Fixes -Wtautological-pointer-compare in gmock-matchers
PiperOrigin-RevId: 948667420
Change-Id: Ibb35d7e6469a193607a72f10377ef3a494f9525f
2026-07-15 18:51:05 -07:00
Copybara-Service
b973ccb9ab Merge pull request #5025 from K-S-Manikandan:fix/output-test-python3
PiperOrigin-RevId: 948328634
Change-Id: I9d2c42a63138095b88cc0cff16f69e8220ee1dfd
2026-07-15 07:37:08 -07:00
Copybara-Service
f132c89311 Merge pull request #5019 from kamleshkumaryadav5951-pixel:fix-emscripten-pthread-odr
PiperOrigin-RevId: 946412596
Change-Id: I86547a9de58b29f038e5bcdd21dadbad9506888d
2026-07-11 21:38:07 -07:00
Copybara-Service
961158b5e3 Merge pull request #4869 from phst:alwayslink
PiperOrigin-RevId: 946402457
Change-Id: I78650f118c24fb668bf51e861cf910a997ff227d
2026-07-11 21:03:28 -07:00
Manikandan K. S.
86ec940f63 fix: Python 3 crash in googletest-output-test.py debug mode
Fixes #3943

Change file open mode from 'wb' (binary) to 'w' (text) when writing
normalized output in DEBUG_GTEST_OUTPUT_TEST mode.
2026-07-11 19:37:13 +05:30
kamlesh kumar yadav
bc410696f4 Support pthread-enabled Emscripten in GTEST_HAS_PTHREAD 2026-07-09 12:23:52 +05:30
Copybara-Service
8240fa7d62 Merge pull request #5011 from K-S-Manikandan:fix/compare-lib-android
PiperOrigin-RevId: 944164816
Change-Id: Ia57a34e3caf93d23b6a13c49e2455901c98e942a
2026-07-07 16:54:00 -07:00
Mike Kruskal
7d012aa162 Fail smoothly for nullptr on c-style strings in IsEmpty
PiperOrigin-RevId: 944115454
Change-Id: I99284439b0c0e0acee1cb4e12f2d0b8d422c83ba
2026-07-07 15:11:54 -07:00
Copybara-Service
cd975499e8 Merge pull request #5008 from K-S-Manikandan:fix/wide-string-isempty
PiperOrigin-RevId: 944044650
Change-Id: I9dcd6625f41f4f098439d222c26383150f7e8f6a
2026-07-07 12:49:50 -07:00
Copybara-Service
3064a609c7 Merge pull request #5005 from tejas-sharma27:fix-help-missing-flags
PiperOrigin-RevId: 943911159
Change-Id: I42c77c8ec667c37032563c92e4b8190473892b77
2026-07-07 08:32:49 -07:00
Copybara-Service
3549aa63f2 Merge pull request #5006 from K-S-Manikandan:fix/readme-fullstops
PiperOrigin-RevId: 943641260
Change-Id: I66e46d88e36282b283124f1dec327bafe425bcef
2026-07-06 20:45:23 -07:00
Copybara-Service
985d542c73 Merge pull request #5010 from K-S-Manikandan:fix/main-version-bump
PiperOrigin-RevId: 943495261
Change-Id: I38548207cd67695c2fb76b64b47b46f21b783e2c
2026-07-06 14:24:28 -07:00
Manikandan K. S.
18c6bc3dc4 fix: only use __cpp_lib_three_way_comparison for <compare> detection
The fallback check GTEST_INTERNAL_HAS_INCLUDE(<compare>) && C++20 causes build failures on Android NDK 24 which has the header but lacks the full comparison operators needed by PrintTo. The feature test macro __cpp_lib_three_way_comparison is the reliable indicator.

Fixes #4933
2026-07-05 09:04:37 +05:30
Manikandan K. S.
22bda2ba15 chore: bump main branch version to 1.18.0 2026-07-05 08:54:29 +05:30
Manikandan K. S.
df4fdc5cfd fix: add C-style wide string overload to IsEmpty matcher 2026-07-04 22:50:12 +05:30
Manikandan K. S.
1c2082e8bd docs: add missing full stops to feature descriptions in README 2026-07-04 22:14:52 +05:30
Tejas Sharma
5b39f4c876 Add missing public flags to --help output 2026-07-04 21:54:09 +05:30
Clayton Knittel
973323ed64 Delay name resolution by un-qualifying DynamicCastMessage calls from gMock.
Since we can't directly depend on proto headers, we rely on ADL + proto headers being included by calling code for this matcher to choose the right overload of `DynamicCastMessage`.

PiperOrigin-RevId: 940593408
Change-Id: I7374aed3c5cfe61a183d28ea02e6583ab340f647
2026-06-30 12:20:56 -07:00
Copybara-Service
78f6d54f9f Merge pull request #5003 from fuzzard:fix_cmake_pdb_output
PiperOrigin-RevId: 939912323
Change-Id: I2069975b7ba0d9decdf8c61ad77139494886469a
2026-06-29 10:41:38 -07:00
Abseil Team
8b53336594 Automated Code Change
PiperOrigin-RevId: 936635684
Change-Id: I3b1bfa2ef921cdc3d0aaa1fc95986b64a9ad0282
2026-06-23 06:45:34 -07:00
Abseil Team
aa40ee603e Automated Code Change
PiperOrigin-RevId: 936616624
Change-Id: I3a05afadf807fc372337186c26b5d73a2bc21410
2026-06-23 06:03:11 -07:00
Brent Murphy
d4a1a3599b cmake: Fix PDB output dir for install of static and shared lib
PR https://github.com/google/googletest/pull/3940 added COMPILE_PDB_OUTPUT_DIRECTORY
without updating the install command to accommodate the two PDB properties.
COMPILE_PDB_* and PDB_* properties are two distinct properties that affect static
(COMPILE_PDB_*) and shared (PDB_*) separately.
This commit adds cmake install rule for both types (optionally) to install when available
2026-06-22 19:05:27 +10:00
Abseil Team
1fc11dea10 Automated Code Change
PiperOrigin-RevId: 935893961
Change-Id: I90f8e57a7337f66a2afd37a2f0bc0e418e1ef51e
2026-06-22 00:44:28 -07:00
Clayton Knittel
0b1e895ba4 Specialize testing::WhenDynamicCastTo for protobuf messages.
Protobuf messages have a custom dynamic_cast, for when RTTI is not available on the messages.

PiperOrigin-RevId: 933270097
Change-Id: Iaeb50bce3fe1b746306a7507ab1985b111c03416
2026-06-16 13:32:04 -07:00