File: runtests.sh

package info (click to toggle)
freeradius 3.0.12%2Bdfsg-5%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 21,144 kB
  • ctags: 11,887
  • sloc: ansic: 109,067; sh: 5,176; perl: 2,648; sql: 1,397; python: 1,161; makefile: 374; xml: 62; tcl: 35; sed: 23; ruby: 22
file content (51 lines) | stat: -rwxr-xr-x 996 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash

: ${BIN_PATH=./}
: ${PORT=12340}
: ${HOME_PORT=12350}
: ${SECRET=testing123}

rm -f verbose.log
RCODE=0

echo "Running tests:"
for NAME in $@
do
  TOTAL=`grep TESTS $NAME | sed 's/.*TESTS//'`

  #
  #  Each test may have multiple variants.
  #
  for NUMBER in `echo $TOTAL`
  do
    cp $NAME .request
    BASE=`echo $NAME | sed 's,.*/,,'`

    #
    #  Add the name of the test, and the variant to the request
    #
    echo "Test-Name = \"$BASE\"," >> .request
    echo 'Test-Number = ' $NUMBER >> .request

    rm ./radclient.log > /dev/null 2>&1
    $BIN_PATH/radclient -f .request -xF -D ./ 127.0.0.1:$PORT auth $SECRET 1> ./radclient.log
    if [ "$?" = "0" ]; then
      echo "${BASE}_${NUMBER} : Success"
    else
      echo "${BASE}_${NUMBER} : FAILED"
      cat ./radclient.log
      RCODE=1
    fi
  done
done


if [ "$RCODE" = "0" ]
then
    rm -f radiusd.log radclient.log
    echo "All tests succeeded"
else
    echo "See radclient.log for more details"
fi

exit $RCODE