未验证 提交 3e246468 编写于 作者: H huili 提交者: GitHub

Merge pull request #5523 from taosdata/test/testcase

[TD-3368]<test>output log of failed case
...@@ -28,6 +28,8 @@ RUN ulimit -c unlimited ...@@ -28,6 +28,8 @@ RUN ulimit -c unlimited
COPY --from=builder /root/bin/taosd /usr/bin COPY --from=builder /root/bin/taosd /usr/bin
COPY --from=builder /root/bin/tarbitrator /usr/bin COPY --from=builder /root/bin/tarbitrator /usr/bin
COPY --from=builder /root/bin/taosdemo /usr/bin
COPY --from=builder /root/bin/taosdump /usr/bin
COPY --from=builder /root/bin/taos /usr/bin COPY --from=builder /root/bin/taos /usr/bin
COPY --from=builder /root/cfg/taos.cfg /etc/taos/ COPY --from=builder /root/cfg/taos.cfg /etc/taos/
COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1 COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1
......
...@@ -141,6 +141,7 @@ function clusterUp { ...@@ -141,6 +141,7 @@ function clusterUp {
sed -i "s/td2.0-node3/td2.0-node$i/g" node$i.yml sed -i "s/td2.0-node3/td2.0-node$i/g" node$i.yml
sed -i "s/'tdnode3'/'tdnode$i'/g" node$i.yml sed -i "s/'tdnode3'/'tdnode$i'/g" node$i.yml
sed -i "s#/node3/#/node$i/#g" node$i.yml sed -i "s#/node3/#/node$i/#g" node$i.yml
sed -i "s#hostname: tdnode3#hostname: tdnode$i#g" node$i.yml
sed -i "s#ipv4_address: 172.27.0.9#ipv4_address: 172.27.0.`expr $i + 6`#g" node$i.yml sed -i "s#ipv4_address: 172.27.0.9#ipv4_address: 172.27.0.`expr $i + 6`#g" node$i.yml
fi fi
docker_run=$docker_run" -f node$i.yml " docker_run=$docker_run" -f node$i.yml "
......
...@@ -34,7 +34,7 @@ services: ...@@ -34,7 +34,7 @@ services:
- "tdnode7:172.27.0.13" - "tdnode7:172.27.0.13"
- "tdnode8:172.27.0.14" - "tdnode8:172.27.0.14"
- "tdnode9:172.27.0.15" - "tdnode9:172.27.0.15"
- "tdnode9:172.27.0.16" - "tdnode10:172.27.0.16"
volumes: volumes:
# bind data directory # bind data directory
- type: bind - type: bind
...@@ -66,7 +66,9 @@ services: ...@@ -66,7 +66,9 @@ services:
context: . context: .
args: args:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- TARBITRATORPKG=${TARBITRATORPKG}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
- EXTRACTDIR2=${DIR2}
- DATADIR=${DATADIR} - DATADIR=${DATADIR}
image: 'tdengine:${VERSION}' image: 'tdengine:${VERSION}'
container_name: 'tdnode2' container_name: 'tdnode2'
......
...@@ -6,7 +6,9 @@ services: ...@@ -6,7 +6,9 @@ services:
context: . context: .
args: args:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- TARBITRATORPKG=${TARBITRATORPKG}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
- EXTRACTDIR2=${DIR2}
- DATADIR=${DATADIR} - DATADIR=${DATADIR}
image: 'tdengine:${VERSION}' image: 'tdengine:${VERSION}'
container_name: 'tdnode3' container_name: 'tdnode3'
...@@ -32,7 +34,7 @@ services: ...@@ -32,7 +34,7 @@ services:
- "tdnode7:172.27.0.13" - "tdnode7:172.27.0.13"
- "tdnode8:172.27.0.14" - "tdnode8:172.27.0.14"
- "tdnode9:172.27.0.15" - "tdnode9:172.27.0.15"
- "tdnode9:172.27.0.16" - "tdnode10:172.27.0.16"
volumes: volumes:
# bind data directory # bind data directory
- type: bind - type: bind
......
...@@ -6,7 +6,9 @@ services: ...@@ -6,7 +6,9 @@ services:
context: . context: .
args: args:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- TARBITRATORPKG=${TARBITRATORPKG}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
- EXTRACTDIR2=${DIR2}
- DATADIR=${DATADIR} - DATADIR=${DATADIR}
image: 'tdengine:${VERSION}' image: 'tdengine:${VERSION}'
container_name: 'tdnode4' container_name: 'tdnode4'
...@@ -32,7 +34,7 @@ services: ...@@ -32,7 +34,7 @@ services:
- "tdnode7:172.27.0.13" - "tdnode7:172.27.0.13"
- "tdnode8:172.27.0.14" - "tdnode8:172.27.0.14"
- "tdnode9:172.27.0.15" - "tdnode9:172.27.0.15"
- "tdnode9:172.27.0.16" - "tdnode10:172.27.0.16"
volumes: volumes:
# bind data directory # bind data directory
- type: bind - type: bind
......
...@@ -6,7 +6,9 @@ services: ...@@ -6,7 +6,9 @@ services:
context: . context: .
args: args:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- TARBITRATORPKG=${TARBITRATORPKG}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
- EXTRACTDIR2=${DIR2}
- DATADIR=${DATADIR} - DATADIR=${DATADIR}
image: 'tdengine:${VERSION}' image: 'tdengine:${VERSION}'
container_name: 'tdnode5' container_name: 'tdnode5'
...@@ -32,7 +34,7 @@ services: ...@@ -32,7 +34,7 @@ services:
- "tdnode7:172.27.0.13" - "tdnode7:172.27.0.13"
- "tdnode8:172.27.0.14" - "tdnode8:172.27.0.14"
- "tdnode9:172.27.0.15" - "tdnode9:172.27.0.15"
- "tdnode9:172.27.0.16" - "tdnode10:172.27.0.16"
volumes: volumes:
# bind data directory # bind data directory
- type: bind - type: bind
......
...@@ -79,24 +79,26 @@ function runSimCaseOneByOnefq { ...@@ -79,24 +79,26 @@ function runSimCaseOneByOnefq {
date +%F\ %T | tee -a out.log date +%F\ %T | tee -a out.log
if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
echo -n $case echo -n $case
./test.sh -f $case > /dev/null 2>&1 && \ ./test.sh -f $case > ../../../sim/case.log 2>&1 && \
( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \ ( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
( grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \ ( grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
echo -e "${RED} failed${NC}" | tee -a out.log ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat ../../../sim/case.log )
else else
echo -n $case echo -n $case
./test.sh -f $case > /dev/null 2>&1 && \ ./test.sh -f $case > ../../sim/case.log 2>&1 && \
( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \ ( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
( grep -q 'script.*success.*m$' ../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \ ( grep -q 'script.*success.*m$' ../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
echo -e "${RED} failed${NC}" | tee -a out.log ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat ../../sim/case.log )
fi fi
out_log=`tail -1 out.log ` out_log=`tail -1 out.log `
if [[ $out_log =~ 'failed' ]];then if [[ $out_log =~ 'failed' ]];then
if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
cp -r ../../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S"` cp -r ../../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S"`
rm -rf ../../../sim/case.log
else else
cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" ` cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" `
rm -rf ../../sim/case.log
fi fi
exit 8 exit 8
fi fi
...@@ -105,6 +107,8 @@ function runSimCaseOneByOnefq { ...@@ -105,6 +107,8 @@ function runSimCaseOneByOnefq {
dohavecore $2 dohavecore $2
fi fi
done done
rm -rf ../../../sim/case.log
rm -rf ../../sim/case.log
} }
function runPyCaseOneByOne { function runPyCaseOneByOne {
...@@ -158,13 +162,16 @@ function runPyCaseOneByOnefq() { ...@@ -158,13 +162,16 @@ function runPyCaseOneByOnefq() {
start_time=`date +%s` start_time=`date +%s`
date +%F\ %T | tee -a pytest-out.log date +%F\ %T | tee -a pytest-out.log
echo -n $case echo -n $case
$line > /dev/null 2>&1 && \ $line > ../../sim/case.log 2>&1 && \
echo -e "${GREEN} success${NC}" | tee -a pytest-out.log || \ echo -e "${GREEN} success${NC}" | tee -a pytest-out.log || \
echo -e "${RED} failed${NC}" | tee -a pytest-out.log echo -e "${RED} failed${NC}" | tee -a pytest-out.log
end_time=`date +%s` end_time=`date +%s`
out_log=`tail -1 pytest-out.log ` out_log=`tail -1 pytest-out.log `
if [[ $out_log =~ 'failed' ]];then if [[ $out_log =~ 'failed' ]];then
cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" ` cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" `
echo '=====================log====================='
cat ../../sim/case.log
rm -rf ../../sim/case.log
exit 8 exit 8
fi fi
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log
...@@ -174,6 +181,7 @@ function runPyCaseOneByOnefq() { ...@@ -174,6 +181,7 @@ function runPyCaseOneByOnefq() {
dohavecore $2 dohavecore $2
fi fi
done done
rm -rf ../../sim/case.log
} }
totalFailed=0 totalFailed=0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册