blob: 1125849096490fdb71b13564755a8dde99c4054e [file] [log] [blame]
sg481nbd890c52017-08-28 12:11:35 -04001# /bin/bash
2mkdir -p runs
3function failed {
4 echo "FAILED TEST! $*"
5 exit 1
6}
7
8if [ "$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
15else
16 DIRS=$1
17 shift
18fi
19
20for 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
32exit
33 cat $TC | aafcli -i
34 fi
35done
36
37exit 0