blob: 7c44b1ed6a3135d96f51e79110abe692cf2c9b2f [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
Mike Frysingercaa79402009-11-04 18:41:22 -05007. ./testing.sh
Rob Landleyb766c392005-09-04 11:10:37 +00008
Rob Landley4bb1b042006-03-16 15:20:45 +00009HELPDUMP=`busybox`
Rob Landleyb766c392005-09-04 11:10:37 +000010
Rob Landley48c61572005-11-07 08:50:53 +000011# We need to test under calling the binary under other names.
Rob Landleyb766c392005-09-04 11:10:37 +000012
Rob Landleyb766c392005-09-04 11:10:37 +000013
Rob Landley4bb1b042006-03-16 15:20:45 +000014testing "busybox --help busybox" "busybox --help busybox" "$HELPDUMP\n\n" "" ""
Rob Landleyf6acb662005-09-05 16:27:19 +000015
Rob Landley4bb1b042006-03-16 15:20:45 +000016ln -s `which busybox` busybox-suffix
17for i in busybox ./busybox-suffix
Rob Landleyb766c392005-09-04 11:10:37 +000018do
19 # The gratuitous "\n"s are due to a shell idiosyncrasy:
20 # environment variables seem to strip trailing whitespace.
21
Rob Landley4bb1b042006-03-16 15:20:45 +000022 testing "" "$i" "$HELPDUMP\n\n" "" ""
Rob Landleyb766c392005-09-04 11:10:37 +000023
Rob Landley4bb1b042006-03-16 15:20:45 +000024 testing "$i unknown" "$i unknown 2>&1" \
Rob Landleyb766c392005-09-04 11:10:37 +000025 "unknown: applet not found\n" "" ""
26
Rob Landley4bb1b042006-03-16 15:20:45 +000027 testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
Rob Landleyb766c392005-09-04 11:10:37 +000028
Rob Landley48c61572005-11-07 08:50:53 +000029 optional CAT
Rob Landley4bb1b042006-03-16 15:20:45 +000030 testing "" "$i cat" "moo" "" "moo"
31 testing "$i --help cat" "$i --help cat 2>&1 | grep prints" \
Rob Landleyb766c392005-09-04 11:10:37 +000032 "Concatenates FILE(s) and prints them to stdout.\n" "" ""
Rob Landley48c61572005-11-07 08:50:53 +000033 optional ""
Rob Landleyb766c392005-09-04 11:10:37 +000034
Rob Landley4bb1b042006-03-16 15:20:45 +000035 testing "$i --help unknown" "$i --help unknown 2>&1" \
Rob Landleyb766c392005-09-04 11:10:37 +000036 "unknown: applet not found\n" "" ""
Rob Landleyb766c392005-09-04 11:10:37 +000037done
Rob Landley4bb1b042006-03-16 15:20:45 +000038rm busybox-suffix
Rob Landleyb766c392005-09-04 11:10:37 +000039
Rob Landley4bb1b042006-03-16 15:20:45 +000040ln -s `which busybox` unknown
Rob Landleyb766c392005-09-04 11:10:37 +000041
Rob Landley4bb1b042006-03-16 15:20:45 +000042testing "busybox as unknown name" "./unknown 2>&1" \
43 "unknown: applet not found\n" "" ""
44rm unknown
Mike Frysinger23ca7252006-02-22 23:38:57 +000045
Rob Landleyb766c392005-09-04 11:10:37 +000046exit $FAILCOUNT