4279 Commits

Author SHA1 Message Date
dmauro
cbf46d3f27 Googletest export
Guard #includes for threading related headers with GTEST_IS_THREADSAFE

Some platforms that don't support threading give errors for including
these headers

PiperOrigin-RevId: 406133623
2021-11-03 13:46:02 -04:00
dmauro
5a93ce1247 Googletest export
Remove the subprocess fallback code for older versions of Python

PiperOrigin-RevId: 405967578
2021-11-03 13:45:56 -04:00
Abseil Team
7cf37a18d1 Googletest export
Add docs section on test sharding

Fixes #3622

PiperOrigin-RevId: 405712812
2021-11-03 13:45:51 -04:00
Abseil Team
b3062166a1 Googletest export
Internal change

PiperOrigin-RevId: 405710296
2021-11-03 13:45:46 -04:00
dmauro
489ef888d9 Googletest export
Remove GoogleTest's SleepMilliseconds function.
It is only used in tests and a portable implementation is available.

PiperOrigin-RevId: 405437102
2021-11-03 13:45:40 -04:00
dmauro
f503588aee Googletest export
Replace the multiple implementations of Notification with a single
portable implementation.

The also removes the awkward loop with sleep in Notification and will
allow the removal of SleepMilliseconds.

PiperOrigin-RevId: 405399733
2021-11-03 13:45:35 -04:00
lmat
3c958ac47c Re #3637 Show Disabled Tests in testing output
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.
2021-11-01 16:17:25 -04:00
Henner Zeller
24898650b1 Start a simple github actions CI
Running on major platforms.

Signed-off-by: Henner Zeller <h.zeller@acm.org>
2021-10-20 15:26:11 -07:00
Deniz Bahadir
64f19a9fc3 CMake: Fix values of INTERFACE_INCLUDE_DIRECTORIES property
Replace semicolon by `$<SEMICOLON>` in generator-expressions of target
property `INTERFACE_INCLUDE_DIRECTORIES` of CMake targets `gtest`,
`gtest_main`, `gmock` and `gmock_main`.

Fixes: #3616

Signed-off-by: Deniz Bahadir <deniz@code.bahadir.email>
2021-10-19 15:14:44 +02:00
Abseil Team
16f637fbf4 Googletest export
Add printer for __{u,}int128_t.

PiperOrigin-RevId: 402417369
2021-10-13 12:28:20 -04:00
Abseil Team
178cfacb24 Googletest export
add missing using ::testing::DoAll when DoAll used in example

PiperOrigin-RevId: 402416497
2021-10-13 12:28:13 -04:00
Andy Soffer
dc7a0779d1 Merge pull request #3602 from yesudeep:try-fix-linker-errors-on-freebsd
PiperOrigin-RevId: 402414489
2021-10-13 12:28:06 -04:00
Abseil Team
b2dda9ed83 Googletest export
Use newer Docker images in CI

The new floor image contains GCC 5.5.0, like the old one.

PiperOrigin-RevId: 402402465
2021-10-13 12:28:00 -04:00
Yesudeep Mangalapilly
9e3fb4ea94 Fix linker errors on FreeBSD. 2021-10-08 08:55:39 -07:00
dinord
075810f7a2 Merge pull request #3581 from cclauss:codespell
PiperOrigin-RevId: 400792845
2021-10-05 10:59:42 -04:00
Abseil Team
3b49be074d Googletest export
googletest: Add printer for {std,absl}::nullopt.
PiperOrigin-RevId: 399928554
2021-09-30 19:07:32 -04:00
Abseil Team
ab36804e42 Googletest export
Ensure `.what()` is printed in `ThrowsMessage(...)` to address https://github.com/google/googletest/issues/3582

Closes #3582

PiperOrigin-RevId: 399462851
2021-09-28 16:33:40 -04:00
Christian Clauss
ee1be03b43 Fix remaining typos discovered by codespell 2021-09-24 08:09:32 +02:00
dinord
e4717df71a Merge pull request #3195 from Inujel:fix-3194
PiperOrigin-RevId: 398271948
2021-09-23 23:31:42 +00:00
dinord
09074c1571 Merge pull request #3573 from cclauss:patch-1
PiperOrigin-RevId: 397998384
2021-09-23 23:31:33 +00:00
dinord
319a9d19bc Merge pull request #3574 from Vertexwahn:switch_to_native_cc_rules
PiperOrigin-RevId: 397995447
2021-09-23 23:31:25 +00:00
Abseil Team
0570d97fb6 Googletest export
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
2021-09-23 23:31:14 +00:00
Abseil Team
de34ef4e4c Internal change
PiperOrigin-RevId: 397651677
2021-09-23 23:31:03 +00:00
Vertexwahn
277e0a0168 Remove bazelbuild/rules_cc dependency 2021-09-17 10:04:26 +02:00
Christian Clauss
5b43f14be9
Fix typos discovered by codespell 2021-09-16 21:44:29 +02:00
Christian Clauss
861a75ed5d
Fix typos discovered by codespell 2021-09-16 21:00:42 +02:00
Christian Clauss
a070f33c19
Fix typo discovered by codespell
https://pypi.org/project/codespell/
2021-09-16 20:40:35 +02:00
Derek Mauro
40dfd4b775 Merge pull request #3519 from AkashKumarSingh11032001:master
PiperOrigin-RevId: 397082478
2021-09-16 13:00:21 -04:00
Abseil Team
6bfab0becc Googletest export
Add a caveat section for potential memory leak with derived classes using `SetUpTestSuite`.

PiperOrigin-RevId: 396986728
2021-09-16 13:00:01 -04:00
dmauro
8aa657ee39 Googletest export
Delete unsupported/deprecated scripts

PiperOrigin-RevId: 396847020
2021-09-15 13:34:06 -04:00
Abseil Team
314adcd40e Googletest export
gmock-internal-utils.cc: Use `static_cast` instead of implicit conversion between signed and unsigned types
Fixes #3550

PiperOrigin-RevId: 396826071
2021-09-15 13:34:00 -04:00
dmauro
4ea61b9669 Googletest export
Rollback delete of unsupported/deprecated scripts

PiperOrigin-RevId: 396699187
2021-09-15 13:33:54 -04:00
dmauro
7ee2683007 Googletest export
Delete unsupported/deprecated scripts

PiperOrigin-RevId: 396685976
2021-09-15 13:33:48 -04:00
Abseil Team
6202251f09 Googletest export
Introduce GMOCK_FLAG_GET and GMOCK_FLAG_SET macros.

PiperOrigin-RevId: 396649214
2021-09-15 13:33:42 -04:00
Derek Mauro
061973710e
Revert grammatically incorrect change 2021-09-15 12:54:09 -04:00
Abseil Team
159c9ad23e Googletest export
Avoid segfault on null premature_exit_filepath.

PiperOrigin-RevId: 395965853
2021-09-14 10:15:17 -04:00
CJ Johnson
955c7f837e Merge pull request #3531 from theidexisted:patch-1
PiperOrigin-RevId: 392720416
2021-08-26 14:30:09 -04:00
CJ Johnson
ff21b36e1e Merge pull request #3513 from victordk13:patch-1
PiperOrigin-RevId: 392665206
2021-08-24 12:29:05 -04:00
Abseil Team
6204633979 Googletest export
Bump `cmake_minimum_required` to 3.5.

Delete conditional branches exclusive to older versions.

Notable dependents:
  - github.com/grpc/grpc >= 3.5.1
  - github.com/abseil/abseil-cpp >= 3.5
  - github.com/googleapis/google-cloud-cpp >= 3.5

On the other hand, github.com/protocolbuffers/protobuf is >= 3.1.3, but it only depends on GoogleTest 1.10.

Fixes #3523

PiperOrigin-RevId: 392073834
2021-08-24 12:28:58 -04:00
Abseil Team
2f80c2ba71 Googletest export
Standardize access to GoogleTest flags on GTEST_FLAG_GET/GTEST_FLAG_SET

Custom implementations can decide how access to flags is performed depending on the implementation of flags being used.

PiperOrigin-RevId: 391971115
2021-08-20 15:08:40 -04:00
theidexisted
088e6ed9a8
Simplify example code with c++11 2021-08-19 16:35:14 +08:00
Derek Mauro
0134d73a49 Merge pull request #3504 from duianto:patch-1
PiperOrigin-RevId: 390486428
2021-08-13 12:42:35 -04:00
Derek Mauro
8d8b488a8d Merge pull request #3511 from berkeyvx:typo
PiperOrigin-RevId: 390467627
2021-08-13 12:42:28 -04:00
Abseil Team
21514e0be7 Googletest export
Identify bad specs of the type (const something, ...).

