diff options
author | Chris <chrisjohnsonmail@gmail.com> | 2019-10-14 02:39:54 (GMT) |
---|---|---|
committer | Chris <chrisjohnsonmail@gmail.com> | 2019-10-14 02:39:54 (GMT) |
commit | 778733f9ecdd2b14a0167df54dd25d2d6f6e24f6 (patch) | |
tree | 6bc53d159525957ead5df15a2adc1e3b7bfd9e53 /googletest/src | |
parent | ba513d2c9525a7c986c115ed5d603f2cf17c6016 (diff) | |
parent | 84a5ae8b85605fd51cf3d0107315670d3cf00fa4 (diff) | |
download | googletest-778733f9ecdd2b14a0167df54dd25d2d6f6e24f6.zip googletest-778733f9ecdd2b14a0167df54dd25d2d6f6e24f6.tar.gz googletest-778733f9ecdd2b14a0167df54dd25d2d6f6e24f6.tar.bz2 |
feat: Add ESP8266 support
* Added support for ESP8266
* Removed previous Arduino defines in favor
of GTEST_OS_* syntax
* Improved PlatformIO library file to be more
stable when consumed in client applications.
Diffstat (limited to 'googletest/src')
-rw-r--r-- | googletest/src/gtest-filepath.cc | 7 | ||||
-rw-r--r-- | googletest/src/gtest.cc | 2 | ||||
-rw-r--r-- | googletest/src/gtest_main.cc | 9 |
3 files changed, 15 insertions, 3 deletions
diff --git a/googletest/src/gtest-filepath.cc b/googletest/src/gtest-filepath.cc index bd7b99f..7e03e81 100644 --- a/googletest/src/gtest-filepath.cc +++ b/googletest/src/gtest-filepath.cc @@ -93,7 +93,7 @@ static bool IsPathSeparator(char c) { // Returns the current working directory, or "" if unsuccessful. FilePath FilePath::GetCurrentDir() { #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \ - GTEST_OS_WINDOWS_RT || ARDUINO || defined(ESP_PLATFORM) + GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_ESP32 // These platforms do not have a current directory, so we just return // something reasonable. return FilePath(kCurrentDirectoryString); @@ -236,7 +236,7 @@ bool FilePath::DirectoryExists() const { result = true; } #else - posix::StatStruct file_stat; + posix::StatStruct file_stat = {}; result = posix::Stat(path.c_str(), &file_stat) == 0 && posix::IsDir(file_stat); #endif // GTEST_OS_WINDOWS_MOBILE @@ -323,6 +323,9 @@ bool FilePath::CreateFolder() const { delete [] unicode; #elif GTEST_OS_WINDOWS int result = _mkdir(pathname_.c_str()); +#elif GTEST_OS_ESP8266 + // do nothing + int result = 0; #else int result = mkdir(pathname_.c_str(), 0777); #endif // GTEST_OS_WINDOWS_MOBILE diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index a5b4e5a..a11ce18 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -4508,6 +4508,7 @@ class ScopedPrematureExitFile { } ~ScopedPrematureExitFile() { + #if !defined GTEST_OS_ESP8266 if (!premature_exit_filepath_.empty()) { int retval = remove(premature_exit_filepath_.c_str()); if (retval) { @@ -4516,6 +4517,7 @@ class ScopedPrematureExitFile { << retval; } } + #endif } private: diff --git a/googletest/src/gtest_main.cc b/googletest/src/gtest_main.cc index f6e1dd9..3747925 100644 --- a/googletest/src/gtest_main.cc +++ b/googletest/src/gtest_main.cc @@ -30,13 +30,20 @@ #include <cstdio> #include "gtest/gtest.h" -#ifdef ARDUINO +#if GTEST_OS_ESP8266 || GTEST_OS_ESP32 +# if GTEST_OS_ESP8266 +extern "C" { +# endif void setup() { testing::InitGoogleTest(); } void loop() { RUN_ALL_TESTS(); } +# if GTEST_OS_ESP8266 +} +# endif + #else GTEST_API_ int main(int argc, char **argv) { |