Skip to content

Commit

Permalink
deps: update googletest to cc36671
Browse files Browse the repository at this point in the history
PR-URL: nodejs#48789
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
nodejs-github-bot authored and Ceres6 committed Aug 14, 2023
1 parent e4f28eb commit 2758b4d
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 64 deletions.
12 changes: 6 additions & 6 deletions deps/googletest/include/gtest/gtest-printers.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ struct FindFirstPrinter<
// - Print containers (they have begin/end/etc).
// - Print function pointers.
// - Print object pointers.
// - Use the stream operator, if available.
// - Print protocol buffers.
// - Use the stream operator, if available.
// - Print types convertible to BiggestInt.
// - Print types convertible to StringView, if available.
// - Fallback to printing the raw bytes of the object.
Expand Down Expand Up @@ -475,7 +475,7 @@ GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os);
inline void PrintTo(char16_t c, ::std::ostream* os) {
PrintTo(ImplicitCast_<char32_t>(c), os);
}
#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
inline void PrintTo(char8_t c, ::std::ostream* os) {
PrintTo(ImplicitCast_<char32_t>(c), os);
}
Expand Down Expand Up @@ -531,7 +531,7 @@ int AppropriateResolution(FloatType val) {
} else if (val >= 0.0001) {
mulfor6 = 1e9;
}
if (static_cast<float>(static_cast<int32_t>(val * mulfor6 + 0.5)) /
if (static_cast<FloatType>(static_cast<int32_t>(val * mulfor6 + 0.5)) /
mulfor6 ==
val)
return 6;
Expand All @@ -546,7 +546,7 @@ int AppropriateResolution(FloatType val) {
} else if (val >= 1e6) { // 1,000,000 to 9,999,999
divfor6 = 10;
}
if (static_cast<float>(static_cast<int32_t>(val / divfor6 + 0.5)) *
if (static_cast<FloatType>(static_cast<int32_t>(val / divfor6 + 0.5)) *
divfor6 ==
val)
return 6;
Expand Down Expand Up @@ -588,7 +588,7 @@ inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
inline void PrintTo(unsigned char* s, ::std::ostream* os) {
PrintTo(ImplicitCast_<const void*>(s), os);
}
#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
// Overloads for u8 strings.
GTEST_API_ void PrintTo(const char8_t* s, ::std::ostream* os);
inline void PrintTo(char8_t* s, ::std::ostream* os) {
Expand Down Expand Up @@ -908,7 +908,7 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
GTEST_API_ void UniversalPrintArray(const char* begin, size_t len,
::std::ostream* os);

#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
// This overload prints a (const) char8_t array compactly.
GTEST_API_ void UniversalPrintArray(const char8_t* begin, size_t len,
::std::ostream* os);
Expand Down
2 changes: 2 additions & 0 deletions deps/googletest/include/gtest/internal/gtest-port-arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
#define GTEST_OS_XTENSA 1
#elif defined(__hexagon__)
#define GTEST_OS_QURT 1
#elif defined(CPU_QN9090) || defined(CPU_QN9090HN)
#define GTEST_OS_NXP_QN9090 1
#endif // __CYGWIN__

#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
11 changes: 7 additions & 4 deletions deps/googletest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#if (!(defined(GTEST_OS_LINUX_ANDROID) || defined(GTEST_OS_CYGWIN) || \
defined(GTEST_OS_SOLARIS) || defined(GTEST_OS_HAIKU) || \
defined(GTEST_OS_ESP32) || defined(GTEST_OS_ESP8266) || \
defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT)))
defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
defined(GTEST_OS_NXP_QN9090)))
#define GTEST_HAS_STD_WSTRING 1
#else
#define GTEST_HAS_STD_WSTRING 0
Expand Down Expand Up @@ -924,9 +925,11 @@ using std::tuple_size;
namespace internal {

// A secret type that Google Test users don't know about. It has no
// definition on purpose. Therefore it's impossible to create a
// accessible constructors on purpose. Therefore it's impossible to create a
// Secret object, which is what we want.
class Secret;
class Secret {
Secret(const Secret&) = delete;
};

// A helper for suppressing warnings on constant condition. It just
// returns 'condition'.
Expand Down Expand Up @@ -1995,7 +1998,7 @@ inline bool IsUpper(char ch) {
inline bool IsXDigit(char ch) {
return isxdigit(static_cast<unsigned char>(ch)) != 0;
}
#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
inline bool IsXDigit(char8_t ch) {
return isxdigit(static_cast<unsigned char>(ch)) != 0;
}
Expand Down
4 changes: 2 additions & 2 deletions deps/googletest/src/gtest-filepath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ FilePath FilePath::GetCurrentDir() {
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_ESP8266) || \
defined(GTEST_OS_ESP32) || defined(GTEST_OS_XTENSA) || \
defined(GTEST_OS_QURT)
defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090)
// These platforms do not have a current directory, so we just return
// something reasonable.
return FilePath(kCurrentDirectoryString);
Expand Down Expand Up @@ -356,7 +356,7 @@ bool FilePath::CreateFolder() const {
#elif defined(GTEST_OS_WINDOWS)
int result = _mkdir(pathname_.c_str());
#elif defined(GTEST_OS_ESP8266) || defined(GTEST_OS_XTENSA) || \
defined(GTEST_OS_QURT)
defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090)
// do nothing
int result = 0;
#else
Expand Down
6 changes: 3 additions & 3 deletions deps/googletest/src/gtest-internal-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ class GTEST_API_ UnitTestOptions {
#ifdef GTEST_OS_WINDOWS
// Function for supporting the gtest_catch_exception flag.

// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
// Returns EXCEPTION_EXECUTE_HANDLER if given SEH exception was handled, or
// EXCEPTION_CONTINUE_SEARCH otherwise.
// This function is useful as an __except condition.
static int GTestShouldProcessSEH(DWORD exception_code);
static int GTestProcessSEH(DWORD seh_code, const char* location);
#endif // GTEST_OS_WINDOWS

// Returns true if "name" matches the ':' separated list of glob-style
Expand Down
8 changes: 4 additions & 4 deletions deps/googletest/src/gtest-printers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static const char* GetCharWidthPrefix(signed char) { return ""; }

static const char* GetCharWidthPrefix(unsigned char) { return ""; }

#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
static const char* GetCharWidthPrefix(char8_t) { return "u8"; }
#endif

Expand All @@ -232,7 +232,7 @@ static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
return PrintAsStringLiteralTo(ToChar32(c), os);
}

#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
static CharFormat PrintAsStringLiteralTo(char8_t c, ostream* os) {
return PrintAsStringLiteralTo(ToChar32(c), os);
}
Expand Down Expand Up @@ -395,7 +395,7 @@ void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
UniversalPrintCharArray(begin, len, os);
}

