blob: 7595d061fdeaea9414b8c18a1842db6027745a78 [file] [log] [blame]
Rob Landleyb766c392005-09-04 11:10:37 +00001#!/bin/sh
2
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.
6
7if [ ${#COMMAND} -eq 0 ]; then COMMAND=busybox; fi
8. testing.sh
9
Bernhard Reutner-Fischerb47a74f2005-09-23 15:44:46 +000010# Depends on nothing
11_BB_CONFIG_DEP=""
12
Rob Landleyb766c392005-09-04 11:10:37 +000013# We'll assume "cat" is built in, because we need some other command to test.
14
15HELPDUMP=`$COMMAND`
16
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.
19
20ln -s `which "$COMMAND"` busybox-suffix
21ln -s `which "$COMMAND"` unknown
22
Rob Landleyf6acb662005-09-05 16:27:19 +000023testing "busybox --help busybox" "--help busybox" "$HELPDUMP\n\n" "" ""
24
Rob Landleyb766c392005-09-04 11:10:37 +000025for i in busybox busybox-suffix
26do
27 # The gratuitous "\n"s are due to a shell idiosyncrasy:
28 # environment variables seem to strip trailing whitespace.
29
30 testing "$i" "" "$HELPDUMP\n\n" "" ""
31
32 testing "$i cat" "cat" "moo" "" "moo"
33
34 testing "$i unknown" "unknown 2>&1" \
35 "unknown: applet not found\n" "" ""
36
37 testing "$i --help" "--help 2>&1" "$HELPDUMP\n\n" "" ""
38
39 testing "$i --help cat" "--help cat 2>&1 | grep prints" \
40 "Concatenates FILE(s) and prints them to stdout.\n" "" ""
41
42 testing "$i --help unknown" "--help unknown 2>&1" \
43 "unknown: applet not found\n" "" ""
44
45 COMMAND=./busybox-suffix
46done
47
48COMMAND="./unknown"
49testing "busybox as unknown name" "2>&1" "unknown: applet not found\n" "" ""
50
51rm -f busybox-suffix unknown
52
Rob Landleyb766c392005-09-04 11:10:37 +000053exit $FAILCOUNT