feat: Add support for ESP8266 platform

Added support for ESP8266 Arduino platform.

Refactored Arduino defines to use the GTEST_OS_* model.
This commit is contained in:
Chris Johnson 2019-08-28 09:39:35 -05:00
parent ba513d2c95
commit 40a6b96621
5 changed files with 9 additions and 3 deletions

View File

@ -32,7 +32,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#ifdef ARDUINO
#if defined GTEST_OS_ESP8266 || defined GTEST_OS_ESP32
void setup() {
// Since Google Mock depends on Google Test, InitGoogleMock() is
// also responsible for initializing Google Test. Therefore there's

View File

@ -102,6 +102,10 @@
# define GTEST_OS_QNX 1
#elif defined(__HAIKU__)
#define GTEST_OS_HAIKU 1
#elif defined ESP8266
# define GTEST_OS_ESP8266 1
#elif defined ESP32
# define GTEST_OS_ESP32 1
#endif // __CYGWIN__
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_

View File

@ -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);

View File

@ -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:

View File

@ -30,7 +30,7 @@
#include <cstdio>
#include "gtest/gtest.h"
#ifdef ARDUINO
#if defined GTEST_OS_ESP8266 || defined GTEST_OS_ESP32
void setup() {
testing::InitGoogleTest();
}