3 [ -n "$srcdir" ] || srcdir=$(pwd)
4 [ -n "$bindir" ] || bindir=$(dirname $(pwd))
9 function run_applet_testcase
17 local uc_applet=$(echo $applet | tr a-z A-Z)
18 local testname=$(basename $testcase)
20 if grep -q "^# CONFIG_${uc_applet} is not set$" $bindir/.config; then
21 echo UNTESTED: $testname
25 if grep -q "^# FEATURE: " $testcase; then
26 local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
28 if grep -q "^# ${feature} is not set$" $bindir/.config; then
29 echo UNTESTED: $testname
38 d=$srcdir sh -x -e $testcase >.logfile.txt 2>&1
42 if [ $verbose -gt 0 ]; then
65 for testcase in $srcdir/$applet/*; do
66 if [ "$testcase" = "$srcdir/$applet/CVS" ]; then
70 if run_applet_testcase $applet $testcase; then
84 if [ x"$1" = x"-v" ]; then
86 export VERBOSE=$verbose
91 applets=$(cd $srcdir ; for i in $@; do ls ${i}* ; done)
96 # Populate a directory with links to all busybox applets
98 LINKSDIR="${bindir}/runtest-tempdir-links"
99 rm -rf "$LINKSDIR" 2>/dev/null
101 for i in $(sed 's@/[a-z0-9/\[]*/@@' $bindir/busybox.links 2>/dev/null)
103 ln -s $bindir/busybox "$LINKSDIR"/$i
106 # Set up option flags so tests can be selective.
108 configfile=${bindir:-../../}/.config
109 export OPTIONFLAGS=:$(echo $(sed -nr 's/^CONFIG_(.*)=.*/\1/p' $configfile) | sed 's/ /:/g')
111 for applet in $applets; do
112 if [ "$applet" = "links" ]; then continue; fi
113 if [ "$applet" != "CVS" -a -d "$srcdir/$applet" ]; then
114 if run_applet_tests $applet; then
121 # Is this a new-style test?
122 applet=$(echo "$applet" | sed -n 's/\.tests$//p')
123 if [ ${#applet} -ne 0 ]
125 if [ ! -h "$LINKSDIR/$applet" ] && [ ${applet:0:4} != "all_" ]
127 echo "SKIPPED: $applet (not built)"
130 PATH="$LINKSDIR":$srcdir:$bindir:$PATH \
131 "${srcdir:-.}/$applet".tests
132 if [ $? -ne 0 ]; then status=1; fi