Skip to content

Commit

Permalink
deps: update googletest to b75ecf1
Browse files Browse the repository at this point in the history
PR-URL: nodejs#51657
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
nodejs-github-bot authored and sophoniie committed Jun 20, 2024
1 parent 76126d6 commit a0d925d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
3 changes: 2 additions & 1 deletion deps/googletest/include/gtest/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,8 @@ TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
// tests are successful, or 1 otherwise.
//
// RUN_ALL_TESTS() should be invoked after the command line has been
// parsed by InitGoogleTest().
// parsed by InitGoogleTest(). RUN_ALL_TESTS will tear down and delete any
// installed environments and should only be called once per binary.
//
// This function was formerly a macro; thus, it is in the global
// namespace and has an all-caps name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
//
// exit status: The integer exit information in the format specified
// by wait(2)
// exit code: The integer code passed to exit(3), _exit(2), or
// exit code: The integer code passed to exit(3), _Exit(2), or
// returned from main()
class GTEST_API_ DeathTest {
public:
Expand Down
14 changes: 8 additions & 6 deletions deps/googletest/src/gtest-death-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

#include "gtest/gtest-death-test.h"

#include <stdlib.h>

#include <functional>
#include <memory>
#include <sstream>
Expand Down Expand Up @@ -115,7 +117,7 @@ GTEST_DEFINE_string_(
GTEST_DEFINE_bool_(
death_test_use_fork,
testing::internal::BoolFromGTestEnv("death_test_use_fork", false),
"Instructs to use fork()/_exit() instead of clone() in death tests. "
"Instructs to use fork()/_Exit() instead of clone() in death tests. "
"Ignored and always uses fork() on POSIX systems where clone() is not "
"implemented. Useful when running under valgrind or similar tools if "
"those do not support clone(). Valgrind 3.3.1 will just fail if "
Expand Down Expand Up @@ -299,7 +301,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
fputc(kDeathTestInternalError, parent);
fprintf(parent, "%s", message.c_str());
fflush(parent);
_exit(1);
_Exit(1);
} else {
fprintf(stderr, "%s", message.c_str());
fflush(stderr);
Expand Down Expand Up @@ -511,7 +513,7 @@ std::string DeathTestImpl::GetErrorLogs() { return GetCapturedStderr(); }
// Signals that the death test code which should have exited, didn't.
// Should be called only in a death test child process.
// Writes a status byte to the child's status file descriptor, then
// calls _exit(1).
// calls _Exit(1).
void DeathTestImpl::Abort(AbortReason reason) {
// The parent process considers the death test to be a failure if
// it finds any data in our pipe. So, here we write a single flag byte
Expand All @@ -523,13 +525,13 @@ void DeathTestImpl::Abort(AbortReason reason) {
GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));
// We are leaking the descriptor here because on some platforms (i.e.,
// when built as Windows DLL), destructors of global objects will still
// run after calling _exit(). On such systems, write_fd_ will be
// run after calling _Exit(). On such systems, write_fd_ will be
// indirectly closed from the destructor of UnitTestImpl, causing double
// close if it is also closed here. On debug configurations, double close
// may assert. As there are no in-process buffers to flush here, we are
// relying on the OS to close the descriptor after the process terminates
// when the destructors are not run.
_exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
_Exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
}

// Returns an indented copy of stderr output for a death test.
Expand Down Expand Up @@ -1333,7 +1335,7 @@ static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
#endif // GTEST_HAS_CLONE

if (use_fork && (child_pid = fork()) == 0) {
_exit(ExecDeathTestChildMain(&args));
_Exit(ExecDeathTestChildMain(&args));
}
#endif // GTEST_OS_QNX
#ifdef GTEST_OS_LINUX
Expand Down
15 changes: 12 additions & 3 deletions deps/googletest/src/gtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ void InsertSyntheticTestCase(const std::string& name, CodeLocation location,
if (ignored.find(name) != ignored.end()) return;

const char kMissingInstantiation[] = //
" is defined via TEST_P, but never instantiated. None of the test cases "
" is defined via TEST_P, but never instantiated. None of the test "
"cases "
"will run. Either no INSTANTIATE_TEST_SUITE_P is provided or the only "
"ones provided expand to nothing."
"\n\n"
Expand Down Expand Up @@ -615,10 +616,12 @@ void TypeParameterizedTestSuiteRegistry::CheckForInstantiations() {
"\n\n"
"Ideally, TYPED_TEST_P definitions should only ever be included as "
"part of binaries that intend to use them. (As opposed to, for "
"example, being placed in a library that may be linked in to get other "
"example, being placed in a library that may be linked in to get "
"other "
"utilities.)"
"\n\n"
"To suppress this error for this test suite, insert the following line "
"To suppress this error for this test suite, insert the following "
"line "
"(in a non-header) in the namespace it is defined in:"
"\n\n"
"GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(" +
Expand Down Expand Up @@ -5991,6 +5994,12 @@ bool UnitTestImpl::RunAllTests() {
}

repeater->OnTestProgramEnd(*parent_);
// Destroy environments in normal code, not in static teardown.
bool delete_environment_on_teardown = true;
if (delete_environment_on_teardown) {
ForEach(environments_, internal::Delete<Environment>);
environments_.clear();
}

if (!gtest_is_initialized_before_run_all_tests) {
ColoredPrintf(
Expand Down

0 comments on commit a0d925d

Please sign in to comment.