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> |
| 5 | # Licensed under GPL v2, see file LICENSE for details. |
| 6 | |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 7 | . testing.sh |
| 8 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 9 | # verify the applet order is correct in applets.h, otherwise applets won't |
| 10 | # be called properly. |
| 11 | #sed -n -e '/^USE_^\tAPPLET/{s:.*(::;s:,.*::;s:"::g;p}' |
| 12 | # ../include/applets.h > applet.order1 |
| 13 | #LC_ALL=C sort applet.order.current > applet.order.correct |
| 14 | #diff -u applet.order.current applet.order.correct |
| 15 | #FAILCOUNT=$[$FAILCOUNT+$?] |
| 16 | #rm -f applet.order.current applet.order.correct |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | HELPDUMP=`busybox` |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 22 | |
Rob Landley | 48c6157 | 2005-11-07 08:50:53 +0000 | [diff] [blame] | 23 | # We need to test under calling the binary under other names. |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 24 | |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 25 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 26 | testing "busybox --help busybox" "busybox --help busybox" "$HELPDUMP\n\n" "" "" |
Rob Landley | f6acb66 | 2005-09-05 16:27:19 +0000 | [diff] [blame] | 27 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 28 | ln -s `which busybox` busybox-suffix |
| 29 | for i in busybox ./busybox-suffix |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 30 | do |
| 31 | # The gratuitous "\n"s are due to a shell idiosyncrasy: |
| 32 | # environment variables seem to strip trailing whitespace. |
| 33 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 34 | testing "" "$i" "$HELPDUMP\n\n" "" "" |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 35 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 36 | testing "$i unknown" "$i unknown 2>&1" \ |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 37 | "unknown: applet not found\n" "" "" |
| 38 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 39 | testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" "" |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 40 | |
Rob Landley | 48c6157 | 2005-11-07 08:50:53 +0000 | [diff] [blame] | 41 | optional CAT |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 42 | testing "" "$i cat" "moo" "" "moo" |
| 43 | testing "$i --help cat" "$i --help cat 2>&1 | grep prints" \ |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 44 | "Concatenates FILE(s) and prints them to stdout.\n" "" "" |
Rob Landley | 48c6157 | 2005-11-07 08:50:53 +0000 | [diff] [blame] | 45 | optional "" |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 46 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 47 | testing "$i --help unknown" "$i --help unknown 2>&1" \ |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 48 | "unknown: applet not found\n" "" "" |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 49 | done |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 50 | rm busybox-suffix |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 51 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 52 | ln -s `which busybox` unknown |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 53 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 54 | testing "busybox as unknown name" "./unknown 2>&1" \ |
| 55 | "unknown: applet not found\n" "" "" |
| 56 | rm unknown |
Mike Frysinger | 23ca725 | 2006-02-22 23:38:57 +0000 | [diff] [blame] | 57 | |
Rob Landley | b766c39 | 2005-09-04 11:10:37 +0000 | [diff] [blame] | 58 | exit $FAILCOUNT |