Tomato 1.28
[tomato.git] / release / src / router / busybox / testsuite / busybox.tests
blob26536c656e3c0500d0e77d7afa4f260f37829ac1
1 #!/bin/sh
3 # Tests for busybox applet itself.
4 # Copyright 2005 by Rob Landley <rob@landley.net>
5 # Licensed under GPL v2, see file LICENSE for details.
7 . testing.sh
9 HELPDUMP=`busybox`
11 # We need to test under calling the binary under other names.
14 testing "busybox --help busybox" "busybox --help busybox" "$HELPDUMP\n\n" "" ""
16 ln -s `which busybox` busybox-suffix
17 for i in busybox ./busybox-suffix
19 # The gratuitous "\n"s are due to a shell idiosyncrasy:
20 # environment variables seem to strip trailing whitespace.
22 testing "" "$i" "$HELPDUMP\n\n" "" ""
24 testing "$i unknown" "$i unknown 2>&1" \
25 "unknown: applet not found\n" "" ""
27 testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
29 optional CAT
30 testing "" "$i cat" "moo" "" "moo"
31 testing "$i --help cat" "$i --help cat 2>&1 | grep prints" \
32 "Concatenates FILE(s) and prints them to stdout.\n" "" ""
33 optional ""
35 testing "$i --help unknown" "$i --help unknown 2>&1" \
36 "unknown: applet not found\n" "" ""
37 done
38 rm busybox-suffix
40 ln -s `which busybox` unknown
42 testing "busybox as unknown name" "./unknown 2>&1" \
43 "unknown: applet not found\n" "" ""
44 rm unknown
46 exit $FAILCOUNT