Skip to content

Commit

Permalink
fix: windows test (taosdata#20256)
Browse files Browse the repository at this point in the history
* fix: windows sim test

* fix: windows sim test

* fix: random on windows

* fix: taosd online check

* fix: windows path in python test

* fix: windows python test

* fix: windows python test

* fix: windows python test

* fix: windows python test

* fix: windows python test

* fix: windows python test

* fix: windows python test

* fix: windows python test

* fix: windows python test

* fix: make_install.bat

* fix: python test

* fix: jdbc test

* fix: develop test

* fix: develop test

* fix:add log

* test:add win case file

* test:add win case file

* test:add win case file

* fix: python test get taosBenchmark path

* test:add win case file

* test:comment some failed cases in win

* test:add win case file

* test:add win case file

* test:comment some win case file

* test:add some win case file

---------

Co-authored-by: wangmm0220 <[email protected]>
Co-authored-by: chenhaoran <[email protected]>
  • Loading branch information
3 people authored Mar 16, 2023
1 parent d270f1b commit 449f711
Show file tree
Hide file tree
Showing 57 changed files with 1,744 additions and 327 deletions.
15 changes: 12 additions & 3 deletions packaging/tools/make_install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,18 @@ call :stop_delete
call :check_svc taosd
call :check_svc taosadapter

copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul
if exist C:\\TDengine\\driver\\taosws.dll (
copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul
if exist c:\\windows\\sysnative (
echo x86
copy /y C:\\TDengine\\driver\\taos.dll %windir%\\sysnative > nul
if exist C:\\TDengine\\driver\\taosws.dll (
copy /y C:\\TDengine\\driver\\taosws.dll %windir%\\sysnative > nul
)
) else (
echo x64
copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul
if exist C:\\TDengine\\driver\\taosws.dll (
copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul
)
)

rem // create services
Expand Down
2 changes: 1 addition & 1 deletion source/os/src/osMath.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int32_t qsortHelper(const void* p1, const void* p2, const void* param) {

// todo refactor: 1) move away; 2) use merge sort instead; 3) qsort is not a stable sort actually.
void taosSort(void* base, int64_t sz, int64_t width, __compar_fn_t compar) {
#ifdef _ALPINE
#if defined(WINDOWS) || defined(_ALPINE)
void* param = compar;
taosqsort(base, sz, width, param, qsortHelper);
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor())

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
2 changes: 2 additions & 0 deletions tests/develop-test/5-taos-tools/taosbenchmark/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
18 changes: 8 additions & 10 deletions tests/develop-test/5-taos-tools/taosbenchmark/default_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,23 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if "community" in selfPath:
projPath = selfPath[: selfPath.find("community")]
elif "src" in selfPath:
projPath = selfPath[: selfPath.find("src")]
elif "/tools/" in selfPath:
projPath = selfPath[: selfPath.find("/tools/")]
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[: selfPath.find("tests")]
projPath = selfPath[:selfPath.find("tests")]

paths = []
for root, dirs, files in os.walk(projPath):
if (tool) in files:
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if "packaging" not in rootRealPath:
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if len(paths) == 0:
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
Expand Down
2 changes: 2 additions & 0 deletions tests/develop-test/5-taos-tools/taosbenchmark/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if "community" in selfPath:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
2 changes: 2 additions & 0 deletions tests/develop-test/5-taos-tools/taosbenchmark/json_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
2 changes: 2 additions & 0 deletions tests/develop-test/5-taos-tools/taosbenchmark/query_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
23 changes: 9 additions & 14 deletions tests/develop-test/5-taos-tools/taosbenchmark/sml_json_alltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,23 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if "community" in selfPath:
projPath = selfPath[: selfPath.find("community")]
elif "src" in selfPath:
projPath = selfPath[: selfPath.find("src")]
elif "/tools/" in selfPath:
projPath = selfPath[: selfPath.find("/tools/")]
elif "/tests/" in selfPath:
projPath = selfPath[: selfPath.find("/tests/")]
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath))
projPath = "/usr/local/taos/bin/"
projPath = selfPath[:selfPath.find("tests")]

paths = []
for root, dummy, files in os.walk(projPath):
if (tool) in files:
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if "packaging" not in rootRealPath:
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if len(paths) == 0:
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,28 @@ def init(self, conn, logSql, replicaVarl=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if "community" in selfPath:
projPath = selfPath[: selfPath.find("community")]
elif "src" in selfPath:
projPath = selfPath[: selfPath.find("src")]
elif "/tools/" in selfPath:
projPath = selfPath[: selfPath.find("/tools/")]
elif "/tests/" in selfPath:
projPath = selfPath[: selfPath.find("/tests/")]
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath))
projPath = "/usr/local/taos/bin/"
projPath = selfPath[:selfPath.find("tests")]

paths = []
for root, dirs, files in os.walk(projPath):
if (tool) in files:
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if "packaging" not in rootRealPath:
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if len(paths) == 0:
return ""
return paths[0]
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]

# 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。
def assertfileDataTaosc(self, filename, expectResult):
Expand Down
20 changes: 8 additions & 12 deletions tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,23 @@ def init(self, conn, logSql, replicaVar=1):
tdSql.init(conn.cursor(), logSql)

def getPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if "community" in selfPath:
projPath = selfPath[: selfPath.find("community")]
elif "src" in selfPath:
projPath = selfPath[: selfPath.find("src")]
elif "/tools/" in selfPath:
projPath = selfPath[: selfPath.find("/tools/")]
elif "/tests/" in selfPath:
projPath = selfPath[: selfPath.find("/tests/")]
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
tdLog.exit("cannot found %s in path: %s, use system's" % (tool, selfPath))
projPath = selfPath[:selfPath.find("tests")]

paths = []
for root, dirs, files in os.walk(projPath):
if (tool) in files:
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if "packaging" not in rootRealPath:
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if len(paths) == 0:
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
Expand Down
30 changes: 14 additions & 16 deletions tests/develop-test/5-taos-tools/taosdump/taosdumpTestInspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,28 @@ def init(self, conn, logSql, replicaVar=1):
self.tmpdir = "tmp"

def getPath(self, tool="taosdump"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))

if "community" in selfPath:
projPath = selfPath[: selfPath.find("community")]
elif "src" in selfPath:
projPath = selfPath[: selfPath.find("src")]
elif "/tools/" in selfPath:
projPath = selfPath[: selfPath.find("/tools/")]
elif "/tests/" in selfPath:
projPath = selfPath[: selfPath.find("/tests/")]
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath))
projPath = "/usr/local/taos/bin"
projPath = selfPath[:selfPath.find("tests")]

paths = []
for root, dummy, files in os.walk(projPath):
if (tool) in files:
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if "packaging" not in rootRealPath:
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if len(paths) == 0:
return ""
return paths[0]
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]

def run(self):
tdSql.prepare()
Expand Down
6 changes: 3 additions & 3 deletions tests/develop-test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ def checkRunTimeError():
print(r)
else:
pass
if restful:
tAdapter.init(deployPath, masterIp)
tAdapter.stop(force_kill=True)

tAdapter.init(deployPath, masterIp)
tAdapter.stop(force_kill=True)

if dnodeNums == 1:
tdDnodes.deploy(1, updateCfgDict)
Expand Down
13 changes: 13 additions & 0 deletions tests/develop-test/win-test-file
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
python3 ./test.py -f 2-query/table_count_scan.py
python3 ./test.py -f 2-query/show_create_db.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/insert_alltypes_json.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/invalid_commandline.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R
python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R
13 changes: 4 additions & 9 deletions tests/docs-examples-test/jdbc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ cd ../../docs/examples/java

mvn clean test > jdbc-out.log 2>&1
tail -n 20 jdbc-out.log

cases=`grep 'Tests run' jdbc-out.log | awk 'END{print $3}'`
totalJDBCCases=`echo ${cases/%,}`
failed=`grep 'Tests run' jdbc-out.log | awk 'END{print $5}'`
JDBCFailed=`echo ${failed/%,}`
error=`grep 'Tests run' jdbc-out.log | awk 'END{print $7}'`
JDBCError=`echo ${error/%,}`

totalJDBCFailed=`expr $JDBCFailed + $JDBCError`
totalJDBCCases=`grep 'Tests run' jdbc-out.log | awk -F"[:,]" 'END{ print $2 }'`
failed=`grep 'Tests run' jdbc-out.log | awk -F"[:,]" 'END{ print $4 }'`
error=`grep 'Tests run' jdbc-out.log | awk -F"[:,]" 'END{ print $6 }'`
totalJDBCFailed=`expr $failed + $error`
totalJDBCSuccess=`expr $totalJDBCCases - $totalJDBCFailed`

if [ "$totalJDBCSuccess" -gt "0" ]; then
Expand Down
Loading

0 comments on commit 449f711

Please sign in to comment.