summaryrefslogtreecommitdiffstats
path: root/googletest/src/gtest.cc
Commit message (Collapse)AuthorAgeFilesLines
* fix: some typos in sourcerefs/pull/3927/headyutotnh2022-07-011-3/+3
|
* Merge pull request #3866 from eidosmontreal:simplify_shouldusecolorCopybara-Service2022-06-131-5/+0
|\ | | | | | | | | PiperOrigin-RevId: 454616721 Change-Id: I33b5671646ec027da48cc941baf84b4ddc722e07
| * Simplify ColoredPrintf to rely on ShouldUseColorGaspard Petit2022-05-301-7/+1
|/ | | | Use ShouldUseColor to set use_color instead of having a separate check for the windows mobile cases; these cases are now moved directly to `DoIsATTY`
* Do a consistent way of searching for a temporary directory.Abseil Team2022-05-111-25/+26
| | | | | | | | | | | | | | | | | | | | | | | | | The way temporary directories were discovered from environment variables in different operating systems was inconsistent. On Windows, only the system-specific environment variable TEMP was considered, but not the bazel-common TEST_TMPDIR. On Unix, only TEST_TMPDIR was considered, but not the otherwise typical system specific TMPDIR. Now, always consider TEST_TMPDIR first, followed by the system-typical environment variable (TEMP on Windows, TMPDIR on Unix) before falling back to a default on that particular system. Also: the value for the temporary directory coming from the environment variable was only checked for a trailing directory separator on Windows (and appended if needed), not on the other platforms. Make this also consistent accross the systems: Now always apply the same logic to all of these (to accomodate tests that just concatenate TempDir() without directory separator). PiperOrigin-RevId: 447909830 Change-Id: I9ea17acdf5944eb2a965615fd9cf142878c33a58
* Use TEST_TMPDIR on MacOS as well if available.Abseil Team2022-05-031-2/+2
| | | | | | | | | | | | | | | Currently MacOS falls back to generic /tmp, but for all intents and purposes it should behave like other Unixes using the TEST_TMPDIR environment variable if available (this environment variable is set in bazel, which sets up a unique temp directory for the test process). While at it, remove an incorrect #endif comment, that looks like a leftover from some older implementation. PiperOrigin-RevId: 446108391 Change-Id: I118eacf6e86a41d26cb81a130f7c54cccc0c5665
* Remove the legacy internal GTEST_DISALLOW_* macrosDerek Mauro2022-04-221-4/+9
| | | | | PiperOrigin-RevId: 443715444 Change-Id: I3ffd54b63d2728ae4a668ee7875c8c3c8188087c
* Use the Abseil flags library when Abseil is presentDerek Mauro2022-04-041-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | When built with `--define=absl=1` under Bazel, GoogleTest flags use ABSL_FLAG instead of GoogleTest's own implementation. There are some minor behavior differences in this mode. The most notable difference is that unrecognized flags result in a flag parsing error, and are not returned to the user though a modified argc/argv, unless they appear after the positional argument delimiter ("--"). For example, to pass a non-Abseil flag, you would have to do ./mytest --gtest_color=false -- --myflag=myvalue The documentation at https://abseil.io/docs/cpp/guides/flags may be helpful in understanding the behavior. There are some other minor differences. For example, passing --help results in the program returning 1 instead of 0. https://github.com/google/googletest/issues/3646 PiperOrigin-RevId: 439312700 Change-Id: Id696a25f50f24a5b1785c45ca8fa59794f86fd5c
* Only print disabled test banner if the test matches gtest_filterAbseil Team2022-03-221-1/+1
| | | | | | | | Currently, the "[ DISABLED ]" banner is printed for every test in a suite. When iterating on a single test gtest_filter this is very noisy. PiperOrigin-RevId: 436489088 Change-Id: If337087a7a0986b073fabf2b0a55d26485eb5c37
* Running clang-format over all of GoogleTestAbseil Team2022-03-151-453/+372
| | | | | | | | | | | | | | | | A few tests are examining code locations and looking af the resulting line numbers to verify that GoogleTest shows those to users correctly. Some of those locations change when clang-format is run. For those locations, I've wrapped portions in: // clang-format off ... // clang-format on There may be other locations that are currently not tickled by running clang-format. PiperOrigin-RevId: 434844712 Change-Id: I3a9f0a6f39eff741c576b6de389bef9b1d11139d
* Output source file path and line number in xml and json files.Szymon Sobik2022-03-081-5/+9
| | | | | It outputs the location of testcase only. Standalone EXPECT will have no location.
* Address conversion warning by explicitly casting to size_tAbseil Team2022-02-141-1/+3
| | | | | | | Closes #3762 PiperOrigin-RevId: 428593750 Change-Id: Ifac216568fbc7d999adb71996ec6a1bbe3b97412
* Merge pull request #3746 from ↵Copybara-Service2022-02-081-3/+21
|\ | | | | | | | | | | | | IYP-Programer-Yeah:use-constant-time-lookup-for-exact-match PiperOrigin-RevId: 427179775 Change-Id: I9928be2421d559acf0e0f03643ce0b856b63f737
| * Apply requested changes by using std::inserter with move.refs/pull/3746/headHossein Ghahramanzadeh2022-02-051-9/+11
| |
| * Do constant time matching for exact match filters.Hossein Ghahramanzadeh2022-01-311-3/+16
| |
* | GetCurrentOsStackTraceExceptTop (both the method of UnitTestImpl and the ↵Abseil Team2022-02-011-2/+2
|/ | | | | | | | | wrapper function in gtest.cc) rely on the fact that the inner call is not getting optimized. This CL annotates them with the appropriate attributes. PiperOrigin-RevId: 425663217 Change-Id: Ib9ec2a69a7dd98d37640b56d4d7798572da66669
* Make recreate_environments_when_repeating=false the default.Abseil Team2022-01-251-1/+1
| | | | | | | | | | | | | | | | | | | So that global test environments are by default set up and torn down once, regardless of the value of the repeat flag. The point of global environments is to be set up and torn down once, and shared by all tests in the process. There is no obvious reason why multiple runs of the same test should be treated distinctly from single runs of different tests. Having this be false by default means that repeats using a global environment run faster. It can still be set to true if it's desired that every repeat get a fresh environment, but this seems less important given the nature of a global environment. Every test I've seen using a global environment uses it to set up some expensive external resource, not something that can/should be set up for each test anew. (Again this is unsurprising, since the environment is a global.) PiperOrigin-RevId: 424003937 Change-Id: I9e8a825cb8900960dd65b85fe5ffcc0a337e57f3
* Merge pull request #3615 from IYP-Programer-Yeah:fix-per-test-filter-processingCopybara-Service2022-01-211-51/+94
|\ | | | | | | | | PiperOrigin-RevId: 423326942 Change-Id: I913f31960d7917b176c9f390424630708473837a
| * Fix a typo in comments.refs/pull/3615/headHossein Ghahramanzadeh2022-01-061-1/+1
| |
| * Use normal for loop instead of accumulate.Hossein Ghahramanzadeh2022-01-061-5/+5
| |
| * Improve code readablity.Hossein Ghahramanzadeh2022-01-061-2/+2
| |
| * Apply requested changes to preserve old behavior.Hossein Ghahramanzadeh2022-01-061-13/+20
| |
| * Reimplement MatchesFilter with new interfaces.Hossein Ghahramanzadeh2022-01-061-0/+5
| |
| * Apply requested changes.Hossein Ghahramanzadeh2022-01-061-38/+34
| |
| * Get rid of redundant filter matching codeHossein Ghahramanzadeh2022-01-061-48/+1
| |
| * Add comments describing the behavior of filtersHossein Ghahramanzadeh2022-01-061-1/+13
| |
| * Process filter string once instead of per testHossein Ghahramanzadeh2022-01-061-8/+73
| |
* | Factor out AssertionResult into dedicated gtest-assertion-result header + ↵Abseil Team2022-01-191-40/+4
| | | | | | | | | | | | | | implementation files to prevent cyclic includes between gtest.h and gtest_pred_impl.h PiperOrigin-RevId: 422863083 Change-Id: I299018a860152216adc206780c32923c03bedb2a
* | Merge pull request #3721 from joshiayush:i3719Copybara-Service2022-01-171-3/+4
|\ \ | |/ |/| | | | | PiperOrigin-RevId: 422405356 Change-Id: I8ea22485d9a25dce81a28d0c323a73b36d15e912
| * FIX #3719 -- Fix `clang` conversion warningsrefs/pull/3721/headAyush Joshi2022-01-011-3/+4
|/ | | | | | | | We should perform an explicit type conversion to `unsigned char` before passing the `const char` data to `IsValidXmlCharacter()` and `IsNormalizableWhitespace()` functions in order to avoid compile time conversion warnings Signed-off-by: Ayush Joshi <ayush854032@gmail.com>
* Allow to specify a random seed independently of whether shuffling is requestedrefs/pull/3694/headAyush Joshi2021-12-041-3/+1
| | | | | | This commit fixes issue #3681 Signed-off-by: Ayush Joshi <ayush854032@gmail.com>
* Googletest exportdmauro2021-11-101-3/+4
| | | | | | Explicitly used unsigned chars for testing for valid XML characters PiperOrigin-RevId: 408692969
* Merge pull request #3638 from limitedAtonement:3637-disabled-outputCJ Johnson2021-11-031-5/+16
|\ | | | | | | PiperOrigin-RevId: 407356792
| * Re #3637 Show Disabled Tests in testing outputrefs/pull/3638/headlmat2021-11-011-5/+17
|/ | | | | | | | | | | | | Showing disabled tests is implemented by a new member function on the TestEventListener interface (which is responsible for printing testing output). The new function is called OnTestSkipped and it is invoked when a disabled test is encountered. The PrettyUnitTestResultPrinter has the canonical implementation of this new function. The BriefUnitTestResultPrinter and the EmptyTestEventListener get a nullary implementation. The JsonUnitTestResultPrinter and XmlUnitTestResultPrinter inherit that trivial implementation from the EmptyTestEventListener.
* Googletest exportAbseil Team2021-09-231-1/+7
| | | | | | | | | | Do not attempt to continue running a test suite if it already failed during `SetUpTestSuite`. The suite already failed and running the tests might just add noise to the run, or even crash the process unnecessarily. Fixes #2187 PiperOrigin-RevId: 397770405
* Googletest exportAbseil Team2021-09-141-1/+1
| | | | | | Avoid segfault on null premature_exit_filepath. PiperOrigin-RevId: 395965853
* Format test properties in xml printerrefs/pull/3513/headvictordk132021-08-061-3/+3
|
* fix: typo codespelling commentrefs/pull/3499/headslowy072021-07-241-2/+2
|
* Googletest exportAbseil Team2021-07-221-1/+0
| | | | | | Delete GOOGLETEST_CM.* tags from C++ code. PiperOrigin-RevId: 386268534
* Googletest exportAbseil Team2021-07-071-119/+139
| | | | | | Introduce GTEST_FLAG_GET and GTEST_FLAG_SET macros. PiperOrigin-RevId: 382808313
* Googletest exportAbseil Team2021-07-071-9/+44
| | | | | | | | | | | | | | | | | | | gtest: Add a flag to only set up/tear down test environments once when repeating Currently when running a test multiple times using `--gtest_repeat` the global test environment(s) are set up and torn down for each iteration of the test. When checking for flakes in tests that have expensive dependencies that are set up in the test environment (subprocesses, external dependencies, etc) this can become expensive. To support finding flakes in tests that fit into this category, where the setup phase is expensive but each test case is fast, allow callers to specify via `--gtest_recreate_environments_when_repeating=false` that the test environments should only be set up once, for the first iteration, and only torn down once, on the last iteration. This makes running a test with `--gtest_repeat=1000` a much faster and more pleasant experience. PiperOrigin-RevId: 382748942
* Merge pull request #3364 from jbampton:fix-spellingAndy Soffer2021-04-211-1/+1
|\ | | | | | | PiperOrigin-RevId: 369217358
| * chore: fix spellingrefs/pull/3364/headJohn Bampton2021-04-151-1/+1
| |
* | Googletest exportdmauro2021-04-171-1/+1
|/ | | | | | | Use the time_point from steady_clock instead of the template This fixes the build on some embedded compilers PiperOrigin-RevId: 368879480
* Googletest exportAbseil Team2021-04-141-0/+4
| | | | | | | | | | | Add support to run gtest on Xtensa platform. This add support to run GTest base test suits on Xtensa (https://ip.cadence.com/ipportfolio/tensilica-ip) base simulator. Xtensa only provides libc and some basic operations and does not run an operating system by default. PiperOrigin-RevId: 368162205
* Googletest exportAbseil Team2021-03-161-0/+104
| | | | | | | | | | gtest: Output a canned test suite for environment failures in XML/JSON This surfaces useful information about the environment failure in a structured form. As we can see from the updated test, previously unsurfaced information is now present. PiperOrigin-RevId: 362292322
* Googletest exportAbseil Team2021-03-091-7/+26
| | | | | | | | | | | | Use monotonic time to measure test duration System time may be updated while a test is running. When this occurs a duration measured using system time may appear to move backwards, or jump far forwards. This change updates the duration measurement to use monotonic time instead. Timestamps for the test start still use system time. PiperOrigin-RevId: 361700881
* Googletest exportAbseil Team2021-03-091-0/+20
| | | | | | | | gtest.cc: Split out functions for printing `TestResult` objects This will make it possible to reuse this code for outputting the "ad_hoc" `TestResult` objects in structured form in XML/JSON. PiperOrigin-RevId: 361604860
* Googletest exportAbseil Team2021-02-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explicitly skip tests after fatal global environment setup errors Previously the tests were all skipped, but the resulting output claimed all tests passed. Before: ``` [----------] Global test environment set-up. <failure message> [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (83 ms total) [ PASSED ] 1 test. [ FAILED ] 0 tests, listed below: ``` After: ``` [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. <failure message> [----------] 1 test from SomeTest [ RUN ] SomeTest.DoesFoo <...>: Skipped [ SKIPPED ] SomeTest.DoesFoo (0 ms) [----------] 1 test from SomeTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (68 ms total) [ PASSED ] 0 tests. [ SKIPPED ] 1 test, listed below: [ SKIPPED ] SomeTest.DoesFoo [ FAILED ] 0 tests, listed below: ``` PiperOrigin-RevId: 358026389
* Googletest exportdmcardle2021-02-051-34/+69
| | | | | | | | | | Use linear-time string globbing in UnitTestOptions::MatchesFilter. Algorithm is based on https://research.swtch.com/glob. Closes #3227 PiperOrigin-RevId: 355222440
* Merge pull request #3204 from kuzkry:CmpHelperXX-overloads-removalCJ Johnson2021-01-261-51/+0
|\ | | | | | | PiperOrigin-RevId: 352626267