Bump to version 1.22.1
[platform/upstream/busybox.git] / testsuite / busybox.tests
1 #!/bin/sh
2
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.
6
7 . ./testing.sh
8
9 HELPDUMP=`true | busybox 2>&1 | cat`
10
11 # We need to test under calling the binary under other names.
12
13 optional FEATURE_VERBOSE_USAGE
14 testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n\n" "" ""
15 SKIP=
16
17 ln -s `which busybox` busybox-suffix
18 for i in busybox ./busybox-suffix
19 do
20         # The gratuitous "\n"s are due to a shell idiosyncrasy:
21         # environment variables seem to strip trailing whitespace.
22
23         testing "" "$i" "$HELPDUMP\n\n" "" ""
24
25         testing "$i unknown" "$i unknown 2>&1" \
26                 "unknown: applet not found\n" "" ""
27
28         testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
29
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=
35
36         testing "$i --help unknown" "$i --help unknown 2>&1" \
37                 "unknown: applet not found\n" "" ""
38 done
39 rm busybox-suffix
40
41 ln -s `which busybox` unknown
42
43 testing "busybox as unknown name" "./unknown 2>&1" \
44         "unknown: applet not found\n" "" ""
45 rm unknown
46
47 exit $FAILCOUNT