This bug adds enhancement as per bug 7606, the -w
[asterisk/asterisk.git] / pbx / ael / ael-test / runtests
1 #!/bin/bash
2 ORIG=`mktemp /tmp/mytest.XXXXXX`
3 NEW=`mktemp /tmp/mytest.XXXXXX`
4
5 do_filter() {
6         sed 's/line:[0-9]*//; /^Executed.*/d; s/column=[0-9]*/ /; s/Cols: [0-9]*-[0-9]*/___/'
7 }
8
9 for i in ael-test*; do
10         echo -n Test: $i..................
11         (cd $i; ../../../../utils/aelparse -n -d | grep -v -i 'seconds' > ../res.$i)
12         do_filter < res.$i > $NEW
13         do_filter < ref.$i > $ORIG
14         if (diff -q $NEW $ORIG > /dev/null 2>&1 ) then
15                 echo PASSED
16                 rm res.$i
17         else
18                 echo %%%%%%FAILED%%%%%%
19                 # diff -u ref.$i res.$i
20                 diff -u $ORIG $NEW
21         fi
22
23 done
24
25 for i in ael-ntest*; do
26         echo -n Test: $i.................
27         (cd $i; ../../../../utils/aelparse -d | grep -v -i 'seconds' > ../res.$i)
28         do_filter < res.$i > $NEW
29         do_filter < ref.$i > $ORIG
30         if (diff -q $NEW $ORIG > /dev/null 2>&1 ) then
31                 echo PASSED
32                 rm res.$i
33         else
34                 echo %%%%%%FAILED%%%%%%
35                 # diff -u ref.$i res.$i
36                 diff -u $ORIG $NEW
37         fi
38
39 done
40
41 for i in ael-vtest*; do
42         echo -n Test: $i.................
43         (cd $i; ../../../../utils/aelparse -d -w -n | grep -v -i 'seconds' > ../res2.$i)
44         
45         if (diff -q ref.$i $i/extensions.conf.aeldump  > /dev/null 2>&1 ) then
46                 echo PASSED
47                 rm res2.$i
48                 rm $i/extensions.conf.aeldump
49         else
50                 echo %%%%%%FAILED%%%%%%
51                 # diff -u ref.$i res.$i
52                 diff -u ref.$i $i/extensions.conf.aeldump
53         fi
54
55 done
56 rm $NEW $ORIG