blob: 91dbc797eea17bc0a7e7a741d1480e9012b92bd9 [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
Rob Landleyf6acb662005-09-05 16:27:19 +000020testing "busybox --help busybox" "--help busybox" "$HELPDUMP\n\n" "" ""
21
Rob Landleyb766c392005-09-04 11:10:37 +000022for i in busybox busybox-suffix
23do
24 # The gratuitous "\n"s are due to a shell idiosyncrasy:
25 # environment variables seem to strip trailing whitespace.
26
27 testing "$i" "" "$HELPDUMP\n\n" "" ""
28
29 testing "$i cat" "cat" "moo" "" "moo"
30
31 testing "$i unknown" "unknown 2>&1" \
32 "unknown: applet not found\n" "" ""
33
34 testing "$i --help" "--help 2>&1" "$HELPDUMP\n\n" "" ""
35
36 testing "$i --help cat" "--help cat 2>&1 | grep prints" \
37 "Concatenates FILE(s) and prints them to stdout.\n" "" ""
38
39 testing "$i --help unknown" "--help unknown 2>&1" \
40 "unknown: applet not found\n" "" ""
41
42 COMMAND=./busybox-suffix
43done
44
45COMMAND="./unknown"
46testing "busybox as unknown name" "2>&1" "unknown: applet not found\n" "" ""
47
48rm -f busybox-suffix unknown
49
Rob Landleyb766c392005-09-04 11:10:37 +000050exit $FAILCOUNT