sg481n | bd890c5 | 2017-08-28 12:11:35 -0400 | [diff] [blame] | 1 | # /bin/bash |
| 2 | mkdir -p runs |
| 3 | function failed { |
| 4 | echo "FAILED TEST! $*" |
| 5 | exit 1 |
| 6 | } |
| 7 | |
| 8 | if [ "$1" == "" ]; then |
| 9 | DIRS=`find TestCases -type d -name "TC_*" -maxdepth 1 | sed "s/^TestCases\///"` |
| 10 | if [ "$DIRS" == "" ] ; then |
| 11 | echo "Usage: tc <TestCase> [expected]" |
| 12 | echo " expected - create the expected response for future comparison" |
| 13 | exit 1 |
| 14 | fi |
| 15 | else |
| 16 | DIRS=$1 |
| 17 | shift |
| 18 | fi |
| 19 | |
| 20 | for TC in $DIRS; do |
| 21 | if [ "$1" = "expected" ]; then |
| 22 | SUFFIX=$1 |
| 23 | cat TestCases/$TC/[0-9]* | aafcli -i 2>&1 | tee TestCases/expected/$TC.$SUFFIX |
| 24 | elif [ -d "TestCases/$TC" ]; then |
| 25 | SUFFIX=`date "+%Y-%m-%d_%H:%M:%S"` |
| 26 | cat TestCases/$TC/[0-9]* | aafcli -i 2>&1 | tee runs/$TC.$SUFFIX > /dev/null |
| 27 | |
| 28 | diff runs/$TC.$SUFFIX TestCases/expected/$TC.expected || failed "[$TC.$SUFFIX]" |
| 29 | echo "SUCCESS! [$TC.$SUFFIX]" |
| 30 | else |
| 31 | echo missed dir |
| 32 | exit |
| 33 | cat $TC | aafcli -i |
| 34 | fi |
| 35 | done |
| 36 | |
| 37 | exit 0 |