#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
// Prints a (const) char8_t array of 'len' elements, starting at address
// 'begin'.
void UniversalPrintArray(const char8_t* begin, size_t len, ostream* os) {
Expand Down Expand Up @@ -438,7 +438,7 @@ void PrintCStringTo(const Char* s, ostream* os) {

void PrintTo(const char* s, ostream* os) { PrintCStringTo(s, os); }

#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
void PrintTo(const char8_t* s, ostream* os) { PrintCStringTo(s, os); }
#endif

Expand Down
70 changes: 28 additions & 42 deletions deps/googletest/src/gtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -863,30 +863,39 @@ bool UnitTestOptions::FilterMatchesTest(const std::string& test_suite_name,
}

#if GTEST_HAS_SEH
// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
// This function is useful as an __except condition.
int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {
static std::string FormatSehExceptionMessage(DWORD exception_code,
const char* location) {
Message message;
message << "SEH exception with code 0x" << std::setbase(16) << exception_code
<< std::setbase(10) << " thrown in " << location << ".";
return message.GetString();
}

int UnitTestOptions::GTestProcessSEH(DWORD seh_code, const char* location) {
// Google Test should handle a SEH exception if:
// 1. the user wants it to, AND
// 2. this is not a breakpoint exception, AND
// 2. this is not a breakpoint exception or stack overflow, AND
// 3. this is not a C++ exception (VC++ implements them via SEH,
// apparently).
//
// SEH exception code for C++ exceptions.
// (see http://support.microsoft.com/kb/185294 for more information).
const DWORD kCxxExceptionCode = 0xe06d7363;

bool should_handle = true;
if (!GTEST_FLAG_GET(catch_exceptions) || seh_code == kCxxExceptionCode ||
seh_code == EXCEPTION_BREAKPOINT ||
seh_code == EXCEPTION_STACK_OVERFLOW) {
return EXCEPTION_CONTINUE_SEARCH; // Don't handle these exceptions
}

if (!GTEST_FLAG_GET(catch_exceptions))
should_handle = false;
else if (exception_code == EXCEPTION_BREAKPOINT)
should_handle = false;
else if (exception_code == kCxxExceptionCode)
should_handle = false;
internal::ReportFailureInUnknownLocation(
TestPartResult::kFatalFailure,
FormatSehExceptionMessage(seh_code, location) +
"\n"
"Stack trace:\n" +
::testing::internal::GetCurrentOsStackTraceExceptTop(1));

return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
return EXCEPTION_EXECUTE_HANDLER;
}
#endif // GTEST_HAS_SEH

Expand Down Expand Up @@ -2553,23 +2562,6 @@ bool Test::HasSameFixtureClass() {
return true;
}

#if GTEST_HAS_SEH

// Adds an "exception thrown" fatal failure to the current test. This
// function returns its result via an output parameter pointer because VC++
// prohibits creation of objects with destructors on stack in functions
// using __try (see error C2712).
static std::string* FormatSehExceptionMessage(DWORD exception_code,
const char* location) {
Message message;
message << "SEH exception with code 0x" << std::setbase(16) << exception_code
<< std::setbase(10) << " thrown in " << location << ".";

return new std::string(message.GetString());
}

#endif // GTEST_HAS_SEH

namespace internal {

#if GTEST_HAS_EXCEPTIONS
Expand Down Expand Up @@ -2611,16 +2603,8 @@ Result HandleSehExceptionsInMethodIfSupported(T* object, Result (T::*method)(),
#if GTEST_HAS_SEH
__try {
return (object->*method)();
} __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT
GetExceptionCode())) {
// We create the exception message on the heap because VC++ prohibits
// creation of objects with destructors on stack in functions using __try
// (see error C2712).
std::string* exception_message =
FormatSehExceptionMessage(GetExceptionCode(), location);
internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
*exception_message);
delete exception_message;
} __except (internal::UnitTestOptions::GTestProcessSEH( // NOLINT
GetExceptionCode(), location)) {
return static_cast<Result>(0);
}
#else
Expand Down Expand Up @@ -5655,8 +5639,10 @@ void UnitTestImpl::ConfigureXmlOutput() {
<< output_format << "\" ignored.";
}
#else
GTEST_LOG_(ERROR) << "ERROR: alternative output formats require "
<< "GTEST_HAS_FILE_SYSTEM to be enabled";
if (!output_format.empty()) {
GTEST_LOG_(ERROR) << "ERROR: alternative output formats require "
<< "GTEST_HAS_FILE_SYSTEM to be enabled";
}
#endif // GTEST_HAS_FILE_SYSTEM
}

Expand Down
6 changes: 3 additions & 3 deletions doc/contributing/maintaining/maintaining-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This a list of all the dependencies:
* [c-ares 1.19.0][]
* [cjs-module-lexer 1.2.2][]
* [corepack][]
* [googletest ec4fed9][]
* [googletest cc36671][]
* [histogram 0.11.8][]
* [icu-small 73.2][]
* [libuv 1.46.0][]
Expand Down Expand Up @@ -189,7 +189,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to
install them - just like what currently happens with npm, which is shipped
by Node.js by default.

### googletest ec4fed9
### googletest cc36671

The [googletest](https://github.com/google/googletest) dependency is Google’s
C++ testing and mocking framework.
Expand Down Expand Up @@ -326,7 +326,7 @@ performance improvements not currently available in standard zlib.
[cjs-module-lexer 1.2.2]: #cjs-module-lexer-122
[corepack]: #corepack
[dependency-update-action]: ../../../.github/workflows/tools.yml
[googletest ec4fed9]: #googletest-ec4fed9
[googletest cc36671]: #googletest-cc36671
[histogram 0.11.8]: #histogram-0118
[icu-small 73.2]: #icu-small-732
[libuv 1.46.0]: #libuv-1460
Expand Down

0 comments on commit 2758b4d

Please sign in to comment.