2005-09-04 16:40:37 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Tests for busybox applet itself.
|
|
|
|
# Copyright 2005 by Rob Landley <rob@landley.net>
|
2010-08-16 23:44:46 +05:30
|
|
|
# Licensed under GPLv2, see file LICENSE in this source tree.
|
2005-09-04 16:40:37 +05:30
|
|
|
|
2009-11-05 05:11:22 +05:30
|
|
|
. ./testing.sh
|
2005-09-04 16:40:37 +05:30
|
|
|
|
2016-06-19 21:45:33 +05:30
|
|
|
ln -s `which busybox` unknown
|
|
|
|
|
|
|
|
testing "busybox as unknown name" "./unknown 2>&1" \
|
|
|
|
"unknown: applet not found\n" "" ""
|
|
|
|
rm unknown
|
|
|
|
|
|
|
|
# We need busybox --help to be enabled for the rest of tests
|
|
|
|
test x"$CONFIG_BUSYBOX" = x"y" \
|
|
|
|
|| { echo "SKIPPED: busybox --help"; exit 0; }
|
|
|
|
|
2010-01-16 07:19:40 +05:30
|
|
|
HELPDUMP=`true | busybox 2>&1 | cat`
|
2005-09-04 16:40:37 +05:30
|
|
|
|
2005-11-07 14:20:53 +05:30
|
|
|
# We need to test under calling the binary under other names.
|
2005-09-04 16:40:37 +05:30
|
|
|
|
2010-05-11 08:02:04 +05:30
|
|
|
optional FEATURE_VERBOSE_USAGE
|
2010-01-16 07:19:40 +05:30
|
|
|
testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n\n" "" ""
|
2010-05-11 07:23:57 +05:30
|
|
|
SKIP=
|
2005-09-05 21:57:19 +05:30
|
|
|
|
2006-03-16 20:50:45 +05:30
|
|
|
ln -s `which busybox` busybox-suffix
|
|
|
|
for i in busybox ./busybox-suffix
|
2005-09-04 16:40:37 +05:30
|
|
|
do
|
|
|
|
# The gratuitous "\n"s are due to a shell idiosyncrasy:
|
|
|
|
# environment variables seem to strip trailing whitespace.
|
|
|
|
|
2006-03-16 20:50:45 +05:30
|
|
|
testing "" "$i" "$HELPDUMP\n\n" "" ""
|
2005-09-04 16:40:37 +05:30
|
|
|
|
2006-03-16 20:50:45 +05:30
|
|
|
testing "$i unknown" "$i unknown 2>&1" \
|
2005-09-04 16:40:37 +05:30
|
|
|
"unknown: applet not found\n" "" ""
|
|
|
|
|
2006-03-16 20:50:45 +05:30
|
|
|
testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
|
2005-09-04 16:40:37 +05:30
|
|
|
|
2010-05-11 08:02:04 +05:30
|
|
|
optional FEATURE_VERBOSE_USAGE CAT
|
2006-03-16 20:50:45 +05:30
|
|
|
testing "" "$i cat" "moo" "" "moo"
|
2010-01-16 07:19:40 +05:30
|
|
|
testing "$i --help cat" "$i --help cat 2>&1 | grep print" \
|
|
|
|
"Concatenate FILEs and print them to stdout\n" "" ""
|
2010-05-11 07:23:57 +05:30
|
|
|
SKIP=
|
2005-09-04 16:40:37 +05:30
|
|
|
|
2006-03-16 20:50:45 +05:30
|
|
|
testing "$i --help unknown" "$i --help unknown 2>&1" \
|
2005-09-04 16:40:37 +05:30
|
|
|
"unknown: applet not found\n" "" ""
|
|
|
|
done
|
2006-03-16 20:50:45 +05:30
|
|
|
rm busybox-suffix
|
2005-09-04 16:40:37 +05:30
|
|
|
|
|
|
|
exit $FAILCOUNT
|