test-all.sh 1.6 KB
Newer Older
sangshuduo's avatar
sangshuduo 已提交
1 2 3 4 5 6 7 8 9
#!/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'

10
echo "### run TSIM script ###"
sangshuduo's avatar
sangshuduo 已提交
11
cd script
12 13 14 15 16
if [ "$1" == "cron" ]; then
  ./test.sh -f fullGeneralSuite.sim 2>&1 | grep 'success\|failed\|fault' | grep -v 'default' | tee out.log
else
  ./test.sh -f basicSuite.sim 2>&1 | grep 'success\|failed\|fault' | grep -v 'default' | tee out.log
fi
sangshuduo's avatar
sangshuduo 已提交
17

18 19
totalSuccess=`grep 'success' out.log | wc -l`
totalBasic=`grep success out.log | grep Suite | wc -l`
sangshuduo's avatar
sangshuduo 已提交
20

21 22
if [ "$totalSuccess" -gt "0" ]; then
  totalSuccess=`expr $totalSuccess - $totalBasic`
sangshuduo's avatar
sangshuduo 已提交
23 24
fi

25 26
echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}"

27
totalFailed=`grep 'failed\|fault' out.log | wc -l`
28
# echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
29

30
if [ "$totalFailed" -ne "0" ]; then
31 32 33
  echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"

#  exit $totalFailed
sangshuduo's avatar
sangshuduo 已提交
34 35
fi

36
echo "### run Python script ###"
sangshuduo's avatar
sangshuduo 已提交
37
cd ../pytest
38 39

if [ "$1" == "cron" ]; then
40
  ./fulltest.sh 2>&1 | grep 'successfully executed\|failed\|fault' | grep -v 'default'| tee pytest-out.log
41
else
42
  ./smoketest.sh 2>&1 | grep 'successfully executed\|failed\|fault' | grep -v 'default'| tee pytest-out.log
43
fi
44
totalPySuccess=`grep 'successfully executed' pytest-out.log | wc -l`
sangshuduo's avatar
sangshuduo 已提交
45

46 47
if [ "$totalPySuccess" -gt "0" ]; then
  echo -e "${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}"
sangshuduo's avatar
sangshuduo 已提交
48 49
fi

50
totalPyFailed=`grep 'failed\|fault' pytest-out.log | wc -l`
51 52
if [ "$totalPyFailed" -ne "0" ]; then
  echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}"
53
#  exit $totalPyFailed
sangshuduo's avatar
sangshuduo 已提交
54 55
fi

56
exit $(($totalFailed + $totalPyFailed))