Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
24683e2d
Unverified
Commit
24683e2d
authored
Sep 28, 2022
by
Baruch
Committed by
GitHub
Sep 28, 2022
Browse files
Merge branch 'google:main' into custom_type_combine
parents
173dd7c7
e23cdb78
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
14 deletions
+46
-14
googlemock/src/gmock-spec-builders.cc
googlemock/src/gmock-spec-builders.cc
+7
-0
googletest/include/gtest/internal/gtest-port-arch.h
googletest/include/gtest/internal/gtest-port-arch.h
+2
-0
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+21
-11
googletest/src/gtest-filepath.cc
googletest/src/gtest-filepath.cc
+2
-2
googletest/src/gtest.cc
googletest/src/gtest.cc
+2
-1
googletest/src/gtest_main.cc
googletest/src/gtest_main.cc
+12
-0
No files found.
googlemock/src/gmock-spec-builders.cc
View file @
24683e2d
...
@@ -51,6 +51,9 @@
...
@@ -51,6 +51,9 @@
#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
#include <unistd.h> // NOLINT
#include <unistd.h> // NOLINT
#endif
#endif
#if GTEST_OS_QURT
#include <qurt_event.h>
#endif
// Silence C4800 (C4800: 'int *const ': forcing value
// Silence C4800 (C4800: 'int *const ': forcing value
// to bool 'true' or 'false') for MSVC 15
// to bool 'true' or 'false') for MSVC 15
...
@@ -519,8 +522,12 @@ class MockObjectRegistry {
...
@@ -519,8 +522,12 @@ class MockObjectRegistry {
// RUN_ALL_TESTS() has already returned when this destructor is
// RUN_ALL_TESTS() has already returned when this destructor is
// called. Therefore we cannot use the normal Google Test
// called. Therefore we cannot use the normal Google Test
// failure reporting mechanism.
// failure reporting mechanism.
#if GTEST_OS_QURT
qurt_exception_raise_fatal
();
#else
_exit
(
1
);
// We cannot call exit() as it is not reentrant and
_exit
(
1
);
// We cannot call exit() as it is not reentrant and
// may already have been called.
// may already have been called.
#endif
}
}
}
}
...
...
googletest/include/gtest/internal/gtest-port-arch.h
View file @
24683e2d
...
@@ -111,6 +111,8 @@
...
@@ -111,6 +111,8 @@
#define GTEST_OS_ESP32 1
#define GTEST_OS_ESP32 1
#elif defined(__XTENSA__)
#elif defined(__XTENSA__)
#define GTEST_OS_XTENSA 1
#define GTEST_OS_XTENSA 1
#elif defined(__hexagon__)
#define GTEST_OS_QURT 1
#endif // __CYGWIN__
#endif // __CYGWIN__
#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
googletest/include/gtest/internal/gtest-port.h
View file @
24683e2d
...
@@ -385,7 +385,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
...
@@ -385,7 +385,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// On Android, <regex.h> is only available starting with Gingerbread.
// On Android, <regex.h> is only available starting with Gingerbread.
#define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
#define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
#else
#else
#define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS && !GTEST_OS_XTENSA)
#define GTEST_HAS_POSIX_RE \
!(GTEST_OS_WINDOWS || GTEST_OS_XTENSA || GTEST_OS_QURT)
#endif
#endif
#endif
#endif
...
@@ -457,7 +458,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
...
@@ -457,7 +458,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// no support for it at least as recent as Froyo (2.2).
// no support for it at least as recent as Froyo (2.2).
#define GTEST_HAS_STD_WSTRING \
#define GTEST_HAS_STD_WSTRING \
(!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
(!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
GTEST_OS_HAIKU || GTEST_OS_ESP32 || GTEST_OS_ESP8266 || GTEST_OS_XTENSA))
GTEST_OS_HAIKU || GTEST_OS_ESP32 || GTEST_OS_ESP8266 || \
GTEST_OS_XTENSA || GTEST_OS_QURT))
#endif // GTEST_HAS_STD_WSTRING
#endif // GTEST_HAS_STD_WSTRING
...
@@ -578,9 +580,10 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
...
@@ -578,9 +580,10 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// output correctness and to implement death tests.
// output correctness and to implement death tests.
#ifndef GTEST_HAS_STREAM_REDIRECTION
#ifndef GTEST_HAS_STREAM_REDIRECTION
// By default, we assume that stream redirection is supported on all
// By default, we assume that stream redirection is supported on all
// platforms except known mobile ones.
// platforms except known mobile / embedded ones.
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA
GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA || \
GTEST_OS_QURT
#define GTEST_HAS_STREAM_REDIRECTION 0
#define GTEST_HAS_STREAM_REDIRECTION 0
#else
#else
#define GTEST_HAS_STREAM_REDIRECTION 1
#define GTEST_HAS_STREAM_REDIRECTION 1
...
@@ -2019,7 +2022,12 @@ inline int StrCaseCmp(const char* s1, const char* s2) {
...
@@ -2019,7 +2022,12 @@ inline int StrCaseCmp(const char* s1, const char* s2) {
return
strcasecmp
(
s1
,
s2
);
return
strcasecmp
(
s1
,
s2
);
}
}
inline
char
*
StrDup
(
const
char
*
src
)
{
return
strdup
(
src
);
}
inline
char
*
StrDup
(
const
char
*
src
)
{
return
strdup
(
src
);
}
#if GTEST_OS_QURT
// QuRT doesn't support any directory functions, including rmdir
inline
int
RmDir
(
const
char
*
)
{
return
0
;
}
#else
inline
int
RmDir
(
const
char
*
dir
)
{
return
rmdir
(
dir
);
}
inline
int
RmDir
(
const
char
*
dir
)
{
return
rmdir
(
dir
);
}
#endif
inline
bool
IsDir
(
const
StatStruct
&
st
)
{
return
S_ISDIR
(
st
.
st_mode
);
}
inline
bool
IsDir
(
const
StatStruct
&
st
)
{
return
S_ISDIR
(
st
.
st_mode
);
}
#endif // GTEST_OS_WINDOWS
#endif // GTEST_OS_WINDOWS
...
@@ -2043,8 +2051,9 @@ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
...
@@ -2043,8 +2051,9 @@ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
// StrError() aren't needed on Windows CE at this time and thus not
// StrError() aren't needed on Windows CE at this time and thus not
// defined there.
// defined there.
#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && \
#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && \
!GTEST_OS_WINDOWS_RT && !GTEST_OS_ESP8266 && !GTEST_OS_XTENSA
!GTEST_OS_WINDOWS_RT && !GTEST_OS_ESP8266 && !GTEST_OS_XTENSA && \
!GTEST_OS_QURT
inline
int
ChDir
(
const
char
*
dir
)
{
return
chdir
(
dir
);
}
inline
int
ChDir
(
const
char
*
dir
)
{
return
chdir
(
dir
);
}
#endif
#endif
inline
FILE
*
FOpen
(
const
char
*
path
,
const
char
*
mode
)
{
inline
FILE
*
FOpen
(
const
char
*
path
,
const
char
*
mode
)
{
...
@@ -2058,14 +2067,14 @@ inline FILE* FOpen(const char* path, const char* mode) {
...
@@ -2058,14 +2067,14 @@ inline FILE* FOpen(const char* path, const char* mode) {
return
fopen
(
path
,
mode
);
return
fopen
(
path
,
mode
);
#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
}
}
#if !GTEST_OS_WINDOWS_MOBILE
#if !GTEST_OS_WINDOWS_MOBILE
&& !GTEST_OS_QURT
inline
FILE
*
FReopen
(
const
char
*
path
,
const
char
*
mode
,
FILE
*
stream
)
{
inline
FILE
*
FReopen
(
const
char
*
path
,
const
char
*
mode
,
FILE
*
stream
)
{
return
freopen
(
path
,
mode
,
stream
);
return
freopen
(
path
,
mode
,
stream
);
}
}
inline
FILE
*
FDOpen
(
int
fd
,
const
char
*
mode
)
{
return
fdopen
(
fd
,
mode
);
}
inline
FILE
*
FDOpen
(
int
fd
,
const
char
*
mode
)
{
return
fdopen
(
fd
,
mode
);
}
#endif
#endif
inline
int
FClose
(
FILE
*
fp
)
{
return
fclose
(
fp
);
}
inline
int
FClose
(
FILE
*
fp
)
{
return
fclose
(
fp
);
}
#if !GTEST_OS_WINDOWS_MOBILE
#if !GTEST_OS_WINDOWS_MOBILE
&& !GTEST_OS_QURT
inline
int
Read
(
int
fd
,
void
*
buf
,
unsigned
int
count
)
{
inline
int
Read
(
int
fd
,
void
*
buf
,
unsigned
int
count
)
{
return
static_cast
<
int
>
(
read
(
fd
,
buf
,
count
));
return
static_cast
<
int
>
(
read
(
fd
,
buf
,
count
));
}
}
...
@@ -2076,8 +2085,9 @@ inline int Close(int fd) { return close(fd); }
...
@@ -2076,8 +2085,9 @@ inline int Close(int fd) { return close(fd); }
inline
const
char
*
StrError
(
int
errnum
)
{
return
strerror
(
errnum
);
}
inline
const
char
*
StrError
(
int
errnum
)
{
return
strerror
(
errnum
);
}
#endif
#endif
inline
const
char
*
GetEnv
(
const
char
*
name
)
{
inline
const
char
*
GetEnv
(
const
char
*
name
)
{
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA
GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA || \
GTEST_OS_QURT
// We are on an embedded platform, which has no environment variables.
// We are on an embedded platform, which has no environment variables.
static_cast
<
void
>
(
name
);
// To prevent 'unused argument' warning.
static_cast
<
void
>
(
name
);
// To prevent 'unused argument' warning.
return
nullptr
;
return
nullptr
;
...
...
googletest/src/gtest-filepath.cc
View file @
24683e2d
...
@@ -96,7 +96,7 @@ static bool IsPathSeparator(char c) {
...
@@ -96,7 +96,7 @@ static bool IsPathSeparator(char c) {
FilePath
FilePath
::
GetCurrentDir
()
{
FilePath
FilePath
::
GetCurrentDir
()
{
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_ESP32 || \
GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_ESP32 || \
GTEST_OS_XTENSA
GTEST_OS_XTENSA
|| GTEST_OS_QURT
// These platforms do not have a current directory, so we just return
// These platforms do not have a current directory, so we just return
// something reasonable.
// something reasonable.
return
FilePath
(
kCurrentDirectoryString
);
return
FilePath
(
kCurrentDirectoryString
);
...
@@ -323,7 +323,7 @@ bool FilePath::CreateFolder() const {
...
@@ -323,7 +323,7 @@ bool FilePath::CreateFolder() const {
delete
[]
unicode
;
delete
[]
unicode
;
#elif GTEST_OS_WINDOWS
#elif GTEST_OS_WINDOWS
int
result
=
_mkdir
(
pathname_
.
c_str
());
int
result
=
_mkdir
(
pathname_
.
c_str
());
#elif GTEST_OS_ESP8266 || GTEST_OS_XTENSA
#elif GTEST_OS_ESP8266 || GTEST_OS_XTENSA
|| GTEST_OS_QURT
// do nothing
// do nothing
int
result
=
0
;
int
result
=
0
;
#else
#else
...
...
googletest/src/gtest.cc
View file @
24683e2d
...
@@ -2713,7 +2713,8 @@ TestInfo::TestInfo(const std::string& a_test_suite_name,
...
@@ -2713,7 +2713,8 @@ TestInfo::TestInfo(const std::string& a_test_suite_name,
internal
::
TypeId
fixture_class_id
,
internal
::
TypeId
fixture_class_id
,
internal
::
TestFactoryBase
*
factory
)
internal
::
TestFactoryBase
*
factory
)
:
test_suite_name_
(
a_test_suite_name
),
:
test_suite_name_
(
a_test_suite_name
),
name_
(
a_name
),
// begin()/end() is MSVC 17.3.3 ASAN crash workaround (GitHub issue #3997)
name_
(
a_name
.
begin
(),
a_name
.
end
()),
type_param_
(
a_type_param
?
new
std
::
string
(
a_type_param
)
:
nullptr
),
type_param_
(
a_type_param
?
new
std
::
string
(
a_type_param
)
:
nullptr
),
value_param_
(
a_value_param
?
new
std
::
string
(
a_value_param
)
:
nullptr
),
value_param_
(
a_value_param
?
new
std
::
string
(
a_value_param
)
:
nullptr
),
location_
(
a_code_location
),
location_
(
a_code_location
),
...
...
googletest/src/gtest_main.cc
View file @
24683e2d
...
@@ -32,9 +32,12 @@
...
@@ -32,9 +32,12 @@
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#if GTEST_OS_ESP8266 || GTEST_OS_ESP32
#if GTEST_OS_ESP8266 || GTEST_OS_ESP32
// Arduino-like platforms: program entry points are setup/loop instead of main.
#if GTEST_OS_ESP8266
#if GTEST_OS_ESP8266
extern
"C"
{
extern
"C"
{
#endif
#endif
void
setup
()
{
testing
::
InitGoogleTest
();
}
void
setup
()
{
testing
::
InitGoogleTest
();
}
void
loop
()
{
RUN_ALL_TESTS
();
}
void
loop
()
{
RUN_ALL_TESTS
();
}
...
@@ -43,7 +46,16 @@ void loop() { RUN_ALL_TESTS(); }
...
@@ -43,7 +46,16 @@ void loop() { RUN_ALL_TESTS(); }
}
}
#endif
#endif
#elif GTEST_OS_QURT
// QuRT: program entry point is main, but argc/argv are unusable.
GTEST_API_
int
main
()
{
printf
(
"Running main() from %s
\n
"
,
__FILE__
);
testing
::
InitGoogleTest
();
return
RUN_ALL_TESTS
();
}
#else
#else
// Normal platforms: program entry point is main, argc/argv are initialized.
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
printf
(
"Running main() from %s
\n
"
,
__FILE__
);
printf
(
"Running main() from %s
\n
"
,
__FILE__
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment