Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9beb0fad
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看板
未验证
提交
9beb0fad
编写于
6月 24, 2022
作者:
H
Hui Li
提交者:
GitHub
6月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14203 from taosdata/ci/TD-16756
ci: optimize Jenkins log
上级
f6b38f37
18187433
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
153 addition
and
64 deletion
+153
-64
Jenkinsfile2
Jenkinsfile2
+68
-37
tests/parallel_test/run.sh
tests/parallel_test/run.sh
+85
-27
未找到文件。
Jenkinsfile2
浏览文件 @
9beb0fad
...
@@ -43,10 +43,8 @@ def pre_test(){
...
@@ -43,10 +43,8 @@ def pre_test(){
sh '''
sh '''
cd ${WK}
cd ${WK}
git reset --hard
git reset --hard
git fetch || git fetch
cd ${WKC}
cd ${WKC}
git reset --hard
git reset --hard
git fetch || git fetch
'''
'''
script {
script {
if (env.CHANGE_TARGET == 'master') {
if (env.CHANGE_TARGET == 'master') {
...
@@ -82,6 +80,7 @@ def pre_test(){
...
@@ -82,6 +80,7 @@ def pre_test(){
if (env.CHANGE_URL =~ /\/TDengine\//) {
if (env.CHANGE_URL =~ /\/TDengine\//) {
sh '''
sh '''
cd ${WKC}
cd ${WKC}
git remote prune origin
git pull >/dev/null
git pull >/dev/null
git log -5
git log -5
echo "`date "+%Y%m%d-%H%M%S"` ${JOB_NAME}:${BRANCH_NAME}:${BUILD_ID}:${CHANGE_TARGET}" >>${WKDIR}/jenkins.log
echo "`date "+%Y%m%d-%H%M%S"` ${JOB_NAME}:${BRANCH_NAME}:${BUILD_ID}:${CHANGE_TARGET}" >>${WKDIR}/jenkins.log
...
@@ -107,6 +106,7 @@ def pre_test(){
...
@@ -107,6 +106,7 @@ def pre_test(){
git log -5
git log -5
echo "tdinternal log merged: `git log -5`" >>${WKDIR}/jenkins.log
echo "tdinternal log merged: `git log -5`" >>${WKDIR}/jenkins.log
cd ${WKC}
cd ${WKC}
git remote prune origin
git pull >/dev/null
git pull >/dev/null
git log -5
git log -5
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
...
@@ -137,53 +137,51 @@ def pre_test_win(){
...
@@ -137,53 +137,51 @@ def pre_test_win(){
set
set
date /t
date /t
time /t
time /t
rd /s /Q
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug || exit 0
rd /s /Q
%WIN_INTERNAL_ROOT%
\\debug || exit 0
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git reset --hard
git reset --hard
git fetch || git fetch
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git reset --hard
git reset --hard
git fetch || git fetch
'''
'''
script {
script {
if (env.CHANGE_TARGET == 'master') {
if (env.CHANGE_TARGET == 'master') {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout master
git checkout master
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout master
git checkout master
'''
'''
} else if(env.CHANGE_TARGET == '2.0') {
} else if(env.CHANGE_TARGET == '2.0') {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout 2.0
git checkout 2.0
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout 2.0
git checkout 2.0
'''
'''
} else if(env.CHANGE_TARGET == '3.0') {
} else if(env.CHANGE_TARGET == '3.0') {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout 3.0
git checkout 3.0
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout 3.0
git checkout 3.0
'''
'''
} else {
} else {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout develop
git checkout develop
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout develop
git checkout develop
'''
'''
}
}
...
@@ -191,36 +189,38 @@ def pre_test_win(){
...
@@ -191,36 +189,38 @@ def pre_test_win(){
script {
script {
if (env.CHANGE_URL =~ /\/TDengine\//) {
if (env.CHANGE_URL =~ /\/TDengine\//) {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git pull
git pull
'''
'''
bat '''
bat '''
cd C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
git pull
git pull
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git fetch origin +refs/pull/%CHANGE_ID%/merge
git fetch origin +refs/pull/%CHANGE_ID%/merge
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout -qf FETCH_HEAD
git checkout -qf FETCH_HEAD
'''
'''
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git pull
git pull
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git fetch origin +refs/pull/%CHANGE_ID%/merge
git fetch origin +refs/pull/%CHANGE_ID%/merge
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout -qf FETCH_HEAD
git checkout -qf FETCH_HEAD
'''
'''
bat '''
bat '''
cd C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
git pull
git pull
'''
'''
} else {
} else {
...
@@ -230,27 +230,27 @@ def pre_test_win(){
...
@@ -230,27 +230,27 @@ def pre_test_win(){
}
}
}
}
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git branch
git branch
git log -5
git log -5
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git branch
git branch
git log -5
git log -5
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git submodule update --init --recursive
git submodule update --init --recursive
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
git branch
git branch
git reset --hard
git reset --hard
git pull
git pull
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
git log -5
git log -5
'''
'''
}
}
...
@@ -258,7 +258,7 @@ def pre_test_build_win() {
...
@@ -258,7 +258,7 @@ def pre_test_build_win() {
bat '''
bat '''
echo "building ..."
echo "building ..."
time /t
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
mkdir debug
mkdir debug
cd debug
cd debug
time /t
time /t
...
@@ -273,9 +273,9 @@ def pre_test_build_win() {
...
@@ -273,9 +273,9 @@ def pre_test_build_win() {
time /t
time /t
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
python -m pip install .
python -m pip install .
xcopy /e/y/i/f
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
xcopy /e/y/i/f
%WIN_INTERNAL_ROOT%
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
'''
'''
return 1
return 1
}
}
...
@@ -283,7 +283,7 @@ def run_win_ctest() {
...
@@ -283,7 +283,7 @@ def run_win_ctest() {
bat '''
bat '''
echo "windows ctest ..."
echo "windows ctest ..."
time /t
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug
cd
%WIN_INTERNAL_ROOT%
\\debug
ctest -j 1 || exit 7
ctest -j 1 || exit 7
time /t
time /t
'''
'''
...
@@ -292,12 +292,12 @@ def run_win_test() {
...
@@ -292,12 +292,12 @@ def run_win_test() {
echo "LINUX NODE: ${linux_node_ip} - ${linux_node_pass}"
echo "LINUX NODE: ${linux_node_ip} - ${linux_node_pass}"
bat '''
bat '''
echo "windows test ..."
echo "windows test ..."
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
python -m pip install .
python -m pip install .
xcopy /e/y/i/f
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
xcopy /e/y/i/f
%WIN_INTERNAL_ROOT%
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
ls -l C:\\Windows\\System32\\taos.dll
ls -l C:\\Windows\\System32\\taos.dll
time /t
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community\\tests\\system-test
cd
%WIN_SYSTEM_TEST_ROOT%
echo "node: ''' + linux_node_ip + ''':''' + linux_node_pass + '''"
echo "node: ''' + linux_node_ip + ''':''' + linux_node_pass + '''"
echo "testing ..."
echo "testing ..."
test-all.bat "{\\\"host\\\":\\\"''' + linux_node_ip + '''\\\",\\\"port\\\":22,\\\"user\\\":\\\"root\\\",\\\"password\\\":\\\"''' + linux_node_pass + '''\\\",\\\"path\\\":\\\"/var/lib/jenkins/workspace/TDinternal\\\"}"
test-all.bat "{\\\"host\\\":\\\"''' + linux_node_ip + '''\\\",\\\"port\\\":22,\\\"user\\\":\\\"root\\\",\\\"password\\\":\\\"''' + linux_node_pass + '''\\\",\\\"path\\\":\\\"/var/lib/jenkins/workspace/TDinternal\\\"}"
...
@@ -319,6 +319,12 @@ pipeline {
...
@@ -319,6 +319,12 @@ pipeline {
parallel {
parallel {
stage('windows test') {
stage('windows test') {
agent{label " windows10_01 || windows10_02 || windows10_03 || windows10_04 "}
agent{label " windows10_01 || windows10_02 || windows10_03 || windows10_04 "}
environment{
WIN_INTERNAL_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal"
WIN_COMMUNITY_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal\\community"
WIN_SYSTEM_TEST_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal\\community\\tests\\system-test"
WIN_CONNECTOR_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\taos-connector-python"
}
steps {
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 55, unit: 'MINUTES'){
timeout(time: 55, unit: 'MINUTES'){
...
@@ -357,7 +363,7 @@ pipeline {
...
@@ -357,7 +363,7 @@ pipeline {
echo "${linux_node_ip}:${linux_node_pass}"
echo "${linux_node_ip}:${linux_node_pass}"
}
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time:
4
0, unit: 'MINUTES'){
timeout(time:
12
0, unit: 'MINUTES'){
pre_test()
pre_test()
script {
script {
sh '''
sh '''
...
@@ -368,11 +374,36 @@ pipeline {
...
@@ -368,11 +374,36 @@ pipeline {
rm -f /tmp/cases.task
rm -f /tmp/cases.task
./collect_cases.sh -e
./collect_cases.sh -e
'''
'''
def extra_param = ""
def log_server_file = "/home/log_server.json"
def timeout_cmd = ""
if (fileExists(log_server_file)) {
def log_server_enabled = sh (
script: 'jq .enabled ' + log_server_file,
returnStdout: true
).trim()
def timeout_param = sh (
script: 'jq .timeout ' + log_server_file,
returnStdout: true
).trim()
if (timeout_param != "null"
&&
timeout_param != "0") {
timeout_cmd = "timeout " + timeout_param
}
if (log_server_enabled == "1") {
def log_server = sh (
script: 'jq .server ' + log_server_file + ' | sed "s/\\\"//g"',
returnStdout: true
).trim()
if (log_server != "null"
&&
log_server != "") {
extra_param = "-w " + log_server
}
}
}
sh '''
sh '''
cd ${WKC}/tests/parallel_test
cd ${WKC}/tests/parallel_test
export DEFAULT_RETRY_TIME=2
export DEFAULT_RETRY_TIME=2
date
date
timeout 2100 time ./run.sh -e -m /home/m.json -t /tmp/cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480
''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t /tmp/cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480 ''' + extra_param + '''
'''
'''
}
}
}
}
...
...
tests/parallel_test/run.sh
浏览文件 @
9beb0fad
...
@@ -8,11 +8,12 @@ function usage() {
...
@@ -8,11 +8,12 @@ function usage() {
echo
-e
"
\t
-l log dir"
echo
-e
"
\t
-l log dir"
echo
-e
"
\t
-e enterprise edition"
echo
-e
"
\t
-e enterprise edition"
echo
-e
"
\t
-o default timeout value"
echo
-e
"
\t
-o default timeout value"
echo
-e
"
\t
-w log web server"
echo
-e
"
\t
-h help"
echo
-e
"
\t
-h help"
}
}
ent
=
0
ent
=
0
while
getopts
"m:t:b:l:o:eh"
opt
;
do
while
getopts
"m:t:b:l:o:
w:
eh"
opt
;
do
case
$opt
in
case
$opt
in
m
)
m
)
config_file
=
$OPTARG
config_file
=
$OPTARG
...
@@ -32,6 +33,9 @@ while getopts "m:t:b:l:o:eh" opt; do
...
@@ -32,6 +33,9 @@ while getopts "m:t:b:l:o:eh" opt; do
o
)
o
)
timeout_param
=
"-o
$OPTARG
"
timeout_param
=
"-o
$OPTARG
"
;;
;;
w
)
web_server
=
$OPTARG
;;
h
)
h
)
usage
usage
exit
0
exit
0
...
@@ -64,10 +68,11 @@ if [ ! -f $t_file ]; then
...
@@ -64,10 +68,11 @@ if [ ! -f $t_file ]; then
exit
1
exit
1
fi
fi
date_tag
=
`
date
+%Y%m%d-%H%M%S
`
date_tag
=
`
date
+%Y%m%d-%H%M%S
`
test_log_dir
=
${
branch
}
_
${
date_tag
}
if
[
-z
$log_dir
]
;
then
if
[
-z
$log_dir
]
;
then
log_dir
=
"log/
${
branch
}
_
${
date_tag
}
"
log_dir
=
"log/
${
test_log_dir
}
"
else
else
log_dir
=
"
$log_dir
/
${
branch
}
_
${
date_tag
}
"
log_dir
=
"
$log_dir
/
${
test_log_dir
}
"
fi
fi
hosts
=()
hosts
=()
...
@@ -190,44 +195,54 @@ function run_thread() {
...
@@ -190,44 +195,54 @@ function run_thread() {
# echo "$thread_no $count $cmd"
# echo "$thread_no $count $cmd"
local
ret
=
0
local
ret
=
0
local
redo_count
=
1
local
redo_count
=
1
local
case_log_file
=
$log_dir
/
${
case_file
}
.txt
start_time
=
`
date
+%s
`
start_time
=
`
date
+%s
`
local
case_index
=
`
flock
-x
$lock_file
-c
"sh -c
\"
echo
\\\$
((
\\\$
( cat
$index_file
) + 1 )) | tee
$index_file
\"
"
`
case_index
=
`
printf
"%5d"
$case_index
`
local
case_info
=
`
echo
"
$line
"
|cut
-d
,
-f
3,4
`
while
[
${
redo_count
}
-lt
6
]
;
do
while
[
${
redo_count
}
-lt
6
]
;
do
if
[
-f
$log_dir
/
$case_file
.log
]
;
then
if
[
-f
$case_log_file
]
;
then
cp
$log_dir
/
$case_file
.log
$log_dir
/
$case_file
.
${
redo_count
}
.redolog
cp
$case_log_file
$log_dir
/
$case_file
.
${
redo_count
}
.redotxt
fi
fi
echo
"
${
hosts
[index]
}
-
${
thread_no
}
order:
${
count
}
, redo:
${
redo_count
}
task:
${
line
}
"
>
$log_dir
/
$case_file
.log
echo
"
${
hosts
[index]
}
-
${
thread_no
}
order:
${
count
}
, redo:
${
redo_count
}
task:
${
line
}
"
>
$case_log_file
echo
-e
"
\e
[33m >>>>>
\e
[0m
${
case_cmd
}
"
local
current_time
=
`
date
"+%Y-%m-%d %H:%M:%S"
`
date
>>
$log_dir
/
$case_file
.log
echo
-e
"
$case_index
\e
[33m START >>>>>
\e
[0m
${
case_info
}
\e
[33m[
$current_time
]
\e
[0m"
# $cmd 2>&1 | tee -a $log_dir/$case_file.log
echo
"
$current_time
"
>>
$case_log_file
local
real_start_time
=
`
date
+%s
`
# $cmd 2>&1 | tee -a $case_log_file
# ret=${PIPESTATUS[0]}
# ret=${PIPESTATUS[0]}
$cmd
>>
$
log_dir
/
$case_file
.log
2>&1
$cmd
>>
$
case_log_file
2>&1
ret
=
$?
ret
=
$?
echo
"
${
hosts
[index]
}
`
date
`
ret:
${
ret
}
"
>>
$log_dir
/
$case_file
.log
local
real_end_time
=
`
date
+%s
`
local
time_elapsed
=
$((
real_end_time
-
real_start_time
))
echo
"execute time:
${
time_elapsed
}
s"
>>
$case_log_file
current_time
=
`
date
"+%Y-%m-%d %H:%M:%S"
`
echo
"
${
hosts
[index]
}
$current_time
exit code:
${
ret
}
"
>>
$case_log_file
if
[
$ret
-eq
0
]
;
then
if
[
$ret
-eq
0
]
;
then
break
break
fi
fi
redo
=
0
redo
=
0
grep
-q
"wait too long for taosd start"
$
log_dir
/
$case_file
.log
grep
-q
"wait too long for taosd start"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"kex_exchange_identification: Connection closed by remote host"
$
log_dir
/
$case_file
.log
grep
-q
"kex_exchange_identification: Connection closed by remote host"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"ssh_exchange_identification: Connection closed by remote host"
$
log_dir
/
$case_file
.log
grep
-q
"ssh_exchange_identification: Connection closed by remote host"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"kex_exchange_identification: read: Connection reset by peer"
$
log_dir
/
$case_file
.log
grep
-q
"kex_exchange_identification: read: Connection reset by peer"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"Database not ready"
$
log_dir
/
$case_file
.log
grep
-q
"Database not ready"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"Unable to establish connection"
$
log_dir
/
$case_file
.log
grep
-q
"Unable to establish connection"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
...
@@ -240,11 +255,18 @@ function run_thread() {
...
@@ -240,11 +255,18 @@ function run_thread() {
redo_count
=
$((
redo_count
+
1
))
redo_count
=
$((
redo_count
+
1
))
done
done
end_time
=
`
date
+%s
`
end_time
=
`
date
+%s
`
echo
>>
$log_dir
/
$case_file
.log
echo
>>
$case_log_file
echo
"
${
hosts
[index]
}
execute time:
$((
end_time
-
start_time
))
s"
>>
$log_dir
/
$case_file
.log
total_time
=
$((
end_time
-
start_time
))
echo
"
${
hosts
[index]
}
total time:
${
total_time
}
s"
>>
$case_log_file
# echo "$thread_no ${line} DONE"
# echo "$thread_no ${line} DONE"
if
[
$ret
-ne
0
]
;
then
if
[
$ret
-eq
0
]
;
then
flock
-x
$lock_file
-c
"echo
\"
${
hosts
[index]
}
ret:
${
ret
}
${
line
}
\"
>>
$log_dir
/failed.log"
echo
-e
"
$case_index
\e
[34m DONE <<<<<
\e
[0m
${
case_info
}
\e
[34m[
${
total_time
}
s]
\e
[0m
\e
[32m success
\e
[0m"
else
if
[
!
-z
${
web_server
}
]
;
then
flock
-x
$lock_file
-c
"echo -e
\"
${
hosts
[index]
}
ret:
${
ret
}
${
line
}
\n
${
web_server
}
/
$test_log_dir
/
${
case_file
}
.txt
\"
>>
${
failed_case_file
}
"
else
flock
-x
$lock_file
-c
"echo -e
\"
${
hosts
[index]
}
ret:
${
ret
}
${
line
}
\n
log file:
${
case_log_file
}
\"
>>
${
failed_case_file
}
"
fi
mkdir
-p
$log_dir
/
${
case_file
}
.coredump
mkdir
-p
$log_dir
/
${
case_file
}
.coredump
local
remote_coredump_dir
=
"
${
workdirs
[index]
}
/tmp/thread_volume/
$thread_no
/coredump"
local
remote_coredump_dir
=
"
${
workdirs
[index]
}
/tmp/thread_volume/
$thread_no
/coredump"
local
scpcmd
=
"sshpass -p
${
passwords
[index]
}
scp -o StrictHostKeyChecking=no -r
${
usernames
[index]
}
@
${
hosts
[index]
}
"
local
scpcmd
=
"sshpass -p
${
passwords
[index]
}
scp -o StrictHostKeyChecking=no -r
${
usernames
[index]
}
@
${
hosts
[index]
}
"
...
@@ -253,13 +275,15 @@ function run_thread() {
...
@@ -253,13 +275,15 @@ function run_thread() {
fi
fi
cmd
=
"
$scpcmd
:
${
remote_coredump_dir
}
/*
$log_dir
/
${
case_file
}
.coredump/"
cmd
=
"
$scpcmd
:
${
remote_coredump_dir
}
/*
$log_dir
/
${
case_file
}
.coredump/"
$cmd
# 2>/dev/null
$cmd
# 2>/dev/null
local
case_info
=
`
echo
"
$line
"
|cut
-d
,
-f
3,4
`
local
corefile
=
`
ls
$log_dir
/
${
case_file
}
.coredump/
`
local
corefile
=
`
ls
$log_dir
/
${
case_file
}
.coredump/
`
echo
-e
"
$case_in
fo
\e
[31m failed
\e
[0m"
echo
-e
"
$case_in
dex
\e
[34m DONE <<<<<
\e
[0m
${
case_info
}
\e
[34m[
${
total_time
}
s]
\e
[0m
\e
[31m failed
\e
[0m"
echo
"=========================log============================"
echo
"=========================log============================"
cat
$
log_dir
/
$case_file
.log
cat
$
case_log_file
echo
"====================================================="
echo
"====================================================="
echo
-e
"
\e
[34m log file:
$log_dir
/
$case_file
.log
\e
[0m"
echo
-e
"
\e
[34m log file:
$case_log_file
\e
[0m"
if
[
!
-z
"
${
web_server
}
"
]
;
then
echo
"
${
web_server
}
/
$test_log_dir
/
${
case_file
}
.txt"
fi
if
[
!
-z
"
$corefile
"
]
;
then
if
[
!
-z
"
$corefile
"
]
;
then
echo
-e
"
\e
[34m corefiles:
$corefile
\e
[0m"
echo
-e
"
\e
[34m corefiles:
$corefile
\e
[0m"
local
build_dir
=
$log_dir
/build_
${
hosts
[index]
}
local
build_dir
=
$log_dir
/build_
${
hosts
[index]
}
...
@@ -325,6 +349,10 @@ mkdir -p $log_dir
...
@@ -325,6 +349,10 @@ mkdir -p $log_dir
rm
-rf
$log_dir
/
*
rm
-rf
$log_dir
/
*
task_file
=
$log_dir
/
$$
.task
task_file
=
$log_dir
/
$$
.task
lock_file
=
$log_dir
/
$$
.lock
lock_file
=
$log_dir
/
$$
.lock
index_file
=
$log_dir
/case_index.txt
stat_file
=
$log_dir
/stat.txt
failed_case_file
=
$log_dir
/failed.txt
echo
"0"
>
$index_file
i
=
0
i
=
0
j
=
0
j
=
0
...
@@ -350,15 +378,45 @@ rm -f $lock_file
...
@@ -350,15 +378,45 @@ rm -f $lock_file
rm
-f
$task_file
rm
-f
$task_file
# docker ps -a|grep -v CONTAINER|awk '{print $1}'|xargs docker rm -f
# docker ps -a|grep -v CONTAINER|awk '{print $1}'|xargs docker rm -f
echo
"====================================================================="
echo
"log dir:
$log_dir
"
total_cases
=
`
cat
$index_file
`
failed_cases
=
0
if
[
-f
$failed_case_file
]
;
then
if
[
!
-z
"
$web_server
"
]
;
then
failed_cases
=
`
grep
-v
"
$web_server
"
$failed_case_file
|wc
-l
`
else
failed_cases
=
`
grep
-v
"log file:"
$failed_case_file
|wc
-l
`
fi
fi
success_cases
=
$((
total_cases
-
failed_cases
))
echo
"Total Cases:
$total_cases
"
>
$stat_file
echo
"Successful:
$success_cases
"
>>
$stat_file
echo
"Failed:
$failed_cases
"
>>
$stat_file
cat
$stat_file
RET
=
0
RET
=
0
i
=
1
i
=
1
if
[
-f
"
$
log_dir
/failed.log
"
]
;
then
if
[
-f
"
$
{
failed_case_file
}
"
]
;
then
echo
"====================================================="
echo
"====================================================="
while
read
line
;
do
while
read
line
;
do
if
[
!
-z
"
${
web_server
}
"
]
;
then
echo
"
$line
"
|grep
-q
"
${
web_server
}
"
if
[
$?
-eq
0
]
;
then
echo
"
$line
"
continue
fi
else
echo
"
$line
"
|grep
-q
"log file:"
if
[
$?
-eq
0
]
;
then
echo
"
$line
"
continue
fi
fi
line
=
`
echo
"
$line
"
|cut
-d
,
-f
3,4
`
line
=
`
echo
"
$line
"
|cut
-d
,
-f
3,4
`
echo
-e
"
$i
.
$line
\e
[31m failed
\e
[0m"
>
&2
echo
-e
"
$i
.
$line
\e
[31m failed
\e
[0m"
>
&2
i
=
$((
i
+
1
))
i
=
$((
i
+
1
))
done
<
$
log_dir
/failed.log
done
<
$
{
failed_case_file
}
RET
=
1
RET
=
1
fi
fi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录