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
13 # We'll assume "cat" is built in, because we need some other command to test.
17 # The gratuitous "\n"s are due to a shell idiosyncrasy: environment variables
18 # seem to strip trailing whitespace, which makes cmp and diff unhappy.
20 ln -s `which "$COMMAND"` busybox-suffix
21 ln -s `which "$COMMAND"` unknown
23 testing "busybox --help busybox" "--help busybox" "$HELPDUMP\n\n" "" ""
25 for i in busybox busybox-suffix
27 # The gratuitous "\n"s are due to a shell idiosyncrasy:
28 # environment variables seem to strip trailing whitespace.
30 testing "$i" "" "$HELPDUMP\n\n" "" ""
32 testing "$i cat" "cat" "moo" "" "moo"
34 testing "$i unknown" "unknown 2>&1" \
35 "unknown: applet not found\n" "" ""
37 testing "$i --help" "--help 2>&1" "$HELPDUMP\n\n" "" ""
39 testing "$i --help cat" "--help cat 2>&1 | grep prints" \
40 "Concatenates FILE(s) and prints them to stdout.\n" "" ""
42 testing "$i --help unknown" "--help unknown 2>&1" \
43 "unknown: applet not found\n" "" ""
45 COMMAND=./busybox-suffix
49 testing "busybox as unknown name" "2>&1" "unknown: applet not found\n" "" ""
51 rm -f busybox-suffix unknown