blob: b69272593a66bc610ae5efaff3ec5f100420b524 [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
Rob Landleyb766c392005-09-04 11:10:37 +000010HELPDUMP=`$COMMAND`
11
Rob Landley48c61572005-11-07 08:50:53 +000012# We need to test under calling the binary under other names.
Rob Landleyb766c392005-09-04 11:10:37 +000013
14ln -s `which "$COMMAND"` busybox-suffix
15ln -s `which "$COMMAND"` unknown
16
Rob Landleyf6acb662005-09-05 16:27:19 +000017testing "busybox --help busybox" "--help busybox" "$HELPDUMP\n\n" "" ""
18
Rob Landleyb766c392005-09-04 11:10:37 +000019for i in busybox busybox-suffix
20do
21 # The gratuitous "\n"s are due to a shell idiosyncrasy:
22 # environment variables seem to strip trailing whitespace.
23
24 testing "$i" "" "$HELPDUMP\n\n" "" ""
25
Rob Landleyb766c392005-09-04 11:10:37 +000026 testing "$i unknown" "unknown 2>&1" \
27 "unknown: applet not found\n" "" ""
28
29 testing "$i --help" "--help 2>&1" "$HELPDUMP\n\n" "" ""
30
Rob Landley48c61572005-11-07 08:50:53 +000031 optional CAT
32 testing "$i cat" "cat" "moo" "" "moo"
Rob Landleyb766c392005-09-04 11:10:37 +000033 testing "$i --help cat" "--help cat 2>&1 | grep prints" \
34 "Concatenates FILE(s) and prints them to stdout.\n" "" ""
Rob Landley48c61572005-11-07 08:50:53 +000035 optional ""
Rob Landleyb766c392005-09-04 11:10:37 +000036
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