diff options
author | Rob Landley <rob@landley.net> | 2006-03-16 15:20:45 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-03-16 15:20:45 +0000 |
commit | 4bb1b04fd1d7d6fe410e1af14816d11da456aac5 (patch) | |
tree | 601a54598057fc267def41fce1acecfb8e5a2845 /testsuite/busybox.tests | |
parent | ea9a471acd94f604f360ea16df5896e795361ac7 (diff) | |
download | busybox-w32-4bb1b04fd1d7d6fe410e1af14816d11da456aac5.tar.gz busybox-w32-4bb1b04fd1d7d6fe410e1af14816d11da456aac5.tar.bz2 busybox-w32-4bb1b04fd1d7d6fe410e1af14816d11da456aac5.zip |
Redo test suite to be able to test more than one command at a time. Eliminate
$COMMAND environment variable, instead put full command line (including
command to run) in second argument. Modify $PATH to have test versions of
commands at start of path. (Also more infrastructure for testing as root,
work in progress...)
Diffstat (limited to 'testsuite/busybox.tests')
-rwxr-xr-x | testsuite/busybox.tests | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/testsuite/busybox.tests b/testsuite/busybox.tests index f31f38f06..30d96f946 100755 --- a/testsuite/busybox.tests +++ b/testsuite/busybox.tests | |||
@@ -4,57 +4,55 @@ | |||
4 | # Copyright 2005 by Rob Landley <rob@landley.net> | 4 | # Copyright 2005 by Rob Landley <rob@landley.net> |
5 | # Licensed under GPL v2, see file LICENSE for details. | 5 | # Licensed under GPL v2, see file LICENSE for details. |
6 | 6 | ||
7 | if [ ${#COMMAND} -eq 0 ]; then COMMAND=busybox; fi | ||
8 | . testing.sh | 7 | . testing.sh |
9 | 8 | ||
10 | HELPDUMP=`$COMMAND` | 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` | ||
11 | 22 | ||
12 | # We need to test under calling the binary under other names. | 23 | # We need to test under calling the binary under other names. |
13 | 24 | ||
14 | ln -s `which "$COMMAND"` busybox-suffix | ||
15 | ln -s `which "$COMMAND"` unknown | ||
16 | 25 | ||
17 | testing "busybox --help busybox" "--help busybox" "$HELPDUMP\n\n" "" "" | 26 | testing "busybox --help busybox" "busybox --help busybox" "$HELPDUMP\n\n" "" "" |
18 | 27 | ||
19 | for i in busybox busybox-suffix | 28 | ln -s `which busybox` busybox-suffix |
29 | for i in busybox ./busybox-suffix | ||
20 | do | 30 | do |
21 | # The gratuitous "\n"s are due to a shell idiosyncrasy: | 31 | # The gratuitous "\n"s are due to a shell idiosyncrasy: |
22 | # environment variables seem to strip trailing whitespace. | 32 | # environment variables seem to strip trailing whitespace. |
23 | 33 | ||
24 | testing "$i" "" "$HELPDUMP\n\n" "" "" | 34 | testing "" "$i" "$HELPDUMP\n\n" "" "" |
25 | 35 | ||
26 | testing "$i unknown" "unknown 2>&1" \ | 36 | testing "$i unknown" "$i unknown 2>&1" \ |
27 | "unknown: applet not found\n" "" "" | 37 | "unknown: applet not found\n" "" "" |
28 | 38 | ||
29 | testing "$i --help" "--help 2>&1" "$HELPDUMP\n\n" "" "" | 39 | testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" "" |
30 | 40 | ||
31 | optional CAT | 41 | optional CAT |
32 | testing "$i cat" "cat" "moo" "" "moo" | 42 | testing "" "$i cat" "moo" "" "moo" |
33 | testing "$i --help cat" "--help cat 2>&1 | grep prints" \ | 43 | testing "$i --help cat" "$i --help cat 2>&1 | grep prints" \ |
34 | "Concatenates FILE(s) and prints them to stdout.\n" "" "" | 44 | "Concatenates FILE(s) and prints them to stdout.\n" "" "" |
35 | optional "" | 45 | optional "" |
36 | 46 | ||
37 | testing "$i --help unknown" "--help unknown 2>&1" \ | 47 | testing "$i --help unknown" "$i --help unknown 2>&1" \ |
38 | "unknown: applet not found\n" "" "" | 48 | "unknown: applet not found\n" "" "" |
39 | |||
40 | COMMAND=./busybox-suffix | ||
41 | done | 49 | done |
50 | rm busybox-suffix | ||
42 | 51 | ||
43 | COMMAND="./unknown" | 52 | ln -s `which busybox` unknown |
44 | testing "busybox as unknown name" "2>&1" "unknown: applet not found\n" "" "" | ||
45 | |||
46 | rm -f busybox-suffix unknown | ||
47 | |||
48 | |||
49 | # verify the applet order is correct in applets.h | ||
50 | # otherwise applets wont be called properly | ||
51 | sed -n \ | ||
52 | -e '/^\tAPPLET/{s:.*(::;s:,.*::;s:"::g;p}' \ | ||
53 | ../include/applets.h > applet.order.current | ||
54 | LC_ALL=C sort applet.order.current > applet.order.correct | ||
55 | diff -u applet.order.current applet.order.correct | ||
56 | FAILCOUNT=$[$FAILCOUNT+$?] | ||
57 | rm -f applet.order.current applet.order.correct | ||
58 | 53 | ||
54 | testing "busybox as unknown name" "./unknown 2>&1" \ | ||
55 | "unknown: applet not found\n" "" "" | ||
56 | rm unknown | ||
59 | 57 | ||
60 | exit $FAILCOUNT | 58 | exit $FAILCOUNT |