Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
c2206b05
Commit
c2206b05
authored
Aug 29, 2019
by
Chris Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ESP8266 configs to PlatformIO build
Added various conditional compliations for ESP8266 to stub out missing functionality.
parent
40a6b966
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
4 deletions
+54
-4
gmock_main.cc
googlemock/src/gmock_main.cc
+8
-1
gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+16
-0
gtest-filepath.cc
googletest/src/gtest-filepath.cc
+4
-1
gtest_main.cc
googletest/src/gtest_main.cc
+8
-1
platformio.ini
platformio.ini
+18
-1
No files found.
googlemock/src/gmock_main.cc
View file @
c2206b05
...
@@ -32,7 +32,10 @@
...
@@ -32,7 +32,10 @@
#include "gmock/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#if defined GTEST_OS_ESP8266 || defined GTEST_OS_ESP32
#if GTEST_OS_ESP8266 || GTEST_OS_ESP32
# if GTEST_OS_ESP8266
extern
"C"
{
# endif
void
setup
()
{
void
setup
()
{
// Since Google Mock depends on Google Test, InitGoogleMock() is
// Since Google Mock depends on Google Test, InitGoogleMock() is
// also responsible for initializing Google Test. Therefore there's
// also responsible for initializing Google Test. Therefore there's
...
@@ -40,6 +43,10 @@ void setup() {
...
@@ -40,6 +43,10 @@ void setup() {
testing
::
InitGoogleMock
();
testing
::
InitGoogleMock
();
}
}
void
loop
()
{
RUN_ALL_TESTS
();
}
void
loop
()
{
RUN_ALL_TESTS
();
}
# if GTEST_OS_ESP8266
}
# endif
#else
#else
// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
...
...
googletest/include/gtest/internal/gtest-port.h
View file @
c2206b05
...
@@ -1984,6 +1984,22 @@ inline bool IsDir(const StatStruct& st) {
...
@@ -1984,6 +1984,22 @@ inline bool IsDir(const StatStruct& st) {
}
}
# endif // GTEST_OS_WINDOWS_MOBILE
# endif // GTEST_OS_WINDOWS_MOBILE
#elif GTEST_OS_ESP8266
typedef
struct
stat
StatStruct
;
inline
int
FileNo
(
FILE
*
file
)
{
return
fileno
(
file
);
}
inline
int
IsATTY
(
int
fd
)
{
return
isatty
(
fd
);
}
inline
int
Stat
(
const
char
*
path
,
StatStruct
*
buf
)
{
// stat function not implemented on ESP8266
return
0
;
}
inline
int
StrCaseCmp
(
const
char
*
s1
,
const
char
*
s2
)
{
return
strcasecmp
(
s1
,
s2
);
}
inline
char
*
StrDup
(
const
char
*
src
)
{
return
strdup
(
src
);
}
inline
int
RmDir
(
const
char
*
dir
)
{
return
rmdir
(
dir
);
}
inline
bool
IsDir
(
const
StatStruct
&
st
)
{
return
S_ISDIR
(
st
.
st_mode
);
}
#else
#else
typedef
struct
stat
StatStruct
;
typedef
struct
stat
StatStruct
;
...
...
googletest/src/gtest-filepath.cc
View file @
c2206b05
...
@@ -236,7 +236,7 @@ bool FilePath::DirectoryExists() const {
...
@@ -236,7 +236,7 @@ bool FilePath::DirectoryExists() const {
result
=
true
;
result
=
true
;
}
}
#else
#else
posix
::
StatStruct
file_stat
;
posix
::
StatStruct
file_stat
=
{}
;
result
=
posix
::
Stat
(
path
.
c_str
(),
&
file_stat
)
==
0
&&
result
=
posix
::
Stat
(
path
.
c_str
(),
&
file_stat
)
==
0
&&
posix
::
IsDir
(
file_stat
);
posix
::
IsDir
(
file_stat
);
#endif // GTEST_OS_WINDOWS_MOBILE
#endif // GTEST_OS_WINDOWS_MOBILE
...
@@ -323,6 +323,9 @@ bool FilePath::CreateFolder() const {
...
@@ -323,6 +323,9 @@ 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
// do nothing
int
result
=
0
;
#else
#else
int
result
=
mkdir
(
pathname_
.
c_str
(),
0777
);
int
result
=
mkdir
(
pathname_
.
c_str
(),
0777
);
#endif // GTEST_OS_WINDOWS_MOBILE
#endif // GTEST_OS_WINDOWS_MOBILE
...
...
googletest/src/gtest_main.cc
View file @
c2206b05
...
@@ -30,13 +30,20 @@
...
@@ -30,13 +30,20 @@
#include <cstdio>
#include <cstdio>
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#if defined GTEST_OS_ESP8266 || defined GTEST_OS_ESP32
#if GTEST_OS_ESP8266 || GTEST_OS_ESP32
# if GTEST_OS_ESP8266
extern
"C"
{
# endif
void
setup
()
{
void
setup
()
{
testing
::
InitGoogleTest
();
testing
::
InitGoogleTest
();
}
}
void
loop
()
{
RUN_ALL_TESTS
();
}
void
loop
()
{
RUN_ALL_TESTS
();
}
# if GTEST_OS_ESP8266
}
# endif
#else
#else
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
...
...
platformio.ini
View file @
c2206b05
...
@@ -27,5 +27,21 @@ platform = espressif32
...
@@ -27,5 +27,21 @@ platform = espressif32
board
=
esp32dev
board
=
esp32dev
framework
=
arduino
framework
=
arduino
build_flags
=
-I./googlemock/include -I./googletest/include -I./googletest -I./googlemock
build_flags
=
-I./googlemock/include -I./googletest/include -I./googletest -I./googlemock
src_filter
=
+<*> -<.git/> -<googletest> -<googlemock/test/> -<googlemock/src> +<googlemock/src/gmock-all.cc> +<googlemock/src/gmock_main.cc> +<googletest/src/gtest-all.cc>
src_filter
=
+<*> -<.git/> -<googletest> -<googlemock/test/> -<googlemock/src> +<googlemock/src/gmock-all.cc> +<googletest/src/gtest-all.cc> +<googlemock/src/gmock_main.cc>
upload_speed
=
921600
[env:googletest_esp8266]
platform
=
espressif8266
board
=
huzzah
framework
=
arduino
build_flags
=
-I./googletest/include -I./googletest
src_filter
=
+<*> -<.git/> -<googlemock> -<googletest/codegear/> -<googletest/samples> -<googletest/test/> -<googletest/xcode> -<googletest/src> +<googletest/src/gtest-all.cc> +<googletest/src/gtest_main.cc>
upload_speed
=
921600
[env:googlemock_esp8266]
platform
=
espressif8266
board
=
huzzah
framework
=
arduino
build_flags
=
-I./googlemock/include -I./googletest/include -I./googletest -I./googlemock
src_filter
=
+<*> -<.git/> -<googletest> -<googlemock/test/> -<googlemock/src> +<googlemock/src/gmock-all.cc> +<googletest/src/gtest-all.cc> +<googlemock/src/gmock_main.cc>
upload_speed
=
921600
upload_speed
=
921600
\ No newline at end of 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