handle_crash_gen_val_log.sh 1.6 KB
Newer Older
1 2 3 4 5 6 7
#!/bin/bash
# Color setting
RED='\033[0;31m'
GREEN='\033[1;32m'
GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m'
L
liuyq-617 已提交
8 9 10 11 12 13 14 15 16 17 18
IN_TDINTERNAL="community"
TDIR=`pwd`
if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
  cd ../..
else
  cd ../../..
fi
TOP_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep -v community|head -n1`
nohup $TAOSD_DIR >/dev/null &
cd -
19
./crash_gen.sh --valgrind -p -t 10 -s 350 -b 4
L
liuyq-617 已提交
20
pidof taosd|xargs kill -9
21 22 23 24
grep 'start to execute\|ERROR SUMMARY' valgrind.err|grep -v 'grep'|uniq|tee crash_gen_mem_err.log

for memError in `grep 'ERROR SUMMARY' crash_gen_mem_err.log | awk '{print $4}'`
do
25
memError=(${memError//,/})
26 27 28 29 30 31 32 33 34 35 36
if [ -n "$memError" ]; then
    if [ "$memError" -gt 12 ]; then
    echo -e "${RED} ## Memory errors number valgrind reports is $memError.\
                More than our threshold! ## ${NC}"
    fi
fi
done

grep 'start to execute\|definitely lost:' valgrind.err|grep -v 'grep'|uniq|tee crash_gen-definitely-lost-out.log
for defiMemError in `grep 'definitely lost:' crash_gen-definitely-lost-out.log | awk '{print $7}'`
do
37
defiMemError=(${defiMemError//,/})
38
if [ -n "$defiMemError" ]; then
L
liuyq-617 已提交
39
    if [ "$defiMemError" -gt 3 -a "$defiMemError" -lt 1013 ]; then
40 41
    echo -e "${RED} ## Memory errors number valgrind reports \
                Definitely lost is $defiMemError. More than our threshold! ## ${NC}"
L
liuyq-617 已提交
42 43 44 45 46
      exit 8
    elif [ "$defiMemError" -gt 1013 ];then           #add for azure
      echo -e "${RED} ## Memory errors number valgrind reports \
                Definitely lost is $defiMemError. More than our threshold! ## ${NC}"
      exit 8
47 48
    fi
fi
L
liuyq-617 已提交
49
done