Skip to content

Commit 133719b

Browse files
nodejs-github-botrichardlau
authored andcommitted
deps: update googletest to 7c07a86
PR-URL: #51458 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 481af53 commit 133719b

File tree

3 files changed

+38
-13
lines changed

3 files changed

+38
-13
lines changed

‎deps/googletest/include/gtest/gtest-printers.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,10 @@ int AppropriateResolution(FloatType val){
552552
int full = std::numeric_limits<FloatType>::max_digits10;
553553
if (val < 0) val = -val;
554554

555+
#ifdef __GNUC__
556+
#pragma GCC diagnostic push
557+
#pragma GCC diagnostic ignored "-Wfloat-equal"
558+
#endif
555559
if (val < 1000000){
556560
FloatType mulfor6 = 1e10;
557561
if (val >= 100000.0){// 100,000 to 999,999
@@ -595,6 +599,9 @@ int AppropriateResolution(FloatType val){
595599
val)
596600
return6;
597601
}
602+
#ifdef __GNUC__
603+
#pragma GCC diagnostic pop
604+
#endif
598605
return full;
599606
}
600607

‎deps/googletest/include/gtest/internal/gtest-port.h‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,10 @@
338338
#defineGTEST_HAS_NOTIFICATION_0
339339
#endif
340340

341-
#ifdefGTEST_HAS_ABSL
342-
#include"absl/flags/declare.h"
341+
#if defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS)
342+
#defineGTEST_INTERNAL_HAS_ABSL_FLAGS// Used only in this file.
343343
#include"absl/flags/flag.h"
344+
#include"absl/flags/declare.h"
344345
#include"absl/flags/reflection.h"
345346
#endif
346347

@@ -2005,7 +2006,9 @@ inline std::string StripTrailingSpaces(std::string str){
20052006
namespaceposix{
20062007

20072008
// File system porting.
2008-
#if GTEST_HAS_FILE_SYSTEM
2009+
// Note: Not every I/O-related function is related to file systems, so don't
2010+
// just disable all of them here. For example, fileno() and isatty(), etc. must
2011+
// always be available in order to detect if a pipe points to a terminal.
20092012
#ifdef GTEST_OS_WINDOWS
20102013

20112014
typedefstruct_stat StatStruct;
@@ -2016,27 +2019,32 @@ inline int FileNo(FILE* file){return reinterpret_cast<int>(_fileno(file))}
20162019
// time and thus not defined there.
20172020
#else
20182021
inlineintFileNo(FILE* file){return_fileno(file)}
2022+
#if GTEST_HAS_FILE_SYSTEM
20192023
inlineintStat(constchar* path, StatStruct* buf){return_stat(path, buf)}
20202024
inlineintRmDir(constchar* dir){return_rmdir(dir)}
20212025
inlineboolIsDir(const StatStruct& st){return (_S_IFDIR & st.st_mode) != 0}
2026+
#endif
20222027
#endif// GTEST_OS_WINDOWS_MOBILE
20232028

20242029
#elif defined(GTEST_OS_ESP8266)
20252030
typedefstructstat StatStruct;
20262031

20272032
inlineintFileNo(FILE* file){returnfileno(file)}
2033+
#if GTEST_HAS_FILE_SYSTEM
20282034
inlineintStat(constchar* path, StatStruct* buf){
20292035
// stat function not implemented on ESP8266
20302036
return0;
20312037
}
20322038
inlineintRmDir(constchar* dir){returnrmdir(dir)}
20332039
inlineboolIsDir(const StatStruct& st){returnS_ISDIR(st.st_mode)}
2040+
#endif
20342041

20352042
#else
20362043

20372044
typedefstructstat StatStruct;
20382045

20392046
inlineintFileNo(FILE* file){returnfileno(file)}
2047+
#if GTEST_HAS_FILE_SYSTEM
20402048
inlineintStat(constchar* path, StatStruct* buf){returnstat(path, buf)}
20412049
#ifdef GTEST_OS_QURT
20422050
// QuRT doesn't support any directory functions, including rmdir
@@ -2045,9 +2053,9 @@ inline int RmDir(const char*){return 0}
20452053
inlineintRmDir(constchar* dir){returnrmdir(dir)}
20462054
#endif
20472055
inlineboolIsDir(const StatStruct& st){returnS_ISDIR(st.st_mode)}
2056+
#endif
20482057

20492058
#endif// GTEST_OS_WINDOWS
2050-
#endif// GTEST_HAS_FILE_SYSTEM
20512059

20522060
// Other functions with a different name on Windows.
20532061

@@ -2245,7 +2253,7 @@ using TimeInMillis = int64_t; // Represents time in milliseconds.
22452253
#endif// !defined(GTEST_FLAG)
22462254

22472255
// Pick a command line flags implementation.
2248-
#ifdefGTEST_HAS_ABSL
2256+
#ifdefGTEST_INTERNAL_HAS_ABSL_FLAGS
22492257

22502258
// Macros for defining flags.
22512259
#defineGTEST_DEFINE_bool_(name, default_val, doc) \
@@ -2270,7 +2278,8 @@ using TimeInMillis = int64_t; // Represents time in milliseconds.
22702278
(void)(::absl::SetFlag(&GTEST_FLAG(name), value))
22712279
#defineGTEST_USE_OWN_FLAGFILE_FLAG_0
22722280

2273-
#else// GTEST_HAS_ABSL
2281+
#undef GTEST_INTERNAL_HAS_ABSL_FLAGS
2282+
#else// ndef GTEST_INTERNAL_HAS_ABSL_FLAGS
22742283

22752284
// Macros for defining flags.
22762285
#defineGTEST_DEFINE_bool_(name, default_val, doc) \
@@ -2312,7 +2321,7 @@ using TimeInMillis = int64_t; // Represents time in milliseconds.
23122321
#defineGTEST_FLAG_SET(name, value) (void)(::testing::GTEST_FLAG(name) = value)
23132322
#defineGTEST_USE_OWN_FLAGFILE_FLAG_1
23142323

2315-
#endif//GTEST_HAS_ABSL
2324+
#endif//GTEST_INTERNAL_HAS_ABSL_FLAGS
23162325

23172326
// Thread annotations
23182327
#if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)

‎deps/googletest/src/gtest.cc‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@
162162
#defineGTEST_HAS_BUILTIN(x) 0
163163
#endif// defined(__has_builtin)
164164

165+
#if defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS)
166+
#defineGTEST_HAS_ABSL_FLAGS
167+
#endif
168+
165169
namespacetesting{
166170

167171
using internal::CountIf;
@@ -459,7 +463,12 @@ void AssertHelper::operator=(const Message& message) const{
459463
UnitTest::GetInstance()->AddTestPartResult(
460464
data_->type, data_->file, data_->line,
461465
AppendUserMessage(data_->message, message),
462-
UnitTest::GetInstance()->impl()->CurrentOsStackTraceExceptTop(1)
466+
// Suppress emission of the stack trace for GTEST_SKIP() since skipping is
467+
// an intentional act by the developer rather than a failure requiring
468+
// investigation.
469+
data_->type != TestPartResult::kSkip
470+
? UnitTest::GetInstance()->impl()->CurrentOsStackTraceExceptTop(1)
471+
: ""
463472
// Skips the stack frame for this function itself.
464473
); // NOLINT
465474
}
@@ -3283,11 +3292,9 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...){
32833292
va_start(args, fmt);
32843293

32853294
staticconstbool in_color_mode =
3286-
#if GTEST_HAS_FILE_SYSTEM
3295+
// We don't condition this on GTEST_HAS_FILE_SYSTEM because we still need
3296+
// to be able to detect terminal I/O regardless.
32873297
ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
3288-
#else
3289-
false;
3290-
#endif// GTEST_HAS_FILE_SYSTEM
32913298

32923299
constbool use_color = in_color_mode && (color != GTestColor::kDefault);
32933300

@@ -6685,7 +6692,7 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv){
66856692
// remain in place. Unrecognized flags are not reported and do not cause the
66866693
// program to exit.
66876694
voidParseGoogleTestFlagsOnly(int* argc, char** argv){
6688-
#ifdefGTEST_HAS_ABSL
6695+
#ifdefGTEST_HAS_ABSL_FLAGS
66896696
if (*argc <= 0) return;
66906697

66916698
std::vector<char*> positional_args;
@@ -6771,11 +6778,13 @@ void InitGoogleTestImpl(int* argc, CharType** argv){
67716778
#ifdef GTEST_HAS_ABSL
67726779
absl::InitializeSymbolizer(g_argvs[0].c_str());
67736780

6781+
#ifdef GTEST_HAS_ABSL_FLAGS
67746782
// When using the Abseil Flags library, set the program usage message to the
67756783
// help message, but remove the color-encoding from the message first.
67766784
absl::SetProgramUsageMessage(absl::StrReplaceAll(
67776785
kColorEncodedHelpMessage,
67786786
{{"@D", ""},{"@R", ""},{"@G", ""},{"@Y", ""},{"@@", "@"}}));
6787+
#endif// GTEST_HAS_ABSL_FLAGS
67796788
#endif// GTEST_HAS_ABSL
67806789

67816790
ParseGoogleTestFlagsOnly(argc, argv);

0 commit comments

Comments
(0)