PiperOrigin-RevId: 390346843
2021-08-13 12:42:17 -04:00
dmauro
47f819c3ca Googletest export
Remove deprecated/unsupported scripts

PiperOrigin-RevId: 389873391
2021-08-10 12:30:54 -04:00
dmauro
eb7e38dfb4 Googletest export
Fix a Python 2 to 3 issue

PiperOrigin-RevId: 389720056
2021-08-10 12:30:49 -04:00
Akash Kumar Singh
046c4d018e
Merge pull request #2 from AkashKumarSingh11032001/AkashKumarSingh11032001-patch-2
add a missing 'a'
2021-08-10 16:55:05 +05:30
Akash Kumar Singh
0e66bbd5b0
add a missing 'a'
added a missing 'a' in line 72.
2021-08-10 16:53:20 +05:30
Akash Kumar Singh
b36e55d357
Create CONTRIBUTING.md
In line number 39 I added an anchor tag in "see detail above", it will redirect user to to particular section i.e. Contributor License Agreements section.
2021-08-10 16:37:12 +05:30
Abseil Team
aefb45469e Internal change
PiperOrigin-RevId: 389163232
2021-08-06 15:28:29 -04:00
victordk13
26f9d55719
Format test properties in xml printer 2021-08-06 16:19:01 +03:00
Berke
f91723cb90 typo fix gmock_cook_book 2021-08-05 12:09:54 +03:00
Abseil Team
5b40153003 Googletest export
Format documentation

PiperOrigin-RevId: 388592443
2021-08-04 13:54:45 -04:00
Abseil Team
652ec31f9f Googletest export
Introduce a new matcher for unescaping Base-64 strings to gmock.

PiperOrigin-RevId: 388471904
2021-08-04 13:54:39 -04:00
Abseil Team
c22ce88775 Googletest export
Standardize access to GoogleTest flags on GTEST_FLAG_GET/GTEST_FLAG_SET

Custom implementations can decide how access to flags is performed depending on the implementation of flags being used.

PiperOrigin-RevId: 388181424
2021-08-04 13:54:33 -04:00
Abseil Team
29d2540622 Googletest export
Proliferation of inclusive language.

PiperOrigin-RevId: 387535677
2021-08-04 13:54:27 -04:00
duianto
97ff0fec11
Typo, double "the" 2021-07-29 20:32:48 +02:00
Abseil Team
2d924d7a97 Internal change
PiperOrigin-RevId: 387381497
2021-07-29 03:27:05 +00:00
dinord
df43ce9675 Merge pull request #3499 from slowy07:fixing
PiperOrigin-RevId: 386888057
2021-07-29 03:26:54 +00:00
slowy07
2f3e2e39cc fix: typo codespelling comment 2021-07-24 17:38:47 +07:00
Abseil Team
96f4ce02a3 Googletest export
Delete GOOGLETEST_CM.* tags from C++ code.

PiperOrigin-RevId: 386268534
2021-07-22 14:54:03 -04:00
Abseil Team
ce4895aae8 Googletest export
Fix include guards in gen_pred_test.py

PiperOrigin-RevId: 386052814
2021-07-22 14:53:50 -04:00
CJ Johnson
8d6a4f8afe Merge pull request #3472 from jwnimmer-tri:fix-dont-macros
PiperOrigin-RevId: 385627491
2021-07-22 14:53:42 -04:00
dmauro
56e4b1a515 Googletest export
Run buildifier on WORKSPACE
Fixes #3483

PiperOrigin-RevId: 385610473
2021-07-22 14:53:34 -04:00
CJ Johnson
efc6b36cb3 Merge pull request #3484 from mbinna:bazel_qnx_regex
PiperOrigin-RevId: 384913062
2021-07-22 14:53:26 -04:00
Derek Mauro
a42111b49b
Fix location of GOOGLETEST_CM0011 marker 2021-07-14 16:02:00 -04:00
Abseil Team
8d51ffdfab Googletest export
Remove unneeded using ::std::get;

PiperOrigin-RevId: 383688097
2021-07-09 09:28:13 -04:00
Abseil Team
43cf52911a Googletest export
Suppress a clang-tidy warning in the MATCHER(name, description) macro.

