From 9dff7b93c6c4374581d3572419b36d28d3533510 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Tue, 21 Jun 2022 20:04:55 +0800 Subject: [PATCH] test: fix sim test error --- include/os/osTime.h | 14 +-- include/util/tdef.h | 10 +- include/util/tpagedbuf.h | 2 +- include/util/types.h | 4 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 4 +- source/libs/executor/src/scanoperator.c | 4 +- source/libs/executor/src/timewindowoperator.c | 4 +- source/libs/function/src/tudf.c | 2 +- source/libs/index/src/index.c | 6 +- source/libs/index/src/indexComm.c | 6 +- source/libs/parser/src/parTranslater.c | 6 +- source/libs/scalar/src/sclfunc.c | 8 ++ source/libs/tdb/src/inc/tdbUtil.h | 2 +- source/util/src/tbuffer.c | 4 +- source/util/src/tcompression.c | 2 +- source/util/src/tencode.c | 2 +- tests/script/api/batchprepare.c | 4 +- tests/script/sh/abs_max.c | 4 +- tests/script/sh/demo.c | 2 +- tests/script/sh/deploy.bat | 49 +++------ tests/script/sh/exec.bat | 22 +++++ tests/script/sh/sum_double.c | 2 +- tests/script/tsim/db/alter_option.sim | 12 ++- tests/script/tsim/db/create_all_options.sim | 12 ++- tests/script/tsim/trans/create_db.sim | 99 ++++++++++--------- tests/script/wtest.bat | 1 + tests/tsim/src/simExe.c | 16 ++- 27 files changed, 174 insertions(+), 129 deletions(-) diff --git a/include/os/osTime.h b/include/os/osTime.h index 949c15ed0d..965ec61671 100644 --- a/include/os/osTime.h +++ b/include/os/osTime.h @@ -38,7 +38,7 @@ extern "C" { #define MILLISECOND_PER_SECOND (1000i64) #else -#define MILLISECOND_PER_SECOND ((int64_t)1000L) +#define MILLISECOND_PER_SECOND ((int64_t)1000LL) #endif #define MILLISECOND_PER_MINUTE (MILLISECOND_PER_SECOND * 60) @@ -46,9 +46,9 @@ extern "C" { #define MILLISECOND_PER_DAY (MILLISECOND_PER_HOUR * 24) #define MILLISECOND_PER_WEEK (MILLISECOND_PER_DAY * 7) -#define NANOSECOND_PER_USEC (1000L) -#define NANOSECOND_PER_MSEC (1000000L) -#define NANOSECOND_PER_SEC (1000000000L) +#define NANOSECOND_PER_USEC (1000LL) +#define NANOSECOND_PER_MSEC (1000000LL) +#define NANOSECOND_PER_SEC (1000000000LL) #define NANOSECOND_PER_MINUTE (NANOSECOND_PER_SEC * 60) #define NANOSECOND_PER_HOUR (NANOSECOND_PER_MINUTE * 60) #define NANOSECOND_PER_DAY (NANOSECOND_PER_HOUR * 24) @@ -65,21 +65,21 @@ int32_t taosGetTimestampSec(); static FORCE_INLINE int64_t taosGetTimestampMs() { struct timeval systemTime; taosGetTimeOfDay(&systemTime); - return (int64_t)systemTime.tv_sec * 1000L + (int64_t)systemTime.tv_usec / 1000; + return (int64_t)systemTime.tv_sec * 1000LL + (int64_t)systemTime.tv_usec / 1000; } //@return timestamp in microsecond static FORCE_INLINE int64_t taosGetTimestampUs() { struct timeval systemTime; taosGetTimeOfDay(&systemTime); - return (int64_t)systemTime.tv_sec * 1000000L + (int64_t)systemTime.tv_usec; + return (int64_t)systemTime.tv_sec * 1000000LL + (int64_t)systemTime.tv_usec; } //@return timestamp in nanosecond static FORCE_INLINE int64_t taosGetTimestampNs() { struct timespec systemTime = {0}; taosClockGetTime(CLOCK_REALTIME, &systemTime); - return (int64_t)systemTime.tv_sec * 1000000000L + (int64_t)systemTime.tv_nsec; + return (int64_t)systemTime.tv_sec * 1000000000LL + (int64_t)systemTime.tv_nsec; } char * taosStrpTime(const char *buf, const char *fmt, struct tm *tm); diff --git a/include/util/tdef.h b/include/util/tdef.h index c5a8b95a08..5304dba741 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -49,12 +49,12 @@ extern const int32_t TYPE_BYTES[16]; #define TSDB_DATA_BOOL_NULL 0x02 #define TSDB_DATA_TINYINT_NULL 0x80 #define TSDB_DATA_SMALLINT_NULL 0x8000 -#define TSDB_DATA_INT_NULL 0x80000000L -#define TSDB_DATA_BIGINT_NULL 0x8000000000000000L +#define TSDB_DATA_INT_NULL 0x80000000LL +#define TSDB_DATA_BIGINT_NULL 0x8000000000000000LL #define TSDB_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL #define TSDB_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN -#define TSDB_DATA_DOUBLE_NULL 0x7FFFFF0000000000L // an NAN +#define TSDB_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN #define TSDB_DATA_NCHAR_NULL 0xFFFFFFFF #define TSDB_DATA_BINARY_NULL 0xFF @@ -108,8 +108,8 @@ extern const int32_t TYPE_BYTES[16]; #define TSDB_INS_USER_STABLES_DBNAME_COLID 2 #define TSDB_TICK_PER_SECOND(precision) \ - ((int64_t)((precision) == TSDB_TIME_PRECISION_MILLI ? 1e3L \ - : ((precision) == TSDB_TIME_PRECISION_MICRO ? 1e6L : 1e9L))) + ((int64_t)((precision) == TSDB_TIME_PRECISION_MILLI ? 1000LL \ + : ((precision) == TSDB_TIME_PRECISION_MICRO ? 1000000LL : 1000000000LL))) #define T_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #define T_APPEND_MEMBER(dst, ptr, type, member) \ diff --git a/include/util/tpagedbuf.h b/include/util/tpagedbuf.h index af82e29ec5..ef266068cb 100644 --- a/include/util/tpagedbuf.h +++ b/include/util/tpagedbuf.h @@ -28,7 +28,7 @@ typedef struct SArray* SIDList; typedef struct SPageInfo SPageInfo; typedef struct SDiskbasedBuf SDiskbasedBuf; -#define DEFAULT_INTERN_BUF_PAGE_SIZE (1024L) // in bytes +#define DEFAULT_INTERN_BUF_PAGE_SIZE (1024LL) // in bytes typedef struct SFilePage { int32_t num; diff --git a/include/util/types.h b/include/util/types.h index d48995418e..ded9dc37d7 100644 --- a/include/util/types.h +++ b/include/util/types.h @@ -32,7 +32,7 @@ extern "C" { #define GET_UINT64_VAL(x) (*(uint64_t *)(x)) static FORCE_INLINE float taos_align_get_float(const char *pBuf) { -#if __STDC_VERSION__ >= 201112L +#if __STDC_VERSION__ >= 201112LL static_assert(sizeof(float) == sizeof(uint32_t), "sizeof(float) must equal to sizeof(uint32_t)"); #else assert(sizeof(float) == sizeof(uint32_t)); @@ -43,7 +43,7 @@ static FORCE_INLINE float taos_align_get_float(const char *pBuf) { } static FORCE_INLINE double taos_align_get_double(const char *pBuf) { -#if __STDC_VERSION__ >= 201112L +#if __STDC_VERSION__ >= 201112LL static_assert(sizeof(double) == sizeof(uint64_t), "sizeof(double) must equal to sizeof(uint64_t)"); #else assert(sizeof(double) == sizeof(uint64_t)); diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index ce73246e51..19d7c2b03d 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -1066,11 +1066,11 @@ static int32_t getFileIdFromKey(TSKEY key, int32_t daysPerFile, int32_t precisio } int64_t fid = (int64_t)(key / (daysPerFile * tsTickPerMin[precision])); // set the starting fileId - if (fid < 0L && llabs(fid) > INT32_MAX) { // data value overflow for INT32 + if (fid < 0LL && llabs(fid) > INT32_MAX) { // data value overflow for INT32 fid = INT32_MIN; } - if (fid > 0L && fid > INT32_MAX) { + if (fid > 0LL && fid > INT32_MAX) { fid = INT32_MAX; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index e797508ec0..734c6bfbfb 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -112,12 +112,12 @@ static void getNextTimeWindow(SInterval* pInterval, STimeWindow* tw, int32_t ord int mon = (int)(tm.tm_year * 12 + tm.tm_mon + interval * factor); tm.tm_year = mon / 12; tm.tm_mon = mon % 12; - tw->skey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000L, TSDB_TIME_PRECISION_MILLI, pInterval->precision); + tw->skey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000LL, TSDB_TIME_PRECISION_MILLI, pInterval->precision); mon = (int)(mon + interval); tm.tm_year = mon / 12; tm.tm_mon = mon % 12; - tw->ekey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000L, TSDB_TIME_PRECISION_MILLI, pInterval->precision); + tw->ekey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000LL, TSDB_TIME_PRECISION_MILLI, pInterval->precision); tw->ekey -= 1; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index ad72fd26af..b574476480 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -314,12 +314,12 @@ static void getNextTimeWindow(SInterval* pInterval, int32_t precision, int32_t o int mon = (int)(tm.tm_year * 12 + tm.tm_mon + interval * factor); tm.tm_year = mon / 12; tm.tm_mon = mon % 12; - tw->skey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000L, TSDB_TIME_PRECISION_MILLI, precision); + tw->skey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000LL, TSDB_TIME_PRECISION_MILLI, precision); mon = (int)(mon + interval); tm.tm_year = mon / 12; tm.tm_mon = mon % 12; - tw->ekey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000L, TSDB_TIME_PRECISION_MILLI, precision); + tw->ekey = convertTimePrecision((int64_t)taosMktime(&tm) * 1000LL, TSDB_TIME_PRECISION_MILLI, precision); tw->ekey -= 1; } diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index f6ae027e48..5587a39758 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -467,7 +467,7 @@ int32_t getUdfdPipeName(char* pipeName, int32_t size) { dnodeId[0] = '1'; } #ifdef _WIN32 - snprintf(pipeName, size, "%s%s", UDF_LISTEN_PIPE_NAME_PREFIX, dnodeId); + snprintf(pipeName, size, "%s.%x.%x.%s", UDF_LISTEN_PIPE_NAME_PREFIX,MurmurHash3_32(tsDataDir, strlen(tsDataDir)),taosGetSelfPthreadId(), dnodeId); #else snprintf(pipeName, size, "%s/%s%s", tsDataDir, UDF_LISTEN_PIPE_NAME_PREFIX, dnodeId); #endif diff --git a/source/libs/index/src/index.c b/source/libs/index/src/index.c index 04d7e04b30..d6d55c6be0 100644 --- a/source/libs/index/src/index.c +++ b/source/libs/index/src/index.c @@ -35,12 +35,12 @@ #define INDEX_DATA_BOOL_NULL 0x02 #define INDEX_DATA_TINYINT_NULL 0x80 #define INDEX_DATA_SMALLINT_NULL 0x8000 -#define INDEX_DATA_INT_NULL 0x80000000L -#define INDEX_DATA_BIGINT_NULL 0x8000000000000000L +#define INDEX_DATA_INT_NULL 0x80000000LL +#define INDEX_DATA_BIGINT_NULL 0x8000000000000000LL #define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL #define INDEX_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN -#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000L // an NAN +#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN #define INDEX_DATA_NCHAR_NULL 0xFFFFFFFF #define INDEX_DATA_BINARY_NULL 0xFF #define INDEX_DATA_JSON_NULL 0xFFFFFFFF diff --git a/source/libs/index/src/indexComm.c b/source/libs/index/src/indexComm.c index 99b49f97bd..383d47e9c1 100644 --- a/source/libs/index/src/indexComm.c +++ b/source/libs/index/src/indexComm.c @@ -25,12 +25,12 @@ #define INDEX_DATA_BOOL_NULL 0x02 #define INDEX_DATA_TINYINT_NULL 0x80 #define INDEX_DATA_SMALLINT_NULL 0x8000 -#define INDEX_DATA_INT_NULL 0x80000000L -#define INDEX_DATA_BIGINT_NULL 0x8000000000000000L +#define INDEX_DATA_INT_NULL 0x80000000LL +#define INDEX_DATA_BIGINT_NULL 0x8000000000000000LL #define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL #define INDEX_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN -#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000L // an NAN +#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN #define INDEX_DATA_NCHAR_NULL 0xFFFFFFFF #define INDEX_DATA_BINARY_NULL 0xFF #define INDEX_DATA_JSON_NULL 0xFFFFFFFF diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index fa0a66820f..fa6798a366 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2005,9 +2005,9 @@ static int32_t checkFill(STranslateContext* pCxt, SFillNode* pFill, SValueNode* if (TIME_IS_VAR_DURATION(pInterval->unit)) { int64_t f = 1; if (pInterval->unit == 'n') { - f = 30L * MILLISECOND_PER_DAY; + f = 30LL * MILLISECOND_PER_DAY; } else if (pInterval->unit == 'y') { - f = 365L * MILLISECOND_PER_DAY; + f = 365LL * MILLISECOND_PER_DAY; } intervalRange = pInterval->datum.i * f; } else { @@ -2666,7 +2666,7 @@ static int64_t getUnitPerMinute(uint8_t precision) { case TSDB_TIME_PRECISION_MILLI: return MILLISECOND_PER_MINUTE; case TSDB_TIME_PRECISION_MICRO: - return MILLISECOND_PER_MINUTE * 1000L; + return MILLISECOND_PER_MINUTE * 1000LL; case TSDB_TIME_PRECISION_NANO: return NANOSECOND_PER_MINUTE; default: diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 2369779105..d335b04ea4 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1415,11 +1415,19 @@ int32_t roundFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOut } int32_t lowerFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { +#ifdef WINDOWS + return doCaseConvFunction(pInput, inputNum, pOutput, towlower); +#else return doCaseConvFunction(pInput, inputNum, pOutput, tolower); +#endif } int32_t upperFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { +#ifdef WINDOWS + return doCaseConvFunction(pInput, inputNum, pOutput, towupper); +#else return doCaseConvFunction(pInput, inputNum, pOutput, toupper); +#endif } int32_t ltrimFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { diff --git a/source/libs/tdb/src/inc/tdbUtil.h b/source/libs/tdb/src/inc/tdbUtil.h index c518e8efcc..fe97f9c986 100644 --- a/source/libs/tdb/src/inc/tdbUtil.h +++ b/source/libs/tdb/src/inc/tdbUtil.h @@ -20,7 +20,7 @@ extern "C" { #endif -#if __STDC_VERSION__ >= 201112L +#if __STDC_VERSION__ >= 201112LL #define TDB_STATIC_ASSERT(op, info) static_assert(op, info) #else #define TDB_STATIC_ASSERT(op, info) diff --git a/source/util/src/tbuffer.c b/source/util/src/tbuffer.c index 8552ccac2c..d2fac72c77 100644 --- a/source/util/src/tbuffer.c +++ b/source/util/src/tbuffer.c @@ -21,7 +21,7 @@ typedef union Un4B { uint32_t ui; float f; } Un4B; -#if __STDC_VERSION__ >= 201112L +#if __STDC_VERSION__ >= 201112LL static_assert(sizeof(Un4B) == sizeof(uint32_t), "sizeof(Un4B) must equal to sizeof(uint32_t)"); static_assert(sizeof(Un4B) == sizeof(float), "sizeof(Un4B) must equal to sizeof(float)"); #endif @@ -30,7 +30,7 @@ typedef union Un8B { uint64_t ull; double d; } Un8B; -#if __STDC_VERSION__ >= 201112L +#if __STDC_VERSION__ >= 201112LL static_assert(sizeof(Un8B) == sizeof(uint64_t), "sizeof(Un8B) must equal to sizeof(uint64_t)"); static_assert(sizeof(Un8B) == sizeof(double), "sizeof(Un8B) must equal to sizeof(double)"); #endif diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 041aec4054..38613a77e6 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -58,7 +58,7 @@ static const int32_t TEST_NUMBER = 1; #define is_bigendian() ((*(char *)&TEST_NUMBER) == 0) -#define SIMPLE8B_MAX_INT64 ((uint64_t)2305843009213693951L) +#define SIMPLE8B_MAX_INT64 ((uint64_t)2305843009213693951LL) #define safeInt64Add(a, b) (((a >= 0) && (b <= INT64_MAX - a)) || ((a < 0) && (b >= INT64_MIN - a))) #define ZIGZAG_ENCODE(T, v) ((u##T)((v) >> (sizeof(T) * 8 - 1))) ^ (((u##T)(v)) << 1) // zigzag encode diff --git a/source/util/src/tencode.c b/source/util/src/tencode.c index 185daf9e45..2267c90783 100644 --- a/source/util/src/tencode.c +++ b/source/util/src/tencode.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "tencode.h" -#if __STDC_VERSION__ >= 201112L +#if __STDC_VERSION__ >= 201112LL static_assert(sizeof(float) == sizeof(uint32_t), "sizeof(float) must equal to sizeof(uint32_t)"); static_assert(sizeof(double) == sizeof(uint64_t), "sizeof(double) must equal to sizeof(uint64_t)"); #endif diff --git a/tests/script/api/batchprepare.c b/tests/script/api/batchprepare.c index 7dd7621d0b..0e7030b230 100644 --- a/tests/script/api/batchprepare.c +++ b/tests/script/api/batchprepare.c @@ -353,13 +353,13 @@ void taosMemoryFree(const void *ptr) { static int64_t taosGetTimestampMs() { struct timeval systemTime; taosGetTimeOfDay(&systemTime); - return (int64_t)systemTime.tv_sec * 1000L + (int64_t)systemTime.tv_usec/1000; + return (int64_t)systemTime.tv_sec * 1000LL + (int64_t)systemTime.tv_usec/1000; } static int64_t taosGetTimestampUs() { struct timeval systemTime; taosGetTimeOfDay(&systemTime); - return (int64_t)systemTime.tv_sec * 1000000L + (int64_t)systemTime.tv_usec; + return (int64_t)systemTime.tv_sec * 1000000LL + (int64_t)systemTime.tv_usec; } bool colExists(TAOS_MULTI_BIND* pBind, int32_t dataType) { diff --git a/tests/script/sh/abs_max.c b/tests/script/sh/abs_max.c index cd8ba0ff15..d623adacf9 100644 --- a/tests/script/sh/abs_max.c +++ b/tests/script/sh/abs_max.c @@ -11,8 +11,8 @@ typedef struct SUdfInit{ } SUdfInit; -#define TSDB_DATA_INT_NULL 0x80000000L -#define TSDB_DATA_BIGINT_NULL 0x8000000000000000L +#define TSDB_DATA_INT_NULL 0x80000000LL +#define TSDB_DATA_BIGINT_NULL 0x8000000000000000LL void abs_max(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput, int* numOfOutput, short otype, short obytes, SUdfInit* buf) { diff --git a/tests/script/sh/demo.c b/tests/script/sh/demo.c index 23d2174448..2a862c0464 100644 --- a/tests/script/sh/demo.c +++ b/tests/script/sh/demo.c @@ -17,7 +17,7 @@ typedef struct SDemo{ }SDemo; #define FLOAT_NULL 0x7FF00000 // it is an NAN -#define DOUBLE_NULL 0x7FFFFF0000000000L // it is an NAN +#define DOUBLE_NULL 0x7FFFFF0000000000LL // it is an NAN void demo(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput, diff --git a/tests/script/sh/deploy.bat b/tests/script/sh/deploy.bat index 921f1611fb..f0d8c10b7e 100644 --- a/tests/script/sh/deploy.bat +++ b/tests/script/sh/deploy.bat @@ -59,48 +59,29 @@ for /f "skip=1" %%A in ( 'wmic computersystem get caption' ) do if not defined fqdn set "fqdn=%%A" -echo firstEp %fqdn%:7100 > %TAOS_CFG% +echo firstEp %fqdn%:7100 >> %TAOS_CFG% +echo secondEp %fqdn%:7200 >> %TAOS_CFG% echo fqdn %fqdn% >> %TAOS_CFG% echo serverPort %NODE% >> %TAOS_CFG% +echo supportVnodes 128 >> %TAOS_CFG% echo dataDir %DATA_DIR% >> %TAOS_CFG% echo logDir %LOG_DIR% >> %TAOS_CFG% echo debugFlag 0 >> %TAOS_CFG% -echo mDebugFlag 135 >> %TAOS_CFG% -echo sdbDebugFlag 135 >> %TAOS_CFG% -echo dDebugFlag 135 >> %TAOS_CFG% -echo vDebugFlag 135 >> %TAOS_CFG% -echo tsdbDebugFlag 135 >> %TAOS_CFG% -echo cDebugFlag 135 >> %TAOS_CFG% -echo jnidebugFlag 135 >> %TAOS_CFG% -echo odbcdebugFlag 135 >> %TAOS_CFG% -echo httpDebugFlag 135 >> %TAOS_CFG% -echo monDebugFlag 135 >> %TAOS_CFG% -echo mqttDebugFlag 135 >> %TAOS_CFG% -echo qdebugFlag 135 >> %TAOS_CFG% -echo rpcDebugFlag 135 >> %TAOS_CFG% +echo mDebugFlag 143 >> %TAOS_CFG% +echo dDebugFlag 143 >> %TAOS_CFG% +echo vDebugFlag 143 >> %TAOS_CFG% +echo tqDebugFlag 143 >> %TAOS_CFG% +echo tsdbDebugFlag 143 >> %TAOS_CFG% +echo cDebugFlag 143 >> %TAOS_CFG% +echo jniDebugFlag 143 >> %TAOS_CFG% +echo qDebugFlag 143 >> %TAOS_CFG% +echo rpcDebugFlag 143 >> %TAOS_CFG% echo tmrDebugFlag 131 >> %TAOS_CFG% -echo udebugFlag 135 >> %TAOS_CFG% -echo sdebugFlag 135 >> %TAOS_CFG% -echo wdebugFlag 135 >> %TAOS_CFG% -echo cqdebugFlag 135 >> %TAOS_CFG% -echo monitor 0 >> %TAOS_CFG% -echo monitorInterval 1 >> %TAOS_CFG% -echo http 0 >> %TAOS_CFG% -echo slaveQuery 0 >> %TAOS_CFG% -echo numOfThreadsPerCore 2.0 >> %TAOS_CFG% -echo defaultPass taosdata >> %TAOS_CFG% +echo uDebugFlag 143 >> %TAOS_CFG% +echo sDebugFlag 143 >> %TAOS_CFG% +echo wDebugFlag 143 >> %TAOS_CFG% echo numOfLogLines 20000000 >> %TAOS_CFG% -echo mnodeEqualVnodeNum 0 >> %TAOS_CFG% -echo balanceInterval 1 >> %TAOS_CFG% -echo clog 2 >> %TAOS_CFG% -echo days 10 >> %TAOS_CFG% echo statusInterval 1 >> %TAOS_CFG% -echo maxVgroupsPerDb 4 >> %TAOS_CFG% -echo minTablesPerVnode 4 >> %TAOS_CFG% -echo maxTablesPerVnode 1000 >> %TAOS_CFG% -echo tableIncStepPerVnode 10000 >> %TAOS_CFG% echo asyncLog 0 >> %TAOS_CFG% -echo numOfMnodes 1 >> %TAOS_CFG% echo locale en_US.UTF-8 >> %TAOS_CFG% -echo fsync 0 >> %TAOS_CFG% echo telemetryReporting 0 >> %TAOS_CFG% diff --git a/tests/script/sh/exec.bat b/tests/script/sh/exec.bat index 6651c7aa8f..7a2c58fc66 100644 --- a/tests/script/sh/exec.bat +++ b/tests/script/sh/exec.bat @@ -30,9 +30,28 @@ rem echo CFG_DIR: %CFG_DIR% set TAOS_CFG=%CFG_DIR%taos.cfg rem echo TAOS_CFG: %TAOS_CFG% +set LOG_DIR=%NODE_DIR%log\ +rem echo LOG_DIR: %LOG_DIR% + +set TAOS_LOG=%LOG_DIR%taosdlog.0 +rem echo TAOS_LOG: %TAOS_LOG% + if %EXEC_OPTON% == start ( + rm -rf %TAOS_LOG% echo start %TAOSD% -c %CFG_DIR% start %TAOSD% -c %CFG_DIR% + set /a check_num=0 +:check_online + sleep 1 + set /a check_num=check_num+1 + if "%check_num%" == "11" ( + echo check online out time. + goto :finish + ) + echo check taosd online + tail -n +0 %TAOS_LOG% | grep -q "TDengine initialized successfully" || goto :check_online + echo finish + goto :finish ) if %EXEC_OPTON% == stop ( @@ -44,5 +63,8 @@ if %EXEC_OPTON% == stop ( ) do ( rem echo taskkill /IM %%A taskkill /IM %%A > NUL 2>&1 + goto :finish ) ) + +:finish \ No newline at end of file diff --git a/tests/script/sh/sum_double.c b/tests/script/sh/sum_double.c index 0297920361..d6eea5d291 100644 --- a/tests/script/sh/sum_double.c +++ b/tests/script/sh/sum_double.c @@ -10,7 +10,7 @@ typedef struct SUdfInit{ int const_item; /* 0 if result is independent of arguments */ } SUdfInit; -#define TSDB_DATA_INT_NULL 0x80000000L +#define TSDB_DATA_INT_NULL 0x80000000LL void sum_double(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput, diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index fede960a6a..f24e32279d 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -43,8 +43,16 @@ print ===> $data20 $data21 $data22 $data23 $data24 $data25 if $data00 != 1 then return -1 endi -if $data01 != localhost:7100 then - return -1 +system_content printf %OS% +if $system_content == Windows_NT then + system_content printf %COMPUTERNAME%:7100 + if $data01 != $system_content then + return -1 + endi +else + if $data01 != localhost:7100 then + return -1 + endi endi if $data04 != ready then goto check_dnode_ready_1 diff --git a/tests/script/tsim/db/create_all_options.sim b/tests/script/tsim/db/create_all_options.sim index efe7ff99cf..3979ef1ec1 100644 --- a/tests/script/tsim/db/create_all_options.sim +++ b/tests/script/tsim/db/create_all_options.sim @@ -43,8 +43,16 @@ print ===> $data20 $data21 $data22 $data23 $data24 $data25 if $data00 != 1 then return -1 endi -if $data01 != localhost:7100 then - return -1 +system_content printf %OS% +if $system_content == Windows_NT then + system_content printf %COMPUTERNAME%:7100 + if $data01 != $system_content then + return -1 + endi +else + if $data01 != localhost:7100 then + return -1 + endi endi if $data04 != ready then goto check_dnode_ready_1 diff --git a/tests/script/tsim/trans/create_db.sim b/tests/script/tsim/trans/create_db.sim index f730f2fb67..d4d158ede0 100644 --- a/tests/script/tsim/trans/create_db.sim +++ b/tests/script/tsim/trans/create_db.sim @@ -96,50 +96,53 @@ sql_error create database d1 vgroups 2; print =============== kill dnode2 system sh/exec.sh -n dnode2 -s stop -x SIGINT -print =============== create database -sql show transactions -if $rows != 0 then - return -1 -endi +system_content printf %OS% +if $system_content != Windows_NT then + print =============== create database + sql show transactions + if $rows != 0 then + return -1 + endi -sql_error create database d2 vgroups 2; + sql_error create database d2 vgroups 2; -print =============== show transactions -sql show transactions -if $rows != 1 then - return -1 -endi + print =============== show transactions + sql show transactions + if $rows != 1 then + return -1 + endi -if $data[0][0] != 8 then - return -1 -endi + if $data[0][0] != 8 then + return -1 + endi -if $data[0][2] != redoAction then - return -1 -endi + if $data[0][2] != redoAction then + return -1 + endi -if $data[0][3] != d2 then - return -1 -endi + if $data[0][3] != d2 then + return -1 + endi -sql show databases ; -if $rows != 4 then - return -1 -endi -print d2 ==> $data(d2)[19] -if $data(d2)[19] != creating then - return -1 -endi + sql show databases ; + if $rows != 4 then + return -1 + endi + print d2 ==> $data(d2)[19] + if $data(d2)[19] != creating then + return -1 + endi -sql_error create database d2 vgroups 2; + sql_error create database d2 vgroups 2; -print =============== kill transaction -sql kill transaction 8; -sleep 2000 + print =============== kill transaction + sql kill transaction 8; + sleep 2000 -sql show transactions -if $rows != 0 then - return -1 + sql show transactions + if $rows != 0 then + return -1 + endi endi print =============== start dnode2 @@ -153,25 +156,25 @@ step3: print ====> dnode not ready! return -1 endi -sql show dnodes -print ===> $data00 $data01 $data02 $data03 $data04 $data05 -print ===> $data10 $data11 $data12 $data13 $data14 $data15 -if $rows != 2 then - return -1 -endi -if $data(1)[4] != ready then - goto step3 -endi -if $data(2)[4] != ready then - goto step3 -endi + sql show dnodes + print ===> $data00 $data01 $data02 $data03 $data04 $data05 + print ===> $data10 $data11 $data12 $data13 $data14 $data15 + if $rows != 2 then + return -1 + endi + if $data(1)[4] != ready then + goto step3 + endi + if $data(2)[4] != ready then + goto step3 + endi sql show transactions if $rows != 0 then return -1 endi -sql drop database d2; +sql drop database if exists d2; sql show transactions if $rows != 0 then diff --git a/tests/script/wtest.bat b/tests/script/wtest.bat index 9ed58a90d1..1aa27202c6 100644 --- a/tests/script/wtest.bat +++ b/tests/script/wtest.bat @@ -52,6 +52,7 @@ echo wal 0 >> %TAOS_CFG% echo asyncLog 0 >> %TAOS_CFG% echo locale en_US.UTF-8 >> %TAOS_CFG% echo enableCoreFile 1 >> %TAOS_CFG% +echo charset cp65001 >> %TAOS_CFG% set "FILE_NAME=testSuite.sim" if "%1" == "-f" set "FILE_NAME=%2" diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index f97a13d2c5..aaad76bb53 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -39,13 +39,26 @@ void simLogSql(char *sql, bool useSharp) { char *simParseArbitratorName(char *varName) { static char hostName[140]; +#ifdef WINDOWS + taosGetFqdn(hostName); + sprintf(&hostName[strlen(hostName)], ":%d", 8000); +#else sprintf(hostName, "%s:%d", "localhost", 8000); +#endif return hostName; } char *simParseHostName(char *varName) { static char hostName[140]; +#ifdef WINDOWS + hostName[0] = '\"'; + taosGetFqdn(&hostName[1]); + int strEndIndex = strlen(hostName); + hostName[strEndIndex] = '\"'; + hostName[strEndIndex + 1] = '\0'; +#else sprintf(hostName, "%s", "localhost"); +#endif return hostName; } @@ -399,7 +412,8 @@ bool simExecuteSystemCmd(SScript *script, char *option) { sprintf(buf, "cd %s; ", simScriptDir); simVisuallizeOption(script, option, buf + strlen(buf)); #else - sprintf(buf, "%s%s", simScriptDir, option); + sprintf(buf, "%s", simScriptDir); + simVisuallizeOption(script, option, buf + strlen(buf)); simReplaceStr(buf, ".sh", ".bat"); #endif