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

cd script
11
./test.sh -f basicSuite.sim 2>&1 | grep 'success\|failed\|fault' | tee out.txt
sangshuduo's avatar
sangshuduo 已提交
12

13 14
totalSuccess=`grep success out.txt | wc -l`
totalBasic=`grep success out.txt | grep Suite | wc -l`
sangshuduo's avatar
sangshuduo 已提交
15

16 17 18
if [ "$totalSuccess" -gt "0" ]; then
  totalSuccess=`expr $totalSuccess - $totalBasic`
  echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}"
sangshuduo's avatar
sangshuduo 已提交
19 20
fi

21 22 23 24
totalFailed=`grep 'failed\|fault' out.txt | wc -l`
if [ "$totalFailed" -ne "0" ]; then
  echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
  exit $totalFailed
sangshuduo's avatar
sangshuduo 已提交
25 26 27
fi

cd ../pytest
28 29

if [ "$1" == "cron" ]; then
30
  ./fulltest.sh > /dev/null | tee pytest-out.txt
31
else
32
  ./smoketest.sh > /dev/null | tee pytest-out.txt
33
fi
34
totalPySuccess=`grep 'successfully executed' pytest-out.txt | wc -l`
sangshuduo's avatar
sangshuduo 已提交
35

36
if [ "$totalPySuccess" -gt "0" ]; then
sangshuduo's avatar
sangshuduo 已提交
37
  grep 'successfully executed' pytest-out.txt
38
  echo -e "${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}"
sangshuduo's avatar
sangshuduo 已提交
39 40
fi

sangshuduo's avatar
sangshuduo 已提交
41
totalPyFailed=`grep 'failed\|fault' pytest-out.txt | wc -l`
42 43 44
if [ "$totalPyFailed" -ne "0" ]; then
  echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}"
  exit $totalPyFailed
sangshuduo's avatar
sangshuduo 已提交
45 46
fi