]>
The Tcpdump Group git mirrors - tcpdump/blob - tests/TESTrun.sh
5 echo RUNNING from
${srcdir}
12 srcdir=$(cd $srcdir && pwd)
14 # this should be run from the compiled build directory,
15 # with srcdir= set to wherever the source code is.
16 # not from the tests directory.
17 echo RUNNING from ${srcdir}
19 passedfile=$(pwd)/tests/.passed
20 failedfile=$(pwd)/tests/.failed
21 failureoutput=$(pwd)/tests/failure-outputs.txt
25 cat /dev/null > ${failureoutput}
29 for i in ${srcdir}/tests/*.sh
31 case $i in ${srcdir}/tests/TEST*.sh) continue;; esac
34 passed=`cat ${passedfile}`
35 failed=`cat ${failedfile}`
41 cat ${srcdir}/tests/TESTLIST | while read name input output options
48 [ "$only" != "" -a "$name" != "$only" ] && continue
49 export SRCDIR=${srcdir}
50 # I hate shells with their stupid, useless subshells.
51 passed=`cat ${passedfile}`
52 failed=`cat ${failedfile}`
53 (cd tests # run TESTonce in tests directory
55 if ${srcdir}/tests/TESTonce $name ${srcdir}/tests/$input ${srcdir}/tests/$output "$options"
57 passed=`expr $passed + 1`
58 echo $passed >${passedfile}
60 failed=`expr $failed + 1`
61 echo $failed >${failedfile}
63 if [ -d COREFILES ]; then
64 if [ -f core ]; then mv core COREFILES/$name.core; fi
67 [ "$only" != "" -a "$name" = "$only" ] && break
69 # I hate shells with their stupid, useless subshells.
70 passed=`cat ${passedfile}`
71 failed=`cat ${failedfile}`
76 echo $passed >${passedfile}
77 echo $failed >${failedfile}
86 echo "Usage: $0 [test_name]"
90 # exit with number of failing tests.
91 echo '------------------------------------------------'
92 printf "%4u tests failed\n" $failed
93 printf "%4u tests passed\n" $passed