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 if [ ${#COMMAND} -eq 0 ]; then COMMAND=busybox; fi
10 # We'll assume "cat" is built in, because we need some other command to test.
14 # The gratuitous "\n"s are due to a shell idiosyncrasy: environment variables
15 # seem to strip trailing whitespace, which makes cmp and diff unhappy.
17 ln -s `which "$COMMAND"` busybox-suffix
18 ln -s `which "$COMMAND"` unknown
20 testing "busybox --help busybox" "--help busybox" "$HELPDUMP\n\n" "" ""
22 for i in busybox busybox-suffix
24 # The gratuitous "\n"s are due to a shell idiosyncrasy:
25 # environment variables seem to strip trailing whitespace.
27 testing "$i" "" "$HELPDUMP\n\n" "" ""
29 testing "$i cat" "cat" "moo" "" "moo"
31 testing "$i unknown" "unknown 2>&1" \
32 "unknown: applet not found\n" "" ""
34 testing "$i --help" "--help 2>&1" "$HELPDUMP\n\n" "" ""
36 testing "$i --help cat" "--help cat 2>&1 | grep prints" \
37 "Concatenates FILE(s) and prints them to stdout.\n" "" ""
39 testing "$i --help unknown" "--help unknown 2>&1" \
40 "unknown: applet not found\n" "" ""
42 COMMAND=./busybox-suffix
46 testing "busybox as unknown name" "2>&1" "unknown: applet not found\n" "" ""
48 rm -f busybox-suffix unknown