提交 fa6e18e2 编写于 作者: P plum-lihui

[test: support valgrind run all sim cases, and save valgrind log file]

上级 3fad3b68
#!/bin/bash
!/bin/bash
##################################################
#
......@@ -8,13 +8,73 @@
set -e
#set -x
VALGRIND=0
LOG_BK_DIR=/data/valgrind_log_backup # 192.168.0.203
while getopts "v:r" arg
do
case $arg in
v)
VALGRIND=1
;;
r)
LOG_BK_DIR=$(echo $OPTARG)
;;
?) #unknow option
echo "unkonw argument"
exit 1
;;
esac
done
echo "VALGRIND: $VALGRIND, LOG_BK_DIR: $LOG_BK_DIR"
CURRENT_DIR=`pwd`
TSIM_LOG_DIR=$CURRENT_DIR/../../sim/tsim/log
TAOSD_LOG_DIR=$CURRENT_DIR/../../sim
echo "tsim log dir: $TSIM_LOG_DIR"
echo "taosd log dir: $TAOSD_LOG_DIR"
if [[ $VALGRIND -eq 1 ]]; then
if [ -d ${LOG_BK_DIR} ]; then
rm -rf ${LOG_BK_DIR}/*
else
mkdir -p $LOG_BK_DIR/
fi
fi
while read line
do
firstChar=`echo ${line:0:1}`
if [[ -n "$line" ]] && [[ $firstChar != "#" ]]; then
echo "======== $line ========"
$line
if [[ $VALGRIND -eq 1 ]]; then
echo "======== $line -v ========"
$line -v
# move all valgrind log files of the sim case to valgrind back dir
# get current sim case name for
result=`echo ${line%sim*}`
result=`echo ${result#*/}`
result=`echo ${result#*/}`
result=`echo ${result////-}`
tsimLogFile=valgrind-${result}sim.log
echo "cp ${TSIM_LOG_DIR}/valgrind-tsim.log ${LOG_BK_DIR}/${tsimLogFile} "
cp ${TSIM_LOG_DIR}/valgrind-tsim.log ${LOG_BK_DIR}/${tsimLogFile}
cp ${TAOSD_LOG_DIR}/dnode1/log/valgrind*.log ${LOG_BK_DIR}/ ||:
cp ${TAOSD_LOG_DIR}/dnode2/log/valgrind*.log ${LOG_BK_DIR}/ ||:
cp ${TAOSD_LOG_DIR}/dnode3/log/valgrind*.log ${LOG_BK_DIR}/ ||:
cp ${TAOSD_LOG_DIR}/dnode4/log/valgrind*.log ${LOG_BK_DIR}/ ||:
cp ${TAOSD_LOG_DIR}/dnode5/log/valgrind*.log ${LOG_BK_DIR}/ ||:
cp ${TAOSD_LOG_DIR}/dnode6/log/valgrind*.log ${LOG_BK_DIR}/ ||:
cp ${TAOSD_LOG_DIR}/dnode7/log/valgrind*.log ${LOG_BK_DIR}/ ||:
cp ${TAOSD_LOG_DIR}/dnode8/log/valgrind*.log ${LOG_BK_DIR}/ ||:
cp ${TAOSD_LOG_DIR}/dnode9/log/valgrind*.log ${LOG_BK_DIR}/ ||:
else
echo "======== $line ========"
$line
fi
fi
done < ./jenkins/basic.txt
......
......@@ -97,13 +97,14 @@ if [ "$CLEAR_OPTION" = "clear" ]; then
fi
if [ "$EXEC_OPTON" = "start" ]; then
echo "ExcuteCmd:" $EXE_DIR/taosd -c $CFG_DIR
#echo "ExcuteCmd:" $EXE_DIR/taosd -c $CFG_DIR
if [ "$VALGRIND_OPTION" = "true" ]; then
TT=`date +%s`
mkdir ${LOG_DIR}/${TT}
nohup valgrind --log-file=${LOG_DIR}/${TT}/valgrind.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &
#mkdir ${LOG_DIR}/${TT}
echo "nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &"
nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &
else
echo "nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &"
nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &
fi
......
......@@ -126,7 +126,7 @@ if [ -n "$FILE_NAME" ]; then
echo "------------------------------------------------------------------------"
if [ $VALGRIND -eq 1 ]; then
echo valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v
valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v
valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${LOG_DIR}/valgrind-tsim.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v
else
if [[ $MULTIPROCESS -eq 1 ]];then
echo "ExcuteCmd(multiprocess):" $PROGRAM -m -c $CFG_DIR -f $FILE_NAME
......
......@@ -537,4 +537,4 @@ endi
#endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册