PiperOrigin-RevId: 383587271
2021-07-09 09:28:04 -04:00
Abseil Team
8306020a3e Googletest export
Add `Conditional` wrapper to gtest

This follows an initial proposal for an 'EqIff` matcher. `Conditional` was considered more precise as an EqIff() matcher may suffer from `Iff` not being universally understood.

PiperOrigin-RevId: 383407665
2021-07-07 14:34:28 -04:00
Abseil Team
977cffc442 Googletest export
Introduce GTEST_FLAG_GET and GTEST_FLAG_SET macros.

PiperOrigin-RevId: 382808313
2021-07-07 14:34:19 -04:00
Abseil Team
4cfd14984f Googletest export
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
2021-07-07 14:34:08 -04:00
Manuel Binna
f0ff512b75 Link -lregex on QNX
According to the 2nd point on [1], -lregex is required on QNX.

[1] https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.ide.userguide/topic/writing_test_programs.html
2021-07-07 19:14:58 +02:00
Jeremy Nimmer
155de14cd8 Use GTEST_DONT_DEFINE_TEST_F to guard TEST_F
The documentation is clear that the FOO we'll be guarding always matches
the spelling of the DONT macro.  A single guard macro should not toggle
more than one implementation macro.

This fixes a regression in 7413280c52c1f759395572a384165023d24eeb57.

Relatedly, improve the documentation of the DONT macros to bring the
list of valid FOO values up to date.
2021-07-01 11:48:36 -07:00
Abseil Team
4ec4cd23f4 Googletest export
Implement 'Contains(e).Times(n)' matcher modifier which allows to test for arbitrary occurrences including absence with Times(0).

PiperOrigin-RevId: 382210276
2021-06-30 13:33:57 -04:00
Andy Soffer
5f97ce4c70 Merge pull request #3465 from mbinna:bazel_qnx
PiperOrigin-RevId: 382189077
2021-06-30 13:33:48 -04:00
Andy Soffer
b89480e02c Merge pull request #3457 from alexkaratarakis:wcovered_switch_default
PiperOrigin-RevId: 382188112
2021-06-30 13:33:38 -04:00
Abseil Team
22e6055c75 Googletest export
Make multiple attempts to verify GetThreadCount()

Testing GetThreadCount() is inheritently noisy, as other threads can be started
or destroyed between two calls to GetThreadCount(). This is especially true
under certain analyzer configurations, such as TSAN.

PiperOrigin-RevId: 381951799
2021-06-30 13:33:29 -04:00
Abseil Team
255323cf09 Googletest export
Deleting deprecated file.

PiperOrigin-RevId: 381938709
2021-06-30 13:33:20 -04:00
Manuel Binna
4281d2149c Don't link pthread on QNX
On QNX, pthread is part of libc [1]. There's no separate pthread library
to link.

[1] https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/p/pthread_create.html
2021-06-26 13:26:20 +02:00
Alex Karatarakis
1008850435 Fix EXPECT_DEATH() and ASSERT_DEATH() triggering -Wcovered-switch-default
EXPECT_DEATH() and ASSERT_DEATH() have a switch case where every
possible case is covered. This makes the default case unnecessary
and triggers -Wcovered-switch-default.
Due to these being macros, the lines are expanded in user code and
are thus subject to warnings of the target codebase.

Fixes #3456
2021-06-23 14:57:22 -07:00
dinord
355d57d90d Merge pull request #3443 from hyukmyeong:typo
PiperOrigin-RevId: 380705469
2021-06-22 13:30:42 +00:00
dmauro
f7902802f1 Googletest export
Remove -Werror from the CMake compiler flags

We should not force warnings as errors on users.
Sometimes compilers introduce new warnings which
will break builds.

Instead, we manually turn this flag on in our continuous integration
scripts so we can catch these errors, but not force them on our users.

Fixes #3447

PiperOrigin-RevId: 380241852
2021-06-22 13:30:21 +00:00
CJ Johnson
7153098229 Merge pull request #3429 from 1KoT1:master
PiperOrigin-RevId: 379625931
2021-06-17 12:52:27 -04:00
CJ Johnson
22a2e019c4 Merge pull request #3200 from ellert:port-to-GNU/Hurd
PiperOrigin-RevId: 379383941
2021-06-17 12:52:18 -04:00
CJ Johnson
996328bb8e Merge pull request #3183 from georgthegreat:patch-1
PiperOrigin-RevId: 378915968
2021-06-17 12:52:09 -04:00
Vasilii Pochkaenko
5ef9f63a72 feat: make a matcher ElementsAreArray applicable for std ranges 2021-06-15 16:42:40 +07:00
Hyuk Myeong
1745a405eb fix typos 2021-06-13 19:53:04 +09:00
Abseil Team
e2239ee604 Googletest export
Release GoogleTest 1.11.0

PiperOrigin-RevId: 378861756
release-1.11.0
2021-06-11 10:42:26 -07:00
Abseil Team
b050d6c4b0 Googletest export
Internal change

PiperOrigin-RevId: 378672633
2021-06-11 10:42:17 -07:00
Abseil Team
3c4b3a039e Googletest export
Add feature request issue template

PiperOrigin-RevId: 378552571
2021-06-11 10:42:07 -07:00
dmauro
9f7da89a43 Googletest export
Delete Travis config file

PiperOrigin-RevId: 378483262
2021-06-11 10:41:58 -07:00
Abseil Team
c5be3930f5 Googletest export
cleanup: fix spurious MSAN warnings with Clang 12
PiperOrigin-RevId: 378430614
2021-06-11 10:41:50 -07:00
Abseil Team
aa533abfd4 Googletest export
Add CNAME file for custom domain

PiperOrigin-RevId: 378384525
2021-06-09 08:45:19 -04:00
Abseil Team
94bb786f0e Googletest export
Update broken link

PiperOrigin-RevId: 378272186
2021-06-09 08:45:11 -04:00
Abseil Team
5bcd8e3bb9 Googletest export
Add CNAME file for custom domain

PiperOrigin-RevId: 377604116
2021-06-08 18:36:38 -04:00
Derek Mauro
91e1bd6bfb Merge pull request #3421 from florin-crisan:bugfix/3420-dll-link-failure
PiperOrigin-RevId: 377367006
2021-06-08 18:36:29 -04:00
dmauro
9d698f6905 Googletest export
Fix MSVC warning C4275: non dll-interface class
'testing::MatcherDescriberInterface' used as base for dll-interface
class 'testing::internal::MatcherBase<std::string>'

Fixes #3415

PiperOrigin-RevId: 377352684
2021-06-08 18:36:20 -04:00
Derek Mauro
4feb6c77de Merge pull request #3393 from JC3:patch-1
PiperOrigin-RevId: 377289133
2021-06-08 18:36:11 -04:00
Florin Crișan
26a1569c72 #3420 Declare MarkAsIgnored as a DLL export
This was causing the following linker error on Microsoft Visual C++ when compiling as a DLL:

```
googletest-param-test-test.cc.obj : error LNK2019: unresolved external symbol "public: __cdecl testing::internal::MarkAsIgnored::MarkAsIgnored(char const *)" (??0MarkAsIgnored@internal@testing@@QEAA@PEBD@Z) referenced in function "void __cdecl works_here::`dynamic initializer for 'gtest_allow_ignore_NotInstantiatedTest''(void)" (??__Egtest_allow_ignore_NotInstantiatedTest@works_here@@YAXXZ)
```
2021-06-03 09:12:53 +03:00
Florin Crișan
e1cc005f4c #3420 Properly declare all overloads of testing::internal::PrintTo as DLL exports
This was causing the following linker error on Microsoft Visual C++ when compiling as a DLL:

```
googletest-printers-test.cc.obj : error LNK2019: unresolved external symbol "void __cdecl testing::internal::PrintTo(char16_t const *,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?PrintTo@internal@testing@@YAXPEB_SPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: static void __cdecl testing::internal::UniversalPrinter<char16_t const *>::Print(char16_t const * const &,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?Print@?$UniversalPrinter@PEB_S@internal@testing@@SAXAEBQEB_SPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z)
googletest-printers-test.cc.obj : error LNK2019: unresolved external symbol "void __cdecl testing::internal::PrintTo(char32_t const *,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?PrintTo@internal@testing@@YAXPEB_UPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: static void __cdecl testing::internal::UniversalPrinter<char32_t const *>::Print(char32_t const * const &,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?Print@?$UniversalPrinter@PEB_U@internal@testing@@SAXAEBQEB_UPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z)
```
2021-06-03 09:12:53 +03:00