test.sh 3.4 KB
Newer Older
S
slguan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/bash

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

set +e

FILE_NAME=
RELEASE=0
ASYNC=0
S
slguan 已提交
14 15
VALGRIND=0
while getopts "f:av" arg
S
slguan 已提交
16 17 18 19 20 21 22 23
do
  case $arg in
    f)
      FILE_NAME=$OPTARG
      ;;
    a)
      ASYNC=1
      ;;
S
slguan 已提交
24 25 26
    v)
      VALGRIND=1
      ;;
S
slguan 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
    ?)
      echo "unknow argument"
      ;;
  esac
done

cd .
sh/ip.sh -i 1 -s up > /dev/null 2>&1 & 
sh/ip.sh -i 2 -s up > /dev/null 2>&1 & 
sh/ip.sh -i 3 -s up > /dev/null 2>&1 & 

# Get responsible directories
CODE_DIR=`dirname $0`
CODE_DIR=`pwd`
cd ../../
TOP_DIR=`pwd`
BUILD_DIR=$TOP_DIR/debug/build
SIM_DIR=$TOP_DIR/sim

if [ $ASYNC -eq 0 ]; then
  PROGRAM=$BUILD_DIR/bin/tsim
else
  PROGRAM="$BUILD_DIR/bin/tsim -a"
fi

PRG_DIR=$SIM_DIR/tsim
CFG_DIR=$PRG_DIR/cfg
LOG_DIR=$PRG_DIR/log
DATA_DIR=$PRG_DIR/data

chmod -R 777 $PRG_DIR
echo "------------------------------------------------------------------------"
echo "Start TDengine Testing Case ..."
echo "BUILD_DIR: $BUILD_DIR"
echo "SIM_DIR  : $SIM_DIR"
echo "CODE_DIR : $CODE_DIR"
echo "CFG_DIR  : $CFG_DIR"

rm -rf $LOG_DIR
rm -rf $CFG_DIR
mkdir -p $PRG_DIR
mkdir -p $LOG_DIR
mkdir -p $CFG_DIR

TAOS_CFG=$PRG_DIR/cfg/taos.cfg
touch -f $TAOS_CFG
TAOS_FLAG=$PRG_DIR/flag

echo " "                                    >> $TAOS_CFG
echo "scriptDir        ${CODE_DIR}/../script">> $TAOS_CFG
echo "masterIp         192.168.0.1"          >> $TAOS_CFG
echo "secondIp         192.168.0.2"          >> $TAOS_CFG
echo "localIp          127.0.0.1"            >> $TAOS_CFG
echo "dataDir          $DATA_DIR"            >> $TAOS_CFG
echo "logDir           $LOG_DIR"             >> $TAOS_CFG
echo "numOfLogLines    100000000"            >> $TAOS_CFG
echo "dDebugFlag       135"                  >> $TAOS_CFG
echo "mDebugFlag       135"                  >> $TAOS_CFG
echo "sdbDebugFlag     135"                  >> $TAOS_CFG
echo "rpcDebugFlag     135"                  >> $TAOS_CFG
echo "tmrDebugFlag     131"                  >> $TAOS_CFG
echo "cDebugFlag       135"                  >> $TAOS_CFG
echo "httpDebugFlag    135"                  >> $TAOS_CFG
echo "monitorDebugFlag 135"                 >> $TAOS_CFG
echo "udebugFlag       135"                  >> $TAOS_CFG
echo "clog             0"                    >> $TAOS_CFG
echo "asyncLog         0"                    >> $TAOS_CFG
echo "locale           en_US.UTF-8"          >> $TAOS_CFG
echo " "                                    >> $TAOS_CFG

ulimit -n 600000
ulimit -c unlimited

#sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e

if [ -n "$FILE_NAME" ]; then
  echo "------------------------------------------------------------------------"
S
slguan 已提交
104 105 106 107 108 109 110
  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
    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
  else
    echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f $FILE_NAME
    $PROGRAM -c $CFG_DIR -f $FILE_NAME
  fi
S
slguan 已提交
111 112 113 114 115 116
else
  echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f basicSuite.sim
  echo "------------------------------------------------------------------------"
  $PROGRAM -c $CFG_DIR -f basicSuite.sim
fi