Add ESP8266 configs to PlatformIO build
Added various conditional compliations for ESP8266 to stub out missing functionality.
This commit is contained in:
@@ -1984,6 +1984,22 @@ inline bool IsDir(const StatStruct& st) {
|
||||
}
|
||||
# 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
|
||||
|
||||
typedef struct stat StatStruct;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -30,13 +30,20 @@
|
||||
#include <cstdio>
|
||||
#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() {
|
||||
testing::InitGoogleTest();
|
||||
}
|
||||
|
||||
void loop() { RUN_ALL_TESTS(); }
|
||||
|
||||
# if GTEST_OS_ESP8266
|
||||
}
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
GTEST_API_ int main(int argc, char **argv) {
|
||||
|
||||
Reference in New Issue
Block a user