1 |
#!/bin/sh |
#!/bin/sh |
|
|
|
2 |
# Usage: |
# Usage: |
3 |
# runtest [applet1] [applet2...] |
# runtest [applet1] [applet2...] |
4 |
|
|
5 |
# Helper for helpers. Oh my... |
. ./testing.sh |
|
test x"$ECHO" != x"" || { |
|
|
ECHO="echo" |
|
|
test x"`echo -ne`" = x"" || { |
|
|
# Compile and use a replacement 'echo' which understands -e -n |
|
|
ECHO="$PWD/echo-ne" |
|
|
test -x "$ECHO" || { |
|
|
gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1 |
|
|
} |
|
|
} |
|
|
export ECHO |
|
|
} |
|
6 |
|
|
7 |
# Run one old-style test. |
# Run one old-style test. |
8 |
# Tests are stored in applet/testcase shell scripts. |
# Tests are stored in applet/testcase shell scripts. |
92 |
fi |
fi |
93 |
|
|
94 |
implemented=$( |
implemented=$( |
95 |
|
printf "busybox " # always implemented |
96 |
"$bindir/busybox" 2>&1 | |
"$bindir/busybox" 2>&1 | |
97 |
while read line; do |
while read line; do |
98 |
if [ x"$line" = x"Currently defined functions:" ]; then |
if [ x"$line" = x"Currently defined functions:" ]; then |
110 |
# Populate a directory with links to all busybox applets |
# Populate a directory with links to all busybox applets |
111 |
|
|
112 |
LINKSDIR="$bindir/runtest-tempdir-links" |
LINKSDIR="$bindir/runtest-tempdir-links" |
113 |
|
|
114 |
|
# Comment this line out if you have put a different binary in $LINKSDIR |
115 |
|
# (say, a "standard" tool's binary) in order to run tests against it: |
116 |
rm -rf "$LINKSDIR" 2>/dev/null |
rm -rf "$LINKSDIR" 2>/dev/null |
117 |
mkdir "$LINKSDIR" |
|
118 |
|
mkdir "$LINKSDIR" 2>/dev/null |
119 |
for i in $implemented; do |
for i in $implemented; do |
120 |
ln -s "$bindir/busybox" "$LINKSDIR/$i" |
# Note: if $LINKSDIR/applet exists, we do not overwrite it. |
121 |
|
# Useful if one wants to run tests against a standard utility, |
122 |
|
# not an applet. |
123 |
|
ln -s "$bindir/busybox" "$LINKSDIR/$i" 2>/dev/null |
124 |
done |
done |
125 |
|
|
126 |
# Set up option flags so tests can be selective. |
# Set up option flags so tests can be selective. |
138 |
|
|
139 |
# Is this a new-style test? |
# Is this a new-style test? |
140 |
if [ -f "$applet.tests" ]; then |
if [ -f "$applet.tests" ]; then |
141 |
if [ ! -h "$LINKSDIR/$applet" ]; then |
if [ ! -e "$LINKSDIR/$applet" ]; then |
142 |
# (avoiding bash'ism "${applet:0:4}") |
# (avoiding bash'ism "${applet:0:4}") |
143 |
if ! echo "$applet" | grep "^all_" >/dev/null; then |
if ! echo "$applet" | grep "^all_" >/dev/null; then |
144 |
echo "SKIPPED: $applet (not built)" |
echo "SKIPPED: $applet (not built)" |