Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Tests for busybox applet itself. |
| 4 | # Copyright 2005 by Rob Landley <rob@landley.net> |
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 5 | # Licensed under GPLv2, see file LICENSE in this source tree. |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 6 | |
Mike Frysinger | caa7940 | 2009-11-04 18:41:22 -0500 | [diff] [blame] | 7 | . ./testing.sh |
Ron Yorston | ecaec1d | 2018-02-09 09:01:19 +0000 | [diff] [blame] | 8 | test -f "$bindir/.config" && . "$bindir/.config" |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 9 | |
Denys Vlasenko | 015db58 | 2016-06-19 18:15:33 +0200 | [diff] [blame] | 10 | ln -s `which busybox` unknown |
| 11 | |
| 12 | testing "busybox as unknown name" "./unknown 2>&1" \ |
| 13 | "unknown: applet not found\n" "" "" |
| 14 | rm unknown |
| 15 | |
| 16 | # We need busybox --help to be enabled for the rest of tests |
| 17 | test x"$CONFIG_BUSYBOX" = x"y" \ |
| 18 | || { echo "SKIPPED: busybox --help"; exit 0; } |
| 19 | |
Denys Vlasenko | e208279 | 2010-01-16 02:49:40 +0100 | [diff] [blame] | 20 | HELPDUMP=`true | busybox 2>&1 | cat` |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 21 | |
Denys Vlasenko | c0211e9 | 2010-05-11 04:32:04 +0200 | [diff] [blame] | 22 | optional FEATURE_VERBOSE_USAGE |
Ron Yorston | ecaec1d | 2018-02-09 09:01:19 +0000 | [diff] [blame] | 23 | testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n" "" "" |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 24 | SKIP= |
Rob Landley | f6acb66 | 2005-09-05 16:27:19 +0000 | [diff] [blame] | 25 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 26 | ln -s `which busybox` busybox-suffix |
| 27 | for i in busybox ./busybox-suffix |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 28 | do |
Ron Yorston | ecaec1d | 2018-02-09 09:01:19 +0000 | [diff] [blame] | 29 | testing "$i" "$i 2>&1 | cat" "$HELPDUMP\n" "" "" |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 30 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 31 | testing "$i unknown" "$i unknown 2>&1" \ |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 32 | "unknown: applet not found\n" "" "" |
| 33 | |
Ron Yorston | ecaec1d | 2018-02-09 09:01:19 +0000 | [diff] [blame] | 34 | testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n" "" "" |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 35 | |
Denys Vlasenko | c0211e9 | 2010-05-11 04:32:04 +0200 | [diff] [blame] | 36 | optional FEATURE_VERBOSE_USAGE CAT |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 37 | testing "" "$i cat" "moo" "" "moo" |
Ron Yorston | ecaec1d | 2018-02-09 09:01:19 +0000 | [diff] [blame] | 38 | testing "$i --help cat" "$i --help cat 2>&1 | grep Print" \ |
| 39 | "Print FILEs to stdout\n" "" "" |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame] | 40 | SKIP= |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 41 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 42 | testing "$i --help unknown" "$i --help unknown 2>&1" \ |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 43 | "unknown: applet not found\n" "" "" |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 44 | done |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 45 | rm busybox-suffix |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 46 | |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 47 | exit $FAILCOUNT |