Signed / unsigned fixes and function prototypes
[freeradius.git] / src / tests / runtests.sh
1 #!/bin/bash
2
3 PORT=12340
4 HOME_PORT=12350
5
6 rm -f verbose.log
7 RCODE=0
8
9 rm -rf .cache
10 mkdir .cache
11
12 #
13 #  Bootstrap the tests
14 #
15 for NAME in $@
16 do
17   TOTAL=`grep TESTS $NAME | sed 's/.*TESTS//'`
18
19   #
20   #  Each test may have multiple variants.
21   #
22   for NUMBER in `echo $TOTAL`
23   do
24     cp $NAME .request
25     BASE=`echo $NAME | sed 's,.*/,,'`
26
27     #
28     #  Add the name of the test, and the variant to the request
29     #
30     echo "Test-Name = \"$BASE\"," >> .request
31     echo 'Test-Number = ' $NUMBER >> .request
32
33     mv .request .cache/$BASE:$NUMBER
34   done
35 done
36
37 echo "Running tests..."
38
39 (cd .cache;ls -1  > ../.foo)
40 rm -f .bar
41 for x in `cat .foo`
42 do
43    echo "-f .cache/$x" >> .bar
44 done
45
46 ../main/radclient `cat .bar` -xFd . 127.0.0.1:$PORT auth testing123 > radclient.log 2>&1
47
48 for x in `cat .foo`
49 do
50   RESULT=`egrep ^\\.cache/$x radclient.log | sed 's/.* //'`
51   if [ "$RESULT" = "2" ]; then
52       echo "$x : Success"
53     else
54       echo "$x : FAILED"
55       RCODE=1
56   fi
57 done
58
59
60 if [ "$RCODE" = "0" ]
61 then
62     rm -f radiusd.log radclient.log 
63     echo "All tests succeeded"
64 else
65     echo "See radclient.log for more details"
66 fi
67
68 exit $RCODE