2005-09-04 11:10:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Tests for busybox applet itself.
|
|
|
|
# Copyright 2005 by Rob Landley <rob@landley.net>
|
|
|
|
# Licensed under GPL v2, see file LICENSE for details.
|
|
|
|
|
2009-11-04 23:41:22 +00:00
|
|
|
. ./testing.sh
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2010-01-16 01:49:40 +00:00
|
|
|
HELPDUMP=`true | busybox 2>&1 | cat`
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2005-11-07 08:50:53 +00:00
|
|
|
# We need to test under calling the binary under other names.
|
2005-09-04 11:10:37 +00:00
|
|
|
|
|
|
|
|
2010-01-16 01:49:40 +00:00
|
|
|
testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n\n" "" ""
|
2005-09-05 16:27:19 +00:00
|
|
|
|
2006-03-16 15:20:45 +00:00
|
|
|
ln -s `which busybox` busybox-suffix
|
|
|
|
for i in busybox ./busybox-suffix
|
2005-09-04 11:10:37 +00:00
|
|
|
do
|
|
|
|
# The gratuitous "\n"s are due to a shell idiosyncrasy:
|
|
|
|
# environment variables seem to strip trailing whitespace.
|
|
|
|
|
2006-03-16 15:20:45 +00:00
|
|
|
testing "" "$i" "$HELPDUMP\n\n" "" ""
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2006-03-16 15:20:45 +00:00
|
|
|
testing "$i unknown" "$i unknown 2>&1" \
|
2005-09-04 11:10:37 +00:00
|
|
|
"unknown: applet not found\n" "" ""
|
|
|
|
|
2006-03-16 15:20:45 +00:00
|
|
|
testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2005-11-07 08:50:53 +00:00
|
|
|
optional CAT
|
2006-03-16 15:20:45 +00:00
|
|
|
testing "" "$i cat" "moo" "" "moo"
|
2010-01-16 01:49:40 +00:00
|
|
|
testing "$i --help cat" "$i --help cat 2>&1 | grep print" \
|
|
|
|
"Concatenate FILEs and print them to stdout\n" "" ""
|
2005-11-07 08:50:53 +00:00
|
|
|
optional ""
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2006-03-16 15:20:45 +00:00
|
|
|
testing "$i --help unknown" "$i --help unknown 2>&1" \
|
2005-09-04 11:10:37 +00:00
|
|
|
"unknown: applet not found\n" "" ""
|
|
|
|
done
|
2006-03-16 15:20:45 +00:00
|
|
|
rm busybox-suffix
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2006-03-16 15:20:45 +00:00
|
|
|
ln -s `which busybox` unknown
|
2006-02-22 23:38:57 +00:00
|
|
|
|
2006-03-16 15:20:45 +00:00
|
|
|
testing "busybox as unknown name" "./unknown 2>&1" \
|
|
|
|
"unknown: applet not found\n" "" ""
|
|
|
|
rm unknown
|
2006-02-22 23:38:57 +00:00
|
|
|
|
2005-09-04 11:10:37 +00:00
|
|
|
exit $FAILCOUNT
|