The `Mutex` is locked with the `MutexLock` before spawning the thread, so that the thread is prevented from completing (by being blocked on `Mutex`) before the new thread count is obtained. However, the existing bug (introduced in 22e6055) releases `Mutex` before obtaining the new thread count, which allows the thread to run to completion in the meantime.
Also, since the `(thread_count_after_create != starting_count + 1)` condition (line 328) skips the remainder of the `for`-loop body on every iteration, `thread_count_after_join` stays uninitialized.
I believe this is why [this test failed][1] on the macOS CI with this trace:
```
[----------] 1 test from GetThreadCountTest
[ RUN ] GetThreadCountTest.ReturnsCorrectValue
googletest/test/googletest-port-test.cc:350: Failure
Expected equality of these values:
thread_count_after_create
Which is: 1
starting_count + 1
Which is: 2
googletest/test/googletest-port-test.cc:351: Failure
Expected equality of these values:
thread_count_after_join
Which is: 140493185949400
starting_count
Which is: 1
[ FAILED ] GetThreadCountTest.ReturnsCorrectValue (2 ms)
[----------] 1 test from GetThreadCountTest (2 ms total)
```
[1]: https://github.com/google/googletest/actions/runs/6064919420/job/16453860690?pr=3049
The following are the major updates
* LLVM 17 branch (https://github.com/llvm/llvm-project b744f4c99cf91155c74a3c92db6f1335232ff3d)
* GCC 13.2
* CMake 3.27.1
* Bazel 6.2.1
PiperOrigin-RevId: 558818264
Change-Id: Ib08d8331e2a8b2d68a702670451beaaac5d266f4
`TestNonHelpFlag` is only a few asserts with no logic, which is easier to read in line, and helper `TestHelpFlag` is used in a single test case.
PiperOrigin-RevId: 557122793
Change-Id: I7367424abfbb883c10c260fae066a2071e5dfa0e
The last regular expression specified in the test is not technically
POSIX compatible. Use `[[:alnum:]_]` instead of `\w+`; the latter is a
Perl-compatible regular expression.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
The test supported a variety of BSDs, including kFreeBSD, but not FreeBSD.
Move the BSD checks to a separate function and support checking for
FreeBSD, in addition to kFreeBSD.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This commit removes `<iomanip>` from public GoogleTest header files.
As `<iomanip>` is not a common included file, its content is unlikely
to be included in translation units other than through GoogleTest
includes.
By reducing the number of include directives public headers in
GoogleTest, this may reduce the time taken to compile tests as it would
reduce the amount of work that the preprocessor and compiler front-end
need to do.
This allows types that provide an AbslStringify definition to be streamed into GoogleTest macros.
PiperOrigin-RevId: 552914482
Change-Id: I5fb386980d4d24873f95f0a8ef83067a6a3c86ac
This was shown to work for C++14, C++17, and C++20 after patched into googletest for the protobuf repo's CI.
Closes#3659
PiperOrigin-RevId: 544795507
Change-Id: I3e0a94f675e78a6ee9aeccae86c23d940efed8eb
This ensure the erroring stack frame is visible and accessible when the handler is invoked.
Fixes#4298
PiperOrigin-RevId: 544692549
Change-Id: Ia165a8c293e8edc820da5f5ad4416546fffe2493
Also tidies up a couple of things:
- Prevent handling of stack overflows, which cannot be done safely
- `exception_code` is a macro, so we rename it
- The `std::string` heap allocation was unnecessary
Fixes#4298
PiperOrigin-RevId: 544117790
Change-Id: I8ba61f87119d5fbdb1f653700d9867ca6f8c28ce
From the CMake 3.27 release notes:
Compatibility with versions of CMake older than 3.5 is now
deprecated and will be removed from a future version. Calls to
cmake_minimum_required() or cmake_policy() that set the policy
version to an older value now issue a deprecation diagnostic.
This PR also removes manually setting policy CMP0048. This is
redundant since the CMake min is already 3.X
This is useful for running individual tests in a separate process, which is
useful for testing e.g. flag changes which have a process-global effect.
PiperOrigin-RevId: 540580573
Change-Id: I18a5d24d79425a9d595be3369efc44e2f655f6f8
This is populated by the clangd language service provider.
Also ignore the cmake-variants.yaml file.
This can be created locally to select various build/test configurations.
Fixes#4266
Note that RE2 has taken a dependency on Abseil, so the `main` branch
should be used from now on. The `abseil` branch will go away soon...
PiperOrigin-RevId: 536737543
Change-Id: I0e595ee8e754b924881f997f286cdec3822763bf
Use /fp:precise to override IntelLLVM's default of /fp:fast.
This makes IsInf and IsNan work as expected by googletest.
```
[build]...\googletest\googlemock\test\gmock-function-mocker_test.cc(143,21): error: 'VoidReturning' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
[build] MOCK_METHOD(void, VoidReturning, (int n)); // NOLINT
```
```
[build] ...\googletest\googlemock\test\gmock-function-mocker_test.cc(182,20): error: exception specification of overriding function is more lax than base version [-Werror,-Wmicrosoft-exception-spec]
[build] MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE)));
```
```
[build] ...\googletest\googletest\test\googletest-death-test-test.cc(209,5): error: unused function 'DieInCRTDebugElse12' [-Werror,-Wunused-function]
[build] int DieInCRTDebugElse12(int* sideeffect) {
[build] ^
```
```
[build] ...\googletest\googletest\test\gtest_unittest.cc(4096,7): error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
[build] int n = 0;
```
Use the same flags as Clang if the compiler id is IntelLLVM.
IntelLLVM warns if a double constant is assigned to a float.
```
[build] .../googletest/googletest/include/gtest/gtest-printers.h:516:17: warning: implicit conversion between floating point types of different sizes [-Wimplicit-float-size-conversion]
[build] mulfor6 = 1e1;
```
IntelLLVM uses fp-model=fast by default, breaking IsNan and IsInf tests.
Use -ffp-model=precise to fix this.
IntelLLVM does not support -Wchar-subscripts
Fixes#4255