2005-09-04 11:10:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Tests for busybox applet itself.
|
|
|
|
# Copyright 2005 by Rob Landley <rob@landley.net>
|
2010-08-16 20:14:46 +02:00
|
|
|
# Licensed under GPLv2, see file LICENSE in this source tree.
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2009-11-04 18:41:22 -05:00
|
|
|
. ./testing.sh
|
2018-02-09 09:01:19 +00:00
|
|
|
test -f "$bindir/.config" && . "$bindir/.config"
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2016-06-19 18:15:33 +02:00
|
|
|
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 02:49:40 +01:00
|
|
|
HELPDUMP=`true | busybox 2>&1 | cat`
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2010-05-11 04:32:04 +02:00
|
|
|
optional FEATURE_VERBOSE_USAGE
|
2018-02-09 09:01:19 +00:00
|
|
|
testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n" "" ""
|
2010-05-11 03:53:57 +02:00
|
|
|
SKIP=
|
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
|
2018-02-09 09:01:19 +00:00
|
|
|
testing "$i" "$i 2>&1 | cat" "$HELPDUMP\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" "" ""
|
|
|
|
|
2018-02-09 09:01:19 +00:00
|
|
|
testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n" "" ""
|
2005-09-04 11:10:37 +00:00
|
|
|
|
2010-05-11 04:32:04 +02:00
|
|
|
optional FEATURE_VERBOSE_USAGE CAT
|
2006-03-16 15:20:45 +00:00
|
|
|
testing "" "$i cat" "moo" "" "moo"
|
2018-02-09 09:01:19 +00:00
|
|
|
testing "$i --help cat" "$i --help cat 2>&1 | grep Print" \
|
|
|
|
"Print FILEs to stdout\n" "" ""
|
2010-05-11 03:53:57 +02:00
|
|
|
SKIP=
|
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
|
|
|
|
|
|
|
exit $FAILCOUNT
|