runAllSimCases.sh 2.2 KB
Newer Older
1
!/bin/bash
P
plum-lihui 已提交
2 3 4 5 6 7 8 9 10

##################################################
# 
# Do simulation test 
#
##################################################

set -e
#set -x
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
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
P
plum-lihui 已提交
45 46 47 48 49

while read line
do
  firstChar=`echo ${line:0:1}`
  if [[ -n "$line" ]]  && [[ $firstChar != "#" ]]; then
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
    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
P
plum-lihui 已提交
78 79 80 81
  fi
done < ./jenkins/basic.txt