Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
09c76fed
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
09c76fed
编写于
11月 17, 2022
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-20478: update coverage test script
上级
6aed8932
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
120 addition
and
132 deletion
+120
-132
tests/script/coverage_test.sh
tests/script/coverage_test.sh
+120
-132
未找到文件。
tests/script/coverage_test.sh
浏览文件 @
09c76fed
...
@@ -10,7 +10,8 @@ else
...
@@ -10,7 +10,8 @@ else
fi
fi
today
=
`
date
+
"%Y%m%d"
`
today
=
`
date
+
"%Y%m%d"
`
TDENGINE_DIR
=
/root/pxiao/TDengine
TDENGINE_DIR
=
/root/TDengine
JDBC_DIR
=
/root/taos-connector-jdbc
TDENGINE_COVERAGE_REPORT
=
$TDENGINE_DIR
/tests/coverage-report-
$today
.log
TDENGINE_COVERAGE_REPORT
=
$TDENGINE_DIR
/tests/coverage-report-
$today
.log
# Color setting
# Color setting
...
@@ -20,7 +21,7 @@ GREEN_DARK='\033[0;32m'
...
@@ -20,7 +21,7 @@ GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
NC
=
'\033[0m'
function
buildTDengine
{
function
buildTDengine
()
{
echo
"check if TDengine need build"
echo
"check if TDengine need build"
cd
$TDENGINE_DIR
cd
$TDENGINE_DIR
git remote prune origin
>
/dev/null
git remote prune origin
>
/dev/null
...
@@ -33,7 +34,6 @@ function buildTDengine {
...
@@ -33,7 +34,6 @@ function buildTDengine {
# reset counter
# reset counter
lcov
-d
.
--zerocounters
lcov
-d
.
--zerocounters
if
[
"
$LOCAL_COMMIT
"
==
"
$REMOTE_COMMIT
"
]
;
then
if
[
"
$LOCAL_COMMIT
"
==
"
$REMOTE_COMMIT
"
]
;
then
echo
"repo up-to-date"
echo
"repo up-to-date"
else
else
...
@@ -43,9 +43,9 @@ function buildTDengine {
...
@@ -43,9 +43,9 @@ function buildTDengine {
git reset
--hard
git reset
--hard
git checkout
--
.
git checkout
--
.
git checkout
$branch
git checkout
$branch
git checkout
--
.
git clean
-dfx
git clean
-dfx
git pull
git pull
git submodule update
--init
--recursive
-f
[
-d
$TDENGINE_DIR
/debug
]
||
mkdir
$TDENGINE_DIR
/debug
[
-d
$TDENGINE_DIR
/debug
]
||
mkdir
$TDENGINE_DIR
/debug
cd
$TDENGINE_DIR
/debug
cd
$TDENGINE_DIR
/debug
...
@@ -56,136 +56,123 @@ function buildTDengine {
...
@@ -56,136 +56,123 @@ function buildTDengine {
rm
-rf
*
rm
-rf
*
if
[
"
$branch
"
==
"3.0"
]
;
then
if
[
"
$branch
"
==
"3.0"
]
;
then
echo
"3.0 ============="
echo
"3.0 ============="
cmake
-DCOVER
=
true
-DBUILD_TEST
=
true
..
cmake
-DCOVER
=
true
-DBUILD_TEST
=
true
-DBUILD_HTTP
=
false
-DBUILD_TOOLS
=
true
..
else
else
cmake
-DCOVER
=
true
-DBUILD_TOOLS
=
true
-DBUILD_HTTP
=
false
..
>
/dev/null
cmake
-DCOVER
=
true
-DBUILD_TOOLS
=
true
-DBUILD_HTTP
=
false
..
>
/dev/null
fi
fi
make
-j
4
make
-j
make
install
make
install
}
}
function
runGeneralCaseOneByOne
{
function
runCasesOneByOne
()
{
while
read
-r
line
;
do
if
[[
$line
=
~ ^./test.sh
*
]]
;
then
case
=
`
echo
$line
|
grep
sim
$
|
awk
'{print $NF}'
`
if
[
-n
"
$case
"
]
;
then
date
+%F
\
%T
|
tee
-a
$TDENGINE_COVERAGE_REPORT
&&
./test.sh
-f
$case
>
/dev/null 2>&1
&&
\
echo
-e
"
${
GREEN
}
$case
success
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
\
||
echo
-e
"
${
RED
}
$case
failed
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
fi
fi
done
<
$1
}
function
runTestNGCaseOneByOne
{
while
read
-r
line
;
do
while
read
-r
line
;
do
if
[[
$line
=
~ ^taostest
*
]]
;
then
cmd
=
`
echo
$line
|
cut
-d
','
-f
5
`
case
=
`
echo
$line
|
cut
-d
' '
-f
3 |
cut
-d
'='
-f
2
`
if
[[
"
$2
"
==
"sim"
]]
&&
[[
$cmd
==
*
"test.sh"
*
]]
;
then
yaml
=
`
echo
$line
|
cut
-d
' '
-f
2
`
case
=
`
echo
$cmd
|
cut
-d
' '
-f
3
`
start_time
=
`
date
+%s
`
if
[
-n
"
$case
"
]
;
then
date
+%F
\
%T
|
tee
-a
$TDENGINE_COVERAGE_REPORT
&&
$cmd
>
/dev/null 2>&1
&&
\
date
+%F
\
%T
|
tee
-a
$TDENGINE_COVERAGE_REPORT
&&
taostest
$yaml
--case
=
$case
--keep
--disable_collection
>
/dev/null 2>&1
&&
\
echo
-e
"
${
GREEN
}
$case
success
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
\
echo
-e
"
${
GREEN
}
$case
success
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
\
||
echo
-e
"
${
RED
}
$case
failed
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
||
echo
-e
"
${
RED
}
$case
failed
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
fi
end_time
=
`
date
+%s
`
echo
execution
time
of
$case
was
`
expr
$end_time
-
$start_time
`
s.
|
tee
-a
$TDENGINE_COVERAGE_REPORT
elif
[[
"
$2
"
==
"system-test"
]]
&&
[[
$line
==
*
"system-test"
*
]]
;
then
case
=
`
echo
$cmd
|
cut
-d
' '
-f
4
`
start_time
=
`
date
+%s
`
date
+%F
\
%T
|
tee
-a
$TDENGINE_COVERAGE_REPORT
&&
$cmd
>
/dev/null 2>&1
&&
\
echo
-e
"
${
GREEN
}
$case
success
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
||
\
echo
-e
"
${
RED
}
$case
failed
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
end_time
=
`
date
+%s
`
echo
execution
time
of
$case
was
`
expr
$end_time
-
$start_time
`
s.
|
tee
-a
$TDENGINE_COVERAGE_REPORT
elif
[[
"
$2
"
==
"develop-test"
]]
&&
[[
$line
==
*
"develop-test"
*
]]
;
then
case
=
`
echo
$cmd
|
cut
-d
' '
-f
4
`
start_time
=
`
date
+%s
`
date
+%F
\
%T
|
tee
-a
$TDENGINE_COVERAGE_REPORT
&&
$cmd
>
/dev/null 2>&1
&&
\
echo
-e
"
${
GREEN
}
$case
success
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
||
\
echo
-e
"
${
RED
}
$case
failed
${
NC
}
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
end_time
=
`
date
+%s
`
echo
execution
time
of
$case
was
`
expr
$end_time
-
$start_time
`
s.
|
tee
-a
$TDENGINE_COVERAGE_REPORT
fi
fi
done
<
$1
done
<
$1
}
}
function
runTest
{
function
runUnitTest
(
)
{
echo
"run Test"
echo
"=== Run unit test case ==="
echo
"
$TDENGINE_DIR
/debug"
if
[
"
$branch
"
==
"3.0"
]
;
then
echo
"start run unit test case ................"
echo
"
$TDENGINE_DIR
/debug "
cd
$TDENGINE_DIR
/debug
cd
$TDENGINE_DIR
/debug
ctest
-j12
ctest
-j12
echo
"3.0 unit test done"
echo
"3.0 unit test done"
fi
}
function
runSimCases
()
{
echo
"=== Run sim cases ==="
cd
$TDENGINE_DIR
/tests/script
cd
$TDENGINE_DIR
/tests/script
runCasesOneByOne ../parallel_test/cases.task sim
[
-d
../../sim
]
&&
rm
-rf
../../sim
totalSuccess
=
`
grep
'sim success'
$TDENGINE_COVERAGE_REPORT
|
wc
-l
`
[
-f
$TDENGINE_COVERAGE_REPORT
]
&&
rm
$TDENGINE_COVERAGE_REPORT
if
[
"
$totalSuccess
"
-gt
"0"
]
;
then
echo
"### Total
$totalSuccess
SIM test case(s) succeed! ###"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
fi
totalFailed
=
`
grep
'sim failed\|fault'
$TDENGINE_COVERAGE_REPORT
|
wc
-l
`
if
[
"
$totalFailed
"
-ne
"0"
]
;
then
echo
"### Total
$totalFailed
SIM test case(s) failed! ###"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
fi
}
function
runPythonCases
()
{
echo
"=== Run python cases ==="
runGeneralCaseOneByOne jenkins/basic.txt
cd
$TDENGINE_DIR
/tests/system-test
runCasesOneByOne ../parallel_test/cases.task system-test
sed
-i
"1i
\S
IM cases test result"
$TDENGINE_COVERAGE_REPORT
cd
$TDENGINE_DIR
/tests/develop-test
runCasesOneByOne ../parallel_test/cases.task develop-test
totalSuccess
=
`
grep
'success'
$TDENGINE_COVERAGE_REPORT
|
wc
-l
`
totalSuccess
=
`
grep
'
py
success'
$TDENGINE_COVERAGE_REPORT
|
wc
-l
`
if
[
"
$totalSuccess
"
-gt
"0"
]
;
then
if
[
"
$totalSuccess
"
-gt
"0"
]
;
then
sed
-i
-e
"2i
\
### Total
$totalSuccess
SIM test case(s) succeed! ###"
$TDENGINE_COVERAGE_REPORT
echo
"### Total
$totalSuccess
python test case(s) succeed! ###"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
fi
fi
totalFailed
=
`
grep
'failed\|fault'
$TDENGINE_COVERAGE_REPORT
|
wc
-l
`
totalFailed
=
`
grep
'
py
failed\|fault'
$TDENGINE_COVERAGE_REPORT
|
wc
-l
`
if
[
"
$totalFailed
"
-ne
"0"
]
;
then
if
[
"
$totalFailed
"
-ne
"0"
]
;
then
sed
-i
"3i
\#
## Total
$totalFailed
SIM test case(s) failed! ###"
$TDENGINE_COVERAGE_REPORT
echo
"### Total
$totalFailed
python test case(s) failed! ###"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
fi
fi
sed
"3G"
$TDENGINE_COVERAGE_REPORT
}
stopTaosd
function
runJDBCCases
()
{
echo
"run TestNG cases"
echo
"=== Run JDBC cases ==="
rm
-rf
/var/lib/taos/
*
rm
-rf
/var/log/taos/
*
nohup
$TDENGINE_DIR
/debug/build/bin/taosd
-c
/etc/taos
>
/dev/null 2>&1 &
sleep
10
cd
$TDENGINE_DIR
/../TestNG/cases
runTestNGCaseOneByOne ../scripts/cases.txt
echo
"TestNG cases done"
cd
$TDENGINE_DIR
/tests
rm
-rf
../sim
/root/pxiao/test-all-coverage.sh full python
$branch
|
tee
-a
$TDENGINE_COVERAGE_REPORT
sed
-i
"4i
\P
ython cases test result"
$TDENGINE_COVERAGE_REPORT
totalPySuccess
=
`
grep
'python case(s) succeed!'
$TDENGINE_COVERAGE_REPORT
|
awk
'{print $4}'
`
if
[
"
$totalPySuccess
"
-gt
"0"
]
;
then
sed
-i
-e
"5i
\
### Total
$totalPySuccess
Python test case(s) succeed! ###"
$TDENGINE_COVERAGE_REPORT
fi
totalPyFailed
=
`
grep
'python case(s) failed!'
$TDENGINE_COVERAGE_REPORT
|
awk
'{print $4}'
`
cd
$JDBC_DIR
if
[
-z
$totalPyFailed
]
;
then
git checkout
--
.
sed
-i
"6i
\\
n"
$TDENGINE_COVERAGE_REPORT
git reset
--hard
HEAD
else
git checkout main
sed
-i
"6i
\#
## Total
$totalPyFailed
Python test case(s) failed! ###"
$TDENGINE_COVERAGE_REPORT
git pull
fi
echo
"### run JDBC test cases ###"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
# Test Connector
stopTaosd
stopTaosd
nohup
$TDENGINE_DIR
/debug/build/bin/taosd
-c
/etc/taos
>
/dev/null 2>&1 &
stopTaosadapter
sleep
10
cd
$TDENGINE_DIR
/src/connector/jdbc
taosd
-c
/etc/taos
>>
/dev/null 2>&1 &
mvn clean package
>
/dev/null 2>&1
taosadapter
>>
/dev/null 2>&1 &
mvn
test
>
jdbc-out.log 2>&1
tail
-n
20 jdbc-out.log 2>&1
|
tee
-a
$TDENGINE_COVERAGE_REPORT
# Test C Demo
mvn clean
test
>
result.txt 2>&1
stopTaosd
summary
=
`
grep
"Tests run:"
result.txt |
tail
-n
1
`
$TDENGINE_DIR
/debug/build/bin/taosd
-c
$TDENGINE_DIR
/debug/test/cfg
>
/dev/null &
echo
-e
"### JDBC test result:
$summary
###"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
sleep
10
}
yes
|
$TDENGINE_DIR
/debug/build/bin/demo 127.0.0.1
>
/dev/null 2>&1
|
tee
-a
$TDENGINE_COVERAGE_REPORT
# Test waltest
dataDir
=
`
grep
dataDir
$TDENGINE_DIR
/debug/test/cfg/taos.cfg|awk
'{print $2}'
`
walDir
=
`
find
$dataDir
-name
"wal"
|head
-n1
`
echo
"dataDir:
$dataDir
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
echo
"walDir:
$walDir
"
|
tee
-a
$TDENGINE_COVERAGE_REPORT
if
[
-n
"
$walDir
"
]
;
then
yes
|
$TDENGINE_DIR
/debug/build/bin/waltest
-p
$walDir
>
/dev/null 2>&1
|
tee
-a
$TDENGINE_COVERAGE_REPORT
fi
# run Unit Test
function
runTest
()
{
echo
"Run Unit Test: utilTest, queryTest and cliTest"
echo
"run Test"
#$TDENGINE_DIR/debug/build/bin/utilTest > /dev/null 2>&1 && echo "utilTest pass!" || echo "utilTest failed!"
#$TDENGINE_DIR/debug/build/bin/queryTest > /dev/null 2>&1 && echo "queryTest pass!" || echo "queryTest failed!"
#$TDENGINE_DIR/debug/build/bin/cliTest > /dev/null 2>&1 && echo "cliTest pass!" || echo "cliTest failed!"
stopTaosd
cd
$TDENGINE_DIR
[
-d
sim
]
&&
rm
-rf
sim
[
-f
$TDENGINE_COVERAGE_REPORT
]
&&
rm
$TDENGINE_COVERAGE_REPORT
runUnitTest
runSimCases
runPythonCases
runJDBCCases
stopTaosd
cd
$TDENGINE_DIR
/tests/script
cd
$TDENGINE_DIR
/tests/script
find
.
-name
'*.sql'
| xargs
rm
-f
find
.
-name
'*.sql'
| xargs
rm
-f
...
@@ -203,15 +190,18 @@ function lcovFunc {
...
@@ -203,15 +190,18 @@ function lcovFunc {
# remove exclude paths
# remove exclude paths
if
[
"
$branch
"
==
"3.0"
]
;
then
if
[
"
$branch
"
==
"3.0"
]
;
then
lcov
--remove
coverage.info
\
lcov
--remove
coverage.info
\
'*/contrib/*'
'*/tests/*'
'*/test/*'
\
'*/contrib/*'
'*/tests/*'
'*/test/*'
'*/tools/*'
'*/libs/sync/*'
\
'*/AccessBridgeCalls.c'
'*/ttszip.c'
'*/dataInserter.c'
'*/tlinearhash.c'
'*/tsimplehash
.c'
\
'*/AccessBridgeCalls.c'
'*/ttszip.c'
'*/dataInserter.c'
'*/tlinearhash.c'
'*/tsimplehash.c'
'*/tsdbDiskData
.c'
\
'*/texpr.c'
'*/runUdf.c'
'*/schDbg.c'
'*/syncIO.c'
'*/tdbOs.c'
'*/pushServer.c'
'*/osLz4.c'
\
'*/texpr.c'
'*/runUdf.c'
'*/schDbg.c'
'*/syncIO.c'
'*/tdbOs.c'
'*/pushServer.c'
'*/osLz4.c'
\
'*/tbase64.c'
'*/tbuffer.c'
'*/tdes.c'
'*/texception.c'
'*/tidpool.c'
'*/tmempool.c'
\
'*/tbase64.c'
'*/tbuffer.c'
'*/tdes.c'
'*/texception.c'
'*/tidpool.c'
'*/tmempool.c'
\
'*/tthread.c'
'*/tversion.c'
\
'*/clientJniConnector.c'
'*/clientTmqConnector.c'
'*/version.c'
'*/shellAuto.c'
'*/shellTire.c'
\
'*/tthread.c'
'*/tversion.c'
'*/ctgDbg.c'
'*/schDbg.c'
'*/qwDbg.c'
'*/tencode.h'
'*/catalog.c'
\
'*/tqSnapshot.c'
'*/tsdbSnapshot.c''*/metaSnapshot.c'
'*/smaSnapshot.c'
'*/tqOffsetSnapshot.c'
\
'*/vnodeSnapshot.c'
'*/metaSnapshot.c'
'*/tsdbSnapshot.c'
'*/mndGrant.c'
'*/mndSnode.c'
'*/streamRecover.c'
\
--rc
lcov_branch_coverage
=
1
-o
coverage.info
--rc
lcov_branch_coverage
=
1
-o
coverage.info
else
else
lcov
--remove
coverage.info
\
lcov
--remove
coverage.info
\
'*/tests/*'
'*/test/*'
'*/deps/*'
'*/plugins/*'
'*/taosdef.h'
'*/ttype.h'
'*/tarithoperator.c'
'*/TSDBJNIConnector.c'
'*/taosdemo.c'
\
'*/tests/*'
'*/test/*'
'*/deps/*'
'*/plugins/*'
'*/taosdef.h'
'*/ttype.h'
'*/tarithoperator.c'
'*/TSDBJNIConnector.c'
'*/taosdemo.c'
'*/clientJniConnector.c'
\
--rc
lcov_branch_coverage
=
1
-o
coverage.info
--rc
lcov_branch_coverage
=
1
-o
coverage.info
fi
fi
...
@@ -257,34 +247,32 @@ function stopTaosd {
...
@@ -257,34 +247,32 @@ function stopTaosd {
echo
"Stop tasod end"
echo
"Stop tasod end"
}
}
function
runTestRandomFail
{
function
stopTaosadapter
{
exec_random_fail_sh
=
$1
echo
"Stop taosadapter"
default_exec_sh
=
$TDENGINE_DIR
/tests/script/sh/exec.sh
systemctl stop taosadapter.service
[
-f
$exec_random_fail_sh
]
&&
cp
$exec_random_fail_sh
$default_exec_sh
||
exit
1
PID
=
`
ps
-ef
|grep
-w
taosadapter |
grep
-v
grep
|
awk
'{print $2}'
`
while
[
-n
"
$PID
"
]
dnodes_random_fail_py
=
$TDENGINE_DIR
/tests/pytest/util/dnodes-no-random-fail.py
do
default_dnodes_py
=
$TDENGINE_DIR
/tests/pytest/util/dnodes.py
pkill
-TERM
-x
taosadapter
[
-f
$dnodes_random_fail_py
]
&&
cp
$dnodes_random_fail_py
$default_dnodes_py
||
exit
1
sleep
1
PID
=
`
ps
-ef
|grep
-w
taosd |
grep
-v
grep
|
awk
'{print $2}'
`
done
echo
"Stop tasoadapter end"
runTest NoRandomFail
}
}
WORK_DIR
=
/root/
pxiao
WORK_DIR
=
/root/
date
>>
$WORK_DIR
/cron.log
date
>>
$WORK_DIR
/cron.log
echo
"Run Coverage Test"
|
tee
-a
$WORK_DIR
/cron.log
echo
"Run Coverage Test"
|
tee
-a
$WORK_DIR
/cron.log
stopTaosd
stopTaosd
buildTDengine
#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-random-fail.sh
#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-default.sh
#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-no-random-fail.sh
buildTDengine
runTest
runTest
lcovFunc
lcovFunc
#sendReport
sendReport
stopTaosd
stopTaosd
date
>>
$WORK_DIR
/cron.log
date
>>
$WORK_DIR
/cron.log
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录