aboutsummaryrefslogtreecommitdiff
path: root/googletest
AgeCommit message (Collapse)AuthorFilesLines
8 hoursAdd a bounds check to protect against an empty vector from GetArgs(), whichHEADmainAbseil Team1-2/+5
can cause an out of bounds access in GetCurrentExecutableName(). One way this can happen is if the user forgets to call InitGoogleTest(). PiperOrigin-RevId: 647740658 Change-Id: Id87692aa3d515b8ae0836e474be477d2aafa3871
2024-06-13Skip the predicate on SIGSEGV in death-test on Android builds with API level ↵Abseil Team1-0/+2
<= 21. PiperOrigin-RevId: 643076477 Change-Id: Id9486b7d73c3b17851df1eaf8f5ab2085238bf75
2024-05-21Change GoogleTest flag removal to not read beyond the end of the arrayDerek Mauro1-6/+6
to the NULL terminator. #4532 says ASAN complains about this on some platforms, although it is not clear if ASAN or the platform implementation is incorrect about accessing the terminating NULL. Fixes #4532 PiperOrigin-RevId: 635886009 Change-Id: Ibb4237055488c895b1dd09145ab979347bb9a390
2024-05-13Make EXPECT_DEATH_IF_SUPPORTED work with matchersAbseil Team2-26/+27
If death tests were not supported the macro would try to force the second parameter as a string. The second parameter can be a matcher or a string. PiperOrigin-RevId: 633199517 Change-Id: If5e71b4be0b569adb273eb4960202197bb264a8f
2024-05-06Merge pull request #4527 from abhina-sree:abhina/add_zosCopybara-Service1-1/+1
PiperOrigin-RevId: 631167807 Change-Id: I563883341972bbb82c7407ebf3755d64317b84fc
2024-05-02add zos for death test supportAbhina Sreeskantharajan1-1/+1
2024-05-02Merge branch 'main' into default-enable-thread-support-for-Solaris-AIX-zOSPaul Groke89-3426/+4850
2024-04-25Adds "IWYU pragma: export" to gtest-param-util.hAbseil Team1-1/+1
PiperOrigin-RevId: 628105419 Change-Id: I364e8089b62050c44059e208b610e324eb5a656d
2024-04-16Use `[[maybe_unused]]` when it is available to avoidDerek Mauro5-75/+101
-Wused-but-marked-unused warnings PiperOrigin-RevId: 625430612 Change-Id: Ia9d2e47984e1e6f91966afae8a6750119ae69446
2024-04-08Merge pull request #4508 from davidmatson:addJsonSkippedCopybara-Service3-16/+61
PiperOrigin-RevId: 622929007 Change-Id: Ifaf5a701baee74503e6845f32ebc27425882e950
2024-04-05No external changeAbseil Team1-1/+1
PiperOrigin-RevId: 622203227 Change-Id: Ic3c24edf917dbda7b02c6ab8ce695398a436dc4c
2024-04-04[gtest] Use `std::index_sequence` and friends instead of rolling our ownLawrence Wolf-Sonkin3-64/+14
* Applies for `std::index_sequence`, `std::make_index_sequence`, and `std::index_sequence_for` replacing `IndexSequence`, `MakeIndexSequence` and IndexSequenceFor` * Also deleted implementation helper `DoubleSequence` * The standard interfaces [have been in the standard library since C++14](https://en.cppreference.com/w/cpp/utility/integer_sequence), which [is the minimum supported C++ version by Google Test](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md) PiperOrigin-RevId: 621939977 Change-Id: Id264266f08da66c0fa2a6e6fbb8f86fd3cb3a421
2024-04-03Merge pull request #4505 from to01z:add-winapi-partition-games-supportCopybara-Service4-23/+26
PiperOrigin-RevId: 621631167 Change-Id: I0790f7082ce3c20fef92958c820d40ec854fe91d
2024-04-03Fix a race condition between the Watcher thread and the main threadDerek Mauro1-10/+25
during program exit A race condition exist between the Watcher thread and main(). A case was found where the Watcher thread does not get execution time before the main function returns and calls atexit(). At that point the Watcher thread started runing tls_init() code while the main thread was shutting down. This resulted in rare crashes and deadlocks. Fixes #4493 Closes #4494 PiperOrigin-RevId: 621619768 Change-Id: I66f00d8f0f3c37f9937c6d13890f7fa10038256d
2024-04-03Add skipped messages to JSON output (fixes #4507).David Matson3-16/+62
Fix the gap between JSON and XML output.
2024-04-02Merge pull request #4503 from davidmatson:fixTypoCopybara-Service1-1/+1
PiperOrigin-RevId: 621334548 Change-Id: I19747f832b51cc5bbb0231bbd9416a8373e4aa77
2024-04-02Merge pull request #4502 from davidmatson:fixStreamHelpTextOsCopybara-Service1-1/+1
PiperOrigin-RevId: 621172364 Change-Id: Ibaacb17c60b5ee0e58c3689b79aa2cd6b49dc1c4
2024-03-30Automated Code ChangeAbseil Team1-2/+2
PiperOrigin-RevId: 620448229 Change-Id: I487a0d8a8f89ebe82c9ec66fbb60cbe2203188c9
2024-03-28Revert changes to googletest-port-test.ccTroels Gram1-2/+2
GoogleTest's tests do not currently compile when WINAPI_FAMILY is set to anything else than WINAPI_FAMILY_DESKTOP_APP on Windows (if WINAPI_FAMILY is not set explicitly, it will default to WINAPI_FAMILY_DESKTOP_APP).
2024-03-28Fix typo in comment.David Matson1-1/+1
2024-03-28Fix help text for stream_result_to flag.David Matson1-1/+1
Support for Mac was previously added, in addition to Linux. Fix the help text to match the code.
2024-03-23Add support for compiling GoogleTest for XboxTroels Gram5-13/+19
Support for Xbox platforms, requires the code to support compilation with the WINAPI_FAMILY_GAMES subset of the Win32 API. - Add support for WINAPI_FAMILY_GAMES to enable GTEST_OS_WINDOWS_GAMES platform. - Disable stream redirection (GTEST_HAS_STREAM_REDIRECTION = 0) and colored TTY printing for GTEST_OS_WINDOWS_GAMES platform. Both features currently require Win32 functions that don't exist in the WINAPI_FAMILY_GAMES subset. Misc fixes: - gtest-port.cc: Move GTEST_DISABLE_MSC_DEPRECATED_PUSH_ into GTEST_HAS_STREAM_REDIRECTION conditional section where the corresponding GTEST_DISABLE_MSC_DEPRECATED_POP_ is located. - googletest-port-test.cc: Switch stream redirection tests to be conditional on GTEST_HAS_STREAM_REDIRECTION instead of !defined(GTEST_OS_WINDOWS_MOBILE).
2024-03-18Merge pull request #4490 from memdo:mainCopybara-Service3-10/+13
PiperOrigin-RevId: 616931521 Change-Id: Iffbb24e3f9add4e7acf8f1988a03afc8628b0733
2024-03-16Add colored output support for AlacrittyMustafa Berkay Düzenli3-0/+5
2024-03-07Reland: Optimize Google Test process startupAbseil Team6-144/+141
Google Test performs hidden test registration during process startup. For test binaries that contain a large number of tests, this registration can be costly. In this CL, we reduce the overhead of registration via several tactics: - Treat CodeLocation and FilePath as value types, using std::move to pass them around. - Reduce string copies in various places by either passing std::string values via std::move, or passing const-refs to std::string instances. - Use std::to_string to stringify an int in DefaultParamName rather than a std::stringstream. - Pull some std::string instances out of nested loops in ParameterizedTestSuiteInfo::RegisterTests so as to reuse some allocations, and replace stringstream with ordinary string appends. - Use std::unordered_map in UnitTestImpl::GetTestSuite and ParameterizedTestSuiteRegistry::GetTestSuitePatternHolder to spend a little memory to turn O(N) lookups into constant time lookpus. - Use range-based for loops in a few places. - Use emplace-ish methods to add to containers where appropriate. All together, these changes reduce the overall runtime of a series of 50 death tests in a single Chromium test executable by ~38% due to the fact that the registration costs are paid in every death test's child process. PiperOrigin-RevId: 613833210 Change-Id: I51a262a770edff98ffa1e3b60c4d78a8308f9a9f
2024-03-05Revert Optimize Google Test process startupAbseil Team6-160/+162
PiperOrigin-RevId: 612878184 Change-Id: Ia8e23da1ad09c2e0ce635a855f0c250f368f6878
2024-03-05Optimize Google Test process startupAbseil Team6-162/+160
Google Test performs hidden test registration during process startup. For test binaries that contain a large number of tests, this registration can be costly. In this CL, we reduce the overhead of registration via several tactics: - Treat CodeLocation and FilePath as value types, using std::move to pass them around. - Reduce string copies in various places by either passing std::string values via std::move, or passing const-refs to std::string instances. - Use std::to_string to stringify an int in DefaultParamName rather than a std::stringstream. - Pull some std::string instances out of nested loops in ParameterizedTestSuiteInfo::RegisterTests so as to reuse some allocations, and replace stringstream with ordinary string appends. - Use std::unordered_map in UnitTestImpl::GetTestSuite and ParameterizedTestSuiteRegistry::GetTestSuitePatternHolder to spend a little memory to turn O(N) lookups into constant time lookpus. - Use range-based for loops in various places. - Use emplace-ish methods to add to containers where appropriate. All together, these changes reduce the overall runtime of a series of 50 death tests in a single Chromium test executable by ~38% due to the fact that the registration costs are paid in every death test's child process. PiperOrigin-RevId: 612763676 Change-Id: I1f46e012ccb9004c009e1027e4f7c38780ffb9e2
2024-02-28Merge pull request #4477 from tmiguelf:feature/soup_cleanupCopybara-Service1-10/+10
PiperOrigin-RevId: 611133343 Change-Id: Ieef806f51fcbc2877805dae415f76d03547b8dfa
2024-02-27Make sure that current_test_suite and current_test_info are mutex-protected ↵Abseil Team3-30/+59
while writing for thread-safety. PiperOrigin-RevId: 610810340 Change-Id: I37f33510373dff04b8e9c9e8a9f32d30fcce46ff
2024-02-23Fixed gcc linker error 58Tiago Freire1-10/+20
2024-02-14gtest.h: add IWYU export pragmasAbseil Team1-10/+10
PiperOrigin-RevId: 607136416 Change-Id: Ia29dd3156d4d455194745e58501eaee9d77045a1
2024-02-07Use _Exit instead of _exit in GoogleTestAbseil Team3-44/+48
_Exit is standardized since C99, whereas _exit is POSIX-only. Fixes: #4447 PiperOrigin-RevId: 605000352 Change-Id: Ibfa84edaa043bd003a21383e8148bf45be7217f6
2024-02-06Destroy installed environments in normal code, not in static teardown.Abseil Team4-51/+67
Destruction in static teardown causes issues for Environments which own threads and try to join them in their destruction. This may be a breaking change for users who call RUN_ALL_TESTS multiple times in the same main function if they also install environments, or those who access registered environments after RUN_ALL_TESTS. The easiest fix is to only call RUN_ALL_TESTS once as the last line of the main function. Another potential fix is to re-register new instances of the Environment once before each call to RUN_ALL_TESTS. PiperOrigin-RevId: 604800795 Change-Id: I37c44d4aca4a238052649f45a4b6b9cfb5355b71
2024-01-31Modifications to improve portability of googletest tests.Abseil Team2-5/+12
PiperOrigin-RevId: 603034597 Change-Id: I4d716ed67f80f41075bfa266d975460d2ac27eb6
2024-01-30Do not emit stack traces for messages generated by SUCCEED()Abseil Team2-8/+14
Stack traces in assertion failures are an extremely useful tool for developers tasked with investigating failing tests. It's difficult to understate this. In contrast to ordinary test assertions (e.g., ASSERT_TRUE or EXPECT_FALSE), SUCCEED() is a developer-authored directive that indicates a success codepath. In fact, the documentation states that this directive doesn't generate any output. Generating stack traces for uses of SUCCEED() is wasted work since they are never printed. If this were to change one day in the future, they still would not be useful since any emitted message would include the file and line number where SUCCEED was used. In addition to being noise in the output in this case, symbolization of stack traces is not free. In some Chromium configurations, symbolization for use of SUCCEED() can incur a cost in excess of 25 seconds for a test that otherwise takes 0-1ms; see https://crbug.com/1517343. In this CL, we suppress generation and emission of stack traces for kSuccess messages to reduce the overhead of SUCCEED(). PiperOrigin-RevId: 602832162 Change-Id: I557dd6a1d3e6ed6562daf727d69fd01fe914827b
2024-01-23Fix double-promotion warnings in AppropriateResolution()Abseil Team1-21/+28
When -Wdouble-promotion is enabled, the templatized function AppropriateResolution fails to compile since its float instantiation promotes floats to doubles when doing arithmetic and comparisons. Add static casts to resolve these errors. PiperOrigin-RevId: 600776333 Change-Id: Ia530b4bbca6ddce27caf0a817196d87efef711cb
2024-01-22Merge pull request #4444 from ↵Copybara-Service1-1/+1
michaeldleslie:only_apply_lregex_for_qnx710_and_newer PiperOrigin-RevId: 600548775 Change-Id: Ia693791321602e728aef9135b349602c790a058a
2024-01-22googletest: Fix incorrect comment about `value_param` of ↵Dino Radakovic1-1/+1
`internal::MakeAndRegisterTestInfo` This was probably a copy-paste from the comment about `type_param`. PiperOrigin-RevId: 600493462 Change-Id: I4a41c2673dd6560db0f68856aab3d32b103164b1
2024-01-18If GTEST_NO_ABSL_FLAGS is #defined, then the Abseil flag libraryAbseil Team2-6/+14
will not be used by googletest, even if GTEST_HAS_ABSL is #defined. PiperOrigin-RevId: 599625032 Change-Id: Ieb994a15683dec89e88578120071eca8ac9fead1
2024-01-16Make posix::FileNo available under !GTEST_HAS_FILE_SYSTEMAbseil Team2-6/+11
This enables automatic color output without filesystem support, as that only requires testing to see if the output is a terminal. Fixes: #4439 PiperOrigin-RevId: 598929397 Change-Id: Idca7490e6e090951a78cd1cdd710f41d756a68b4
2024-01-16Do not emit stack traces for messages generated by GTEST_SKIP()Abseil Team3-8/+15
Stack traces in assertion failures are an extremely useful tool for developers tasked with investigating failing tests. It's difficult to understate this. In contrast to ordinary test assertions (e.g., ASSERT_TRUE or EXPECT_FALSE), GTEST_SKIP is a developer-authored directive to skip one or more tests. Stack traces emitted in skip messages do not give the developer useful information, as the skip message itself contains the code location where GTEST_SKIP was used. In addition to being noise in the output, symbolization of stack traces is not free. In some Chromium configurations, symbolization in a skipped test can incur a cost in excess of 25 seconds for a test that otherwise takes 0-1ms; see https://crbug.com/1517343#c9. In this CL, we suppress generation and emission of stack traces for kSkip messages to reduce the output noise and overhead of GTEST_SKIP(). PiperOrigin-RevId: 598899010 Change-Id: I46926fed452c8d7edcb3d636d8fed42cb6c0a9e9
2024-01-10only apply -lregex for qnx710 and newerMichael Leslie1-1/+1
2024-01-09Disable -Wfloat-equal in AppropriateResolution().Krzysztof Kosiński1-0/+7
This function makes exact floating point that are correct in this context, but trigger the compiler warning. PiperOrigin-RevId: 596944060 Change-Id: I4bba3c2abcf3ac189107530978961955ad47d6f0
2023-12-12Add `FAIL_AT` macro variant of `FAIL` matching `ADD_FAILURE`, `ADD_FAILURE_AT`Abseil Team1-0/+1
`FAIL_AT` is shorthand for `GTEST_FAIL_AT` like `FAIL` is for `GTEST_FAIL`. PiperOrigin-RevId: 590393926 Change-Id: I68263af8fa2f98ca0bbef509d475c84e22068018
2023-12-11Remove unnecessary conversionTom Hughes1-2/+2
`GetAbsolutePathToOutputFile` returns a `std::string` and `OpenFileForWriting` takes a `std::string&`. PiperOrigin-RevId: 589984409 Change-Id: I75be9cb105f49b3a279a5d33b1b82dfcfc912cfd
2023-12-04Merge pull request #4426 from tamaskenez:cmake_external_absl_re2Copybara-Service1-0/+4
PiperOrigin-RevId: 587836393 Change-Id: Ia8895898bd0a826b35dc0ebedd8c76503bc8cd43
2023-12-04Skip find_package(Python3) when not building testsDerek Mauro1-1/+3
#4424 claims this saves several seconds of build time Closes #4424 PiperOrigin-RevId: 587827426 Change-Id: I207779a6539f9af16a39d6b40887770dc930b74f
2023-12-01Allow using external absl and re2.Tamas Kenez1-0/+4
2023-10-30Merge pull request #4397 from botovq:raiseCopybara-Service1-0/+1
PiperOrigin-RevId: 577958594 Change-Id: I8a27f67dc5b6817b741bfd2fc0f27c6302291a00
2023-10-25Add missing include for raise(3)Theo Buehler1-0/+1
If SIGTRAP is defined, this file may end up using raise(3), which is defined in csignal, leading to a compilation failure on at least OpenBSD/sparc64 with gcc 8.