blob: ba422a40c42b4f6c8118efd4c6cb5eeb7ed1178a [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
10# We'll assume "cat" is built in, because we need some other command to test.
11
12HELPDUMP=`$COMMAND`
13
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.
16
17ln -s `which "$COMMAND"` busybox-suffix
18ln -s `which "$COMMAND"` unknown
19
20for i in busybox busybox-suffix
21do
22 # The gratuitous "\n"s are due to a shell idiosyncrasy:
23 # environment variables seem to strip trailing whitespace.
24
25 testing "$i" "" "$HELPDUMP\n\n" "" ""
26
27 testing "$i cat" "cat" "moo" "" "moo"
28
29 testing "$i unknown" "unknown 2>&1" \
30 "unknown: applet not found\n" "" ""
31
32 testing "$i --help" "--help 2>&1" "$HELPDUMP\n\n" "" ""
33
34 testing "$i --help cat" "--help cat 2>&1 | grep prints" \
35 "Concatenates FILE(s) and prints them to stdout.\n" "" ""
36
37 testing "$i --help unknown" "--help unknown 2>&1" \
38 "unknown: applet not found\n" "" ""
39
40 COMMAND=./busybox-suffix
41done
42
43COMMAND="./unknown"
44testing "busybox as unknown name" "2>&1" "unknown: applet not found\n" "" ""
45
46rm -f busybox-suffix unknown
47
Rob Landleyb766c392005-09-04 11:10:37 +000048exit $FAILCOUNT