提交 b628b891 编写于 作者: S Shengliang Guan

[TD-992]

上级 9400d5b4
......@@ -30,19 +30,24 @@ int taosFSendFileImp(FILE* out_file, FILE* in_file, int64_t* offset, int32_t
#define taosTSendFile(dfd, sfd, offset, size) taosTSendFileImp(dfd, sfd, offset, size)
#define taosFSendFile(outfile, infile, offset, count) taosTSendFileImp(fileno(outfile), fileno(infile), offset, size)
#ifndef TAOS_RANDOM_FILE_FAIL
#define taosTRead(fd, buf, count) taosTReadImp(fd, buf, count)
#define taosTWrite(fd, buf, count) taosTWriteImp(fd, buf, count)
#define taosLSeek(fd, offset, whence) lseek(fd, offset, whence)
#else
#define taosTRead(fd, buf, count) taosTReadImp(fd, buf, count)
#define taosTWrite(fd, buf, count) taosTWriteImp(fd, buf, count)
#define taosLSeek(fd, offset, whence) lseek(fd, offset, whence)
#ifdef TAOS_RANDOM_FILE_FAIL
void taosSetRandomFileFailFactor(int factor);
void taosSetRandomFileFailOutput(const char *path);
#ifdef TAOS_RANDOM_FILE_FAIL_TEST
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__)
#endif
#endif
// TAOS_OS_FUNC_FILE_GETTMPFILEPATH
......
......@@ -46,15 +46,16 @@ void taosTMemset(void *ptr, int c);
} \
} while (0);
#ifndef TAOS_MEM_CHECK
#define taosMalloc(size) malloc(size)
#define taosCalloc(num, size) calloc(num, size)
#define taosRealloc(ptr, size) realloc(ptr, size)
#define taosFree(ptr) free(ptr)
#define taosStrdup(str) taosStrdupImp(str)
#define taosStrndup(str, size) taosStrndupImp(str, size)
#define taosGetline(lineptr, n, stream) taosGetlineImp(lineptr, n, stream)
#else
#define taosMalloc(size) malloc(size)
#define taosCalloc(num, size) calloc(num, size)
#define taosRealloc(ptr, size) realloc(ptr, size)
#define taosFree(ptr) free(ptr)
#define taosStrdup(str) taosStrdupImp(str)
#define taosStrndup(str, size) taosStrndupImp(str, size)
#define taosGetline(lineptr, n, stream) taosGetlineImp(lineptr, n, stream)
#ifdef TAOS_MEM_CHECK
#ifdef TAOS_MEM_CHECK_TEST
void * taos_malloc(size_t size, const char *file, uint32_t line);
void * taos_calloc(size_t num, size_t size, const char *file, uint32_t line);
void * taos_realloc(void *ptr, size_t size, const char *file, uint32_t line);
......@@ -62,6 +63,13 @@ void taosTMemset(void *ptr, int c);
char * taos_strdup(const char *str, const char *file, uint32_t line);
char * taos_strndup(const char *str, size_t size, const char *file, uint32_t line);
ssize_t taos_getline(char **lineptr, size_t *n, FILE *stream, const char *file, uint32_t line);
#undef taosMalloc
#undef taosCalloc
#undef taosRealloc
#undef taosFree
#undef taosStrdup
#undef taosStrndup
#undef taosGetline
#define taosMalloc(size) taos_malloc(size, __FILE__, __LINE__)
#define taosCalloc(num, size) taos_calloc(num, size, __FILE__, __LINE__)
#define taosRealloc(ptr, size) taos_realloc(ptr, size, __FILE__, __LINE__)
......@@ -69,6 +77,7 @@ void taosTMemset(void *ptr, int c);
#define taosStrdup(str) taos_strdup(str, __FILE__, __LINE__)
#define taosStrndup(str, size) taos_strndup(str, size, __FILE__, __LINE__)
#define taosGetline(lineptr, n, stream) taos_getline(lineptr, n, stream, __FILE__, __LINE__)
#endif
#endif
#ifdef __cplusplus
......
......@@ -35,6 +35,7 @@ extern "C" {
#define taosClose(x) taosCloseSocket(x)
#ifdef TAOS_RANDOM_NETWORK_FAIL
#ifdef TAOS_RANDOM_NETWORK_FAIL_TEST
ssize_t taosSendRandomFail(int sockfd, const void *buf, size_t len, int flags);
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);
......@@ -47,6 +48,7 @@ extern "C" {
#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)
#define taosWriteSocket(fd, buf, len) taosWriteSocketRandomFail(fd, buf, len)
#endif
#endif
// TAOS_OS_FUNC_SOCKET
......
......@@ -14,11 +14,11 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "talgo.h"
#include "tchecksum.h"
#include "tsdbMain.h"
#include "tutil.h"
#define TAOS_RANDOM_FILE_FAIL_TEST
#ifdef TSDB_IDX
const char *tsdbFileSuffix[] = {".idx", ".head", ".data", ".last", "", ".i", ".h", ".l"};
......
......@@ -14,8 +14,6 @@
*/
// no test file errors here
#undef TAOS_RANDOM_FILE_FAIL
#include "tsdbMain.h"
#include "os.h"
#include "talgo.h"
......@@ -25,7 +23,6 @@
#include "tsdb.h"
#include "tulog.h"
#define TSDB_CFG_FILE_NAME "config"
#define TSDB_DATA_DIR_NAME "data"
#define TSDB_META_FILE_NAME "meta"
......
......@@ -20,6 +20,7 @@
#include "tcoding.h"
#include "tscompression.h"
#include "tsdbMain.h"
#define TAOS_RANDOM_FILE_FAIL_TEST
#define TSDB_GET_COMPCOL_LEN(nCols) (sizeof(SCompData) + sizeof(SCompCol) * (nCols) + sizeof(TSCKSUM))
#define TSDB_KEY_COL_OFFSET 0
......
......@@ -21,6 +21,7 @@
#include "tcoding.h"
#include "tkvstore.h"
#include "tulog.h"
#define TAOS_RANDOM_FILE_FAIL_TEST
#define TD_KVSTORE_HEADER_SIZE 512
#define TD_KVSTORE_MAJOR_VERSION 1
......
......@@ -14,9 +14,6 @@
*/
#define _DEFAULT_SOURCE
// no test file errors here
#undef TAOS_RANDOM_FILE_FAIL
#include "os.h"
#include "tulog.h"
#include "tlog.h"
......
......@@ -13,9 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// no test file errors here
#undef TAOS_RANDOM_FILE_FAIL
#include "os.h"
#include "tnote.h"
taosNoteInfo m_HttpNote;
......
......@@ -22,6 +22,7 @@
#include "taoserror.h"
#include "twal.h"
#include "tqueue.h"
#define TAOS_RANDOM_FILE_FAIL_TEST
#define walPrefix "wal"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册