]> The Tcpdump Group git mirrors - tcpdump/blob - tests/TESTrun.sh
CVE-2017-13047/ES-IS: put an existing bounds check right
[tcpdump] / tests / TESTrun.sh
1 #!/bin/sh
2
3 mkdir -p NEW
4 mkdir -p DIFF
5 passed=0
6 failed=0
7 cat /dev/null > failure-outputs.txt
8
9 runComplexTests()
10 {
11 for i in *.sh
12 do
13 case $i in TEST*.sh) continue;; esac
14 sh ./$i
15 done
16 }
17
18 runSimpleTests()
19 {
20 passed=`cat .passed`
21 failed=`cat .failed`
22 only=$1
23 cat TESTLIST | while read name input output options
24 do
25 case $name in
26 \#*) continue;;
27 '') continue;;
28 esac
29 rm -f core
30 [ "$only" != "" -a "$name" != "$only" ] && continue
31 if ./TESTonce $name $input $output "$options"
32 then
33 passed=`expr $passed + 1`
34 echo $passed >.passed
35 else
36 failed=`expr $failed + 1`
37 echo $failed >.failed
38 fi
39 [ "$only" != "" -a "$name" = "$only" ] && break
40 done
41 # I hate shells with their stupid, useless subshells.
42 passed=`cat .passed`
43 failed=`cat .failed`
44 }
45
46 echo $passed >.passed
47 echo $failed >.failed
48 if [ $# -eq 0 ]
49 then
50 runComplexTests
51 runSimpleTests
52 elif [ $# -eq 1 ]
53 then
54 runSimpleTests $1
55 else
56 echo "Usage: $0 [test_name]"
57 exit 30
58 fi
59
60 # exit with number of failing tests.
61 echo '------------------------------------------------'
62 printf "%4u tests failed\n" $failed
63 printf "%4u tests passed\n" $passed
64 echo
65 echo
66 cat failure-outputs.txt
67 echo
68 echo
69 exit $failed