Returns a Boolean value indicating whether the caller is currently executing in the context of the death test child process. Tools such as Valgrind heap checkers may need this to modify their behavior in death tests. IMPORTANT: This is an internal utility. Using it may break the implementation of death tests. User code MUST NOT use it.
| 7056 | // tests. IMPORTANT: This is an internal utility. Using it may break the |
| 7057 | // implementation of death tests. User code MUST NOT use it. |
| 7058 | bool InDeathTestChild() { |
| 7059 | # if GTEST_OS_WINDOWS |
| 7060 | |
| 7061 | // On Windows, death tests are thread-safe regardless of the value of the |
| 7062 | // death_test_style flag. |
| 7063 | return !GTEST_FLAG(internal_run_death_test).empty(); |
| 7064 | |
| 7065 | # else |
| 7066 | |
| 7067 | if (GTEST_FLAG(death_test_style) == "threadsafe") |
| 7068 | return !GTEST_FLAG(internal_run_death_test).empty(); |
| 7069 | else |
| 7070 | return g_in_fast_death_test_child; |
| 7071 | #endif |
| 7072 | } |
| 7073 | |
| 7074 | } // namespace internal |
| 7075 |