From 45ec0df68ba9bf29e28344d280da76fdd976c7f7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 29 Jul 2020 11:34:00 +0000 Subject: [PATCH] failed to compile whle random test enabled --- src/os/inc/osSpec.h | 9 +++++++-- src/tsdb/src/tsdbMain.c | 6 ++++-- src/util/src/tlog.c | 3 +++ src/util/src/tnote.c | 3 +++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/os/inc/osSpec.h b/src/os/inc/osSpec.h index 48ec6ae04f..d93a647206 100644 --- a/src/os/inc/osSpec.h +++ b/src/os/inc/osSpec.h @@ -338,14 +338,15 @@ void taosRemoveDir(char *rootDir); int taosMkDir(const char *pathname, mode_t mode); void taosMvDir(char* destDir, char *srcDir); - - #ifdef TAOS_RANDOM_FILE_FAIL void taosSetRandomFileFailFactor(int factor); void taosSetRandomFileFailOutput(const char *path); ssize_t taosReadFileRandomFail(int fd, void *buf, size_t count, const char *file, uint32_t line); ssize_t taosWriteFileRandomFail(int fd, void *buf, size_t count, const char *file, uint32_t line); off_t taosLSeekRandomFail(int fd, off_t offset, int whence, const char *file, uint32_t line); + #undef taosTRead + #undef taosTWrite + #undef taosLSeek #define taosTRead(fd, buf, count) taosReadFileRandomFail(fd, buf, count, __FILE__, __LINE__) #define taosTWrite(fd, buf, count) taosWriteFileRandomFail(fd, buf, count, __FILE__, __LINE__) #define taosLSeek(fd, offset, whence) taosLSeekRandomFail(fd, offset, whence, __FILE__, __LINE__) @@ -356,6 +357,10 @@ void taosMvDir(char* destDir, char *srcDir); ssize_t taosSendToRandomFail(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen); ssize_t taosReadSocketRandomFail(int fd, void *buf, size_t count); ssize_t taosWriteSocketRandomFail(int fd, const void *buf, size_t count); + #undef taosSend + #undef taosSendto + #undef taosReadSocket + #undef taosWriteSocket #define taosSend(sockfd, buf, len, flags) taosSendRandomFail(sockfd, buf, len, flags) #define taosSendto(sockfd, buf, len, flags, dest_addr, addrlen) taosSendToRandomFail(sockfd, buf, len, flags, dest_addr, addrlen) #define taosReadSocket(fd, buf, len) taosReadSocketRandomFail(fd, buf, len) diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 3a453249a9..895bd4ae51 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -12,6 +12,10 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ + +// no test file errors here +#undef TAOS_RANDOM_FILE_FAIL + #include "tsdbMain.h" #include "os.h" #include "talgo.h" @@ -22,8 +26,6 @@ #include "ttime.h" #include "tulog.h" -#include -#include #define TSDB_CFG_FILE_NAME "config" #define TSDB_DATA_DIR_NAME "data" diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index 2489ae56be..96ae417297 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -14,6 +14,9 @@ */ #define _DEFAULT_SOURCE +// no test file errors here +#undef TAOS_RANDOM_FILE_FAIL + #include "os.h" #include "tulog.h" #include "tlog.h" diff --git a/src/util/src/tnote.c b/src/util/src/tnote.c index fdf11eb5c4..91916c92d7 100644 --- a/src/util/src/tnote.c +++ b/src/util/src/tnote.c @@ -13,6 +13,9 @@ * along with this program. If not, see . */ +// no test file errors here +#undef TAOS_RANDOM_FILE_FAIL + #include "tnote.h" taosNoteInfo m_HttpNote; -- GitLab