Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / busybox / testsuite / busybox.tests
blob04fea3ea24e2e4f0befb28ca31979787ae4c674a
1 #!/bin/sh
3 # Tests for busybox applet itself.
4 # Copyright 2005 by Rob Landley <rob@landley.net>
5 # Licensed under GPLv2, see file LICENSE in this source tree.
7 . ./testing.sh
9 HELPDUMP=`true | busybox 2>&1 | cat`
11 # We need to test under calling the binary under other names.
13 optional FEATURE_VERBOSE_USAGE
14 testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n\n" "" ""
15 SKIP=
17 ln -s `which busybox` busybox-suffix
18 for i in busybox ./busybox-suffix
20 # The gratuitous "\n"s are due to a shell idiosyncrasy:
21 # environment variables seem to strip trailing whitespace.
23 testing "" "$i" "$HELPDUMP\n\n" "" ""
25 testing "$i unknown" "$i unknown 2>&1" \
26 "unknown: applet not found\n" "" ""
28 testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
30 optional FEATURE_VERBOSE_USAGE CAT
31 testing "" "$i cat" "moo" "" "moo"
32 testing "$i --help cat" "$i --help cat 2>&1 | grep print" \
33 "Concatenate FILEs and print them to stdout\n" "" ""
34 SKIP=
36 testing "$i --help unknown" "$i --help unknown 2>&1" \
37 "unknown: applet not found\n" "" ""
38 done
39 rm busybox-suffix
41 ln -s `which busybox` unknown
43 testing "busybox as unknown name" "./unknown 2>&1" \
44 "unknown: applet not found\n" "" ""
45 rm unknown
47 exit $FAILCOUNT