diff options
42 files changed, 318 insertions, 12 deletions
diff --git a/shell/hush_test/zbad b/shell/hush_test/zbad new file mode 100644 index 000000000..e4b5caa61 --- /dev/null +++ b/shell/hush_test/zbad | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # TODO: hush doesn't know ':' null command | ||
| 2 | |||
| 3 | while :; do exit; done | ||
diff --git a/shell/msh_test/msh-bugs/noeol3.right b/shell/msh_test/msh-bugs/noeol3.right new file mode 100644 index 000000000..56f8515b7 --- /dev/null +++ b/shell/msh_test/msh-bugs/noeol3.right | |||
| @@ -0,0 +1 @@ | |||
| hush: syntax error: unterminated " | |||
diff --git a/shell/msh_test/msh-bugs/noeol3.tests b/shell/msh_test/msh-bugs/noeol3.tests new file mode 100755 index 000000000..ec958ed7a --- /dev/null +++ b/shell/msh_test/msh-bugs/noeol3.tests | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | # last line has no EOL! | ||
| 2 | echo "unterminated \ No newline at end of file | ||
diff --git a/shell/msh_test/msh-bugs/process_subst.right b/shell/msh_test/msh-bugs/process_subst.right new file mode 100644 index 000000000..397bc8067 --- /dev/null +++ b/shell/msh_test/msh-bugs/process_subst.right | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | TESTzzBEST | ||
| 2 | TEST$(echo zz)BEST | ||
| 3 | TEST'BEST | ||
diff --git a/shell/msh_test/msh-bugs/process_subst.tests b/shell/msh_test/msh-bugs/process_subst.tests new file mode 100755 index 000000000..21996bc0e --- /dev/null +++ b/shell/msh_test/msh-bugs/process_subst.tests | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | echo "TEST`echo zz;echo;echo`BEST" | ||
| 2 | echo "TEST`echo '$(echo zz)'`BEST" | ||
| 3 | echo "TEST`echo "'"`BEST" | ||
diff --git a/shell/msh_test/msh-bugs/read.right b/shell/msh_test/msh-bugs/read.right new file mode 100644 index 000000000..0e50e2a23 --- /dev/null +++ b/shell/msh_test/msh-bugs/read.right | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | read | ||
| 2 | cat | ||
| 3 | echo "REPLY=$REPLY" | ||
| 4 | REPLY=exec <read.tests | ||
diff --git a/shell/msh_test/msh-bugs/read.tests b/shell/msh_test/msh-bugs/read.tests new file mode 100755 index 000000000..ff1acbde1 --- /dev/null +++ b/shell/msh_test/msh-bugs/read.tests | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | exec <read.tests | ||
| 2 | read | ||
| 3 | cat | ||
| 4 | echo "REPLY=$REPLY" | ||
diff --git a/shell/msh_test/msh-bugs/shift.right b/shell/msh_test/msh-bugs/shift.right new file mode 100644 index 000000000..d281e358c --- /dev/null +++ b/shell/msh_test/msh-bugs/shift.right | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | ./shift.tests abc d e | ||
| 2 | ./shift.tests d e 123 | ||
| 3 | ./shift.tests d e 123 | ||
| 4 | ./shift.tests | ||
| 5 | ./shift.tests | ||
| 6 | ./shift.tests | ||
diff --git a/shell/msh_test/msh-bugs/shift.tests b/shell/msh_test/msh-bugs/shift.tests new file mode 100755 index 000000000..53ef249f2 --- /dev/null +++ b/shell/msh_test/msh-bugs/shift.tests | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | if test $# = 0; then | ||
| 2 | exec "$THIS_SH" $0 abc "d e" 123 | ||
| 3 | fi | ||
| 4 | echo $0 $1 $2 | ||
| 5 | shift | ||
| 6 | echo $0 $1 $2 | ||
| 7 | shift 999 | ||
| 8 | echo $0 $1 $2 | ||
| 9 | shift 2 | ||
| 10 | echo $0 $1 $2 | ||
| 11 | shift 2 | ||
| 12 | echo $0 $1 $2 | ||
| 13 | shift | ||
| 14 | echo $0 $1 $2 | ||
diff --git a/shell/msh_test/msh-bugs/starquoted.right b/shell/msh_test/msh-bugs/starquoted.right new file mode 100644 index 000000000..b56323fe1 --- /dev/null +++ b/shell/msh_test/msh-bugs/starquoted.right | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | .1 abc d e f. | ||
| 2 | .1. | ||
| 3 | .abc. | ||
| 4 | .d e f. | ||
| 5 | .-1 abc d e f-. | ||
| 6 | .-1. | ||
| 7 | .abc. | ||
| 8 | .d e f-. | ||
diff --git a/shell/msh_test/msh-bugs/starquoted.tests b/shell/msh_test/msh-bugs/starquoted.tests new file mode 100755 index 000000000..2fe49b1cd --- /dev/null +++ b/shell/msh_test/msh-bugs/starquoted.tests | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | if test $# = 0; then | ||
| 2 | exec "$THIS_SH" "$0" 1 abc 'd e f' | ||
| 3 | fi | ||
| 4 | |||
| 5 | for a in "$*"; do echo ".$a."; done | ||
| 6 | for a in "$@"; do echo ".$a."; done | ||
| 7 | for a in "-$*-"; do echo ".$a."; done | ||
| 8 | for a in "-$@-"; do echo ".$a."; done | ||
diff --git a/shell/msh_test/msh-bugs/syntax_err.right b/shell/msh_test/msh-bugs/syntax_err.right new file mode 100644 index 000000000..08a270c31 --- /dev/null +++ b/shell/msh_test/msh-bugs/syntax_err.right | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | shown | ||
| 2 | hush: syntax error: unterminated ' | ||
diff --git a/shell/msh_test/msh-bugs/syntax_err.tests b/shell/msh_test/msh-bugs/syntax_err.tests new file mode 100755 index 000000000..d10ed42e9 --- /dev/null +++ b/shell/msh_test/msh-bugs/syntax_err.tests | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | echo shown | ||
| 2 | echo test `echo 'aa` | ||
| 3 | echo not shown | ||
diff --git a/shell/msh_test/msh-bugs/var_expand_in_assign.right b/shell/msh_test/msh-bugs/var_expand_in_assign.right new file mode 100644 index 000000000..352210d7e --- /dev/null +++ b/shell/msh_test/msh-bugs/var_expand_in_assign.right | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | . . | ||
| 2 | .abc d e. | ||
| 3 | .abc d e. | ||
| 4 | .abc d e. | ||
| 5 | .abc d e. | ||
diff --git a/shell/msh_test/msh-bugs/var_expand_in_assign.tests b/shell/msh_test/msh-bugs/var_expand_in_assign.tests new file mode 100755 index 000000000..18cdc74c0 --- /dev/null +++ b/shell/msh_test/msh-bugs/var_expand_in_assign.tests | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | if test $# = 0; then | ||
| 2 | exec "$THIS_SH" "$0" abc "d e" | ||
| 3 | fi | ||
| 4 | |||
| 5 | space=' ' | ||
| 6 | echo .$space. | ||
| 7 | |||
| 8 | a=$* | ||
| 9 | echo .$a. | ||
| 10 | a=$@ | ||
| 11 | echo .$a. | ||
| 12 | a="$*" | ||
| 13 | echo .$a. | ||
| 14 | a="$@" | ||
| 15 | echo .$a. | ||
diff --git a/shell/msh_test/msh-bugs/var_expand_in_redir.right b/shell/msh_test/msh-bugs/var_expand_in_redir.right new file mode 100644 index 000000000..423299c97 --- /dev/null +++ b/shell/msh_test/msh-bugs/var_expand_in_redir.right | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | TEST1 | ||
| 2 | TEST2 | ||
| 3 | TEST3 | ||
diff --git a/shell/msh_test/msh-bugs/var_expand_in_redir.tests b/shell/msh_test/msh-bugs/var_expand_in_redir.tests new file mode 100755 index 000000000..bda6bdd7f --- /dev/null +++ b/shell/msh_test/msh-bugs/var_expand_in_redir.tests | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | if test $# = 0; then | ||
| 2 | exec "$THIS_SH" "$0" abc "d e" | ||
| 3 | fi | ||
| 4 | |||
| 5 | echo TEST1 >"$1.out" | ||
| 6 | echo TEST2 >"$2.out" | ||
| 7 | # bash says: "$@.out": ambiguous redirect | ||
| 8 | # ash handles it as if it is '$*' - we do the same | ||
| 9 | echo TEST3 >"$@.out" | ||
| 10 | |||
| 11 | cat abc.out "d e.out" "abc d e.out" | ||
| 12 | |||
| 13 | rm abc.out "d e.out" "abc d e.out" | ||
diff --git a/shell/msh_test/msh-execution/nested_break.right b/shell/msh_test/msh-execution/nested_break.right new file mode 100644 index 000000000..4e8b6b0f2 --- /dev/null +++ b/shell/msh_test/msh-execution/nested_break.right | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | A | ||
| 2 | B | ||
| 3 | iteration | ||
| 4 | C | ||
| 5 | A | ||
| 6 | B | ||
| 7 | iteration | ||
| 8 | D | ||
diff --git a/shell/msh_test/TODO_bug846 b/shell/msh_test/msh-execution/nested_break.tests index 5c777fedb..f2e6f81ae 100644..100755 --- a/shell/msh_test/TODO_bug846 +++ b/shell/msh_test/msh-execution/nested_break.tests | |||
| @@ -1,5 +1,3 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # For future msh testsuite: | ||
| 3 | # Testcase for http://bugs.busybox.net/view.php?id=846 | 1 | # Testcase for http://bugs.busybox.net/view.php?id=846 |
| 4 | 2 | ||
| 5 | n=0 | 3 | n=0 |
| @@ -17,13 +15,3 @@ do | |||
| 17 | n=`expr $n + 1` | 15 | n=`expr $n + 1` |
| 18 | done | 16 | done |
| 19 | echo D | 17 | echo D |
| 20 | |||
| 21 | # output should be: | ||
| 22 | # A | ||
| 23 | # B | ||
| 24 | # iteration | ||
| 25 | # C | ||
| 26 | # A | ||
| 27 | # B | ||
| 28 | # iteration | ||
| 29 | # D | ||
diff --git a/shell/msh_test/msh-misc/tick.right b/shell/msh_test/msh-misc/tick.right new file mode 100644 index 000000000..6ed281c75 --- /dev/null +++ b/shell/msh_test/msh-misc/tick.right | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | 1 | ||
| 2 | 1 | ||
diff --git a/shell/msh_test/msh-misc/tick.tests b/shell/msh_test/msh-misc/tick.tests new file mode 100755 index 000000000..1f749a9cd --- /dev/null +++ b/shell/msh_test/msh-misc/tick.tests | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | true | ||
| 2 | false; echo `echo $?` | ||
| 3 | true | ||
| 4 | { false; echo `echo $?`; } | ||
diff --git a/shell/msh_test/msh-parsing/argv0.right b/shell/msh_test/msh-parsing/argv0.right new file mode 100644 index 000000000..d86bac9de --- /dev/null +++ b/shell/msh_test/msh-parsing/argv0.right | |||
| @@ -0,0 +1 @@ | |||
| OK | |||
diff --git a/shell/msh_test/msh-parsing/argv0.tests b/shell/msh_test/msh-parsing/argv0.tests new file mode 100755 index 000000000..f5c40f6fe --- /dev/null +++ b/shell/msh_test/msh-parsing/argv0.tests | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | if test $# = 0; then | ||
| 2 | exec "$THIS_SH" "$0" arg | ||
| 3 | fi | ||
| 4 | echo OK | ||
diff --git a/shell/msh_test/msh-parsing/noeol.right b/shell/msh_test/msh-parsing/noeol.right new file mode 100644 index 000000000..e427984d4 --- /dev/null +++ b/shell/msh_test/msh-parsing/noeol.right | |||
| @@ -0,0 +1 @@ | |||
| HELLO | |||
diff --git a/shell/msh_test/msh-parsing/noeol.tests b/shell/msh_test/msh-parsing/noeol.tests new file mode 100755 index 000000000..a93113a03 --- /dev/null +++ b/shell/msh_test/msh-parsing/noeol.tests | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | # next line has no EOL! | ||
| 2 | echo HELLO \ No newline at end of file | ||
diff --git a/shell/msh_test/msh-parsing/noeol2.right b/shell/msh_test/msh-parsing/noeol2.right new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/shell/msh_test/msh-parsing/noeol2.right | |||
| @@ -0,0 +1 @@ | |||
| 1 | |||
diff --git a/shell/msh_test/msh-parsing/noeol2.tests b/shell/msh_test/msh-parsing/noeol2.tests new file mode 100755 index 000000000..1220f056f --- /dev/null +++ b/shell/msh_test/msh-parsing/noeol2.tests | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # last line has no EOL! | ||
| 2 | if true | ||
| 3 | then | ||
| 4 | echo 1 | ||
| 5 | else | ||
| 6 | echo 2 | ||
| 7 | fi \ No newline at end of file | ||
diff --git a/shell/msh_test/msh-parsing/quote1.right b/shell/msh_test/msh-parsing/quote1.right new file mode 100644 index 000000000..cb382054c --- /dev/null +++ b/shell/msh_test/msh-parsing/quote1.right | |||
| @@ -0,0 +1 @@ | |||
| '1' | |||
diff --git a/shell/msh_test/msh-parsing/quote1.tests b/shell/msh_test/msh-parsing/quote1.tests new file mode 100755 index 000000000..f55895466 --- /dev/null +++ b/shell/msh_test/msh-parsing/quote1.tests | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | a=1 | ||
| 2 | echo "'$a'" | ||
diff --git a/shell/msh_test/msh-parsing/quote2.right b/shell/msh_test/msh-parsing/quote2.right new file mode 100644 index 000000000..3bc9edcd6 --- /dev/null +++ b/shell/msh_test/msh-parsing/quote2.right | |||
| @@ -0,0 +1 @@ | |||
| >1 | |||
diff --git a/shell/msh_test/msh-parsing/quote2.tests b/shell/msh_test/msh-parsing/quote2.tests new file mode 100755 index 000000000..bd966f30b --- /dev/null +++ b/shell/msh_test/msh-parsing/quote2.tests | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | a=1 | ||
| 2 | echo ">$a" | ||
diff --git a/shell/msh_test/msh-parsing/quote3.right b/shell/msh_test/msh-parsing/quote3.right new file mode 100644 index 000000000..069a46e8f --- /dev/null +++ b/shell/msh_test/msh-parsing/quote3.right | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | Testing: in $empty"" | ||
| 2 | .. | ||
| 3 | Finished | ||
diff --git a/shell/msh_test/msh-parsing/quote3.tests b/shell/msh_test/msh-parsing/quote3.tests new file mode 100755 index 000000000..075e78570 --- /dev/null +++ b/shell/msh_test/msh-parsing/quote3.tests | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | if test $# = 0; then | ||
| 2 | exec "$THIS_SH" quote3.tests abc "d e" | ||
| 3 | fi | ||
| 4 | |||
| 5 | echo 'Testing: in $empty""' | ||
| 6 | empty='' | ||
| 7 | for a in $empty""; do echo ".$a."; done | ||
| 8 | echo Finished | ||
diff --git a/shell/msh_test/msh-parsing/quote4.right b/shell/msh_test/msh-parsing/quote4.right new file mode 100644 index 000000000..b2901ea97 --- /dev/null +++ b/shell/msh_test/msh-parsing/quote4.right | |||
| @@ -0,0 +1 @@ | |||
| a b | |||
diff --git a/shell/msh_test/msh-parsing/quote4.tests b/shell/msh_test/msh-parsing/quote4.tests new file mode 100755 index 000000000..f1dabfa54 --- /dev/null +++ b/shell/msh_test/msh-parsing/quote4.tests | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | a_b='a b' | ||
| 2 | echo "$a_b" | ||
diff --git a/shell/msh_test/msh-vars/star.right b/shell/msh_test/msh-vars/star.right new file mode 100644 index 000000000..0ecc55bc2 --- /dev/null +++ b/shell/msh_test/msh-vars/star.right | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | .1. | ||
| 2 | .abc. | ||
| 3 | .d. | ||
| 4 | .e. | ||
| 5 | .f. | ||
| 6 | .1 abc d e f. | ||
diff --git a/shell/msh_test/msh-vars/star.tests b/shell/msh_test/msh-vars/star.tests new file mode 100755 index 000000000..5554c4090 --- /dev/null +++ b/shell/msh_test/msh-vars/star.tests | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | if test $# = 0; then | ||
| 2 | exec "$THIS_SH" star.tests 1 abc 'd e f' | ||
| 3 | fi | ||
| 4 | # 'd e f' should be split into 3 separate args: | ||
| 5 | for a in $*; do echo ".$a."; done | ||
| 6 | |||
| 7 | # must produce .1 abc d e f. | ||
| 8 | for a in "$*"; do echo ".$a."; done | ||
diff --git a/shell/msh_test/msh-vars/var.right b/shell/msh_test/msh-vars/var.right new file mode 100644 index 000000000..14b2314d9 --- /dev/null +++ b/shell/msh_test/msh-vars/var.right | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | http://busybox.net | ||
| 2 | http://busybox.net_abc | ||
| 3 | 1 | ||
| 4 | 1 | ||
diff --git a/shell/msh_test/msh-vars/var.tests b/shell/msh_test/msh-vars/var.tests new file mode 100755 index 000000000..0a63696c9 --- /dev/null +++ b/shell/msh_test/msh-vars/var.tests | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | URL=http://busybox.net | ||
| 2 | |||
| 3 | echo $URL | ||
| 4 | echo ${URL}_abc | ||
| 5 | |||
| 6 | true | ||
| 7 | false; echo $? | ||
| 8 | true | ||
| 9 | { false; echo $?; } | ||
diff --git a/shell/msh_test/msh-vars/var_subst_in_for.right b/shell/msh_test/msh-vars/var_subst_in_for.right new file mode 100644 index 000000000..c8aca1c12 --- /dev/null +++ b/shell/msh_test/msh-vars/var_subst_in_for.right | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | Testing: in x y z | ||
| 2 | .x. | ||
| 3 | .y. | ||
| 4 | .z. | ||
| 5 | Testing: in u $empty v | ||
| 6 | .u. | ||
| 7 | .v. | ||
| 8 | Testing: in u " $empty" v | ||
| 9 | .u. | ||
| 10 | . . | ||
| 11 | .v. | ||
| 12 | Testing: in u $empty $empty$a v | ||
| 13 | .u. | ||
| 14 | .a. | ||
| 15 | .v. | ||
| 16 | Testing: in $a_b | ||
| 17 | .a. | ||
| 18 | .b. | ||
| 19 | Testing: in $* | ||
| 20 | .abc. | ||
| 21 | .d. | ||
| 22 | .e. | ||
| 23 | Testing: in $@ | ||
| 24 | .abc. | ||
| 25 | .d. | ||
| 26 | .e. | ||
| 27 | Testing: in -$*- | ||
| 28 | .-abc. | ||
| 29 | .d. | ||
| 30 | .e-. | ||
| 31 | Testing: in -$@- | ||
| 32 | .-abc. | ||
| 33 | .d. | ||
| 34 | .e-. | ||
| 35 | Testing: in $a_b -$a_b- | ||
| 36 | .a. | ||
| 37 | .b. | ||
| 38 | .-a. | ||
| 39 | .b-. | ||
| 40 | Finished | ||
diff --git a/shell/msh_test/msh-vars/var_subst_in_for.tests b/shell/msh_test/msh-vars/var_subst_in_for.tests new file mode 100755 index 000000000..4d1c11201 --- /dev/null +++ b/shell/msh_test/msh-vars/var_subst_in_for.tests | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | if test $# = 0; then | ||
| 2 | exec "$THIS_SH" var_subst_in_for.tests abc "d e" | ||
| 3 | fi | ||
| 4 | |||
| 5 | echo 'Testing: in x y z' | ||
| 6 | for a in x y z; do echo ".$a."; done | ||
| 7 | |||
| 8 | echo 'Testing: in u $empty v' | ||
| 9 | empty='' | ||
| 10 | for a in u $empty v; do echo ".$a."; done | ||
| 11 | |||
| 12 | echo 'Testing: in u " $empty" v' | ||
| 13 | empty='' | ||
| 14 | for a in u " $empty" v; do echo ".$a."; done | ||
| 15 | |||
| 16 | echo 'Testing: in u $empty $empty$a v' | ||
| 17 | a='a' | ||
| 18 | for a in u $empty $empty$a v; do echo ".$a."; done | ||
| 19 | |||
| 20 | echo 'Testing: in $a_b' | ||
| 21 | a_b='a b' | ||
| 22 | for a in $a_b; do echo ".$a."; done | ||
| 23 | |||
| 24 | echo 'Testing: in $*' | ||
| 25 | for a in $*; do echo ".$a."; done | ||
| 26 | |||
| 27 | echo 'Testing: in $@' | ||
| 28 | for a in $@; do echo ".$a."; done | ||
| 29 | |||
| 30 | echo 'Testing: in -$*-' | ||
| 31 | for a in -$*-; do echo ".$a."; done | ||
| 32 | |||
| 33 | echo 'Testing: in -$@-' | ||
| 34 | for a in -$@-; do echo ".$a."; done | ||
| 35 | |||
| 36 | echo 'Testing: in $a_b -$a_b-' | ||
| 37 | a_b='a b' | ||
| 38 | for a in $a_b -$a_b-; do echo ".$a."; done | ||
| 39 | |||
| 40 | echo Finished | ||
diff --git a/shell/msh_test/run-all b/shell/msh_test/run-all new file mode 100755 index 000000000..43bc9fc0b --- /dev/null +++ b/shell/msh_test/run-all | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | test -x msh || { | ||
| 4 | echo "No ./msh?! Perhaps you want to run 'ln -s ../../busybox msh'" | ||
| 5 | exit | ||
| 6 | } | ||
| 7 | |||
| 8 | PATH="$PWD:$PATH" # for msh | ||
| 9 | export PATH | ||
| 10 | |||
| 11 | THIS_SH="$PWD/msh" | ||
| 12 | export THIS_SH | ||
| 13 | |||
| 14 | do_test() | ||
| 15 | { | ||
| 16 | test -d "$1" || return 0 | ||
| 17 | # echo Running tests in directory "$1" | ||
| 18 | ( | ||
| 19 | cd "$1" || { echo "cannot cd $1!"; exit 1; } | ||
| 20 | for x in run-*; do | ||
| 21 | test -f "$x" || continue | ||
| 22 | case "$x" in | ||
| 23 | "$0"|run-minimal|run-gprof) ;; | ||
| 24 | *.orig|*~) ;; | ||
| 25 | #*) echo $x ; sh $x ;; | ||
| 26 | *) | ||
| 27 | sh "$x" >"../$1-$x.fail" 2>&1 && \ | ||
| 28 | { echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail"; | ||
| 29 | ;; | ||
| 30 | esac | ||
| 31 | done | ||
| 32 | # Many bash run-XXX scripts just do this, | ||
| 33 | # no point in duplication it all over the place | ||
| 34 | for x in *.tests; do | ||
| 35 | test -x "$x" || continue | ||
| 36 | name="${x%%.tests}" | ||
| 37 | test -f "$name.right" || continue | ||
| 38 | # echo Running test: "$name.right" | ||
| 39 | { | ||
| 40 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 | ||
| 41 | diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" | ||
| 42 | } && echo "$1/$x: ok" || echo "$1/$x: fail" | ||
| 43 | done | ||
| 44 | ) | ||
| 45 | } | ||
| 46 | |||
| 47 | # Main part of this script | ||
| 48 | # Usage: run-all [directories] | ||
| 49 | |||
| 50 | if [ $# -lt 1 ]; then | ||
| 51 | # All sub directories | ||
| 52 | modules=`ls -d msh-*` | ||
| 53 | |||
| 54 | for module in $modules; do | ||
| 55 | do_test $module | ||
| 56 | done | ||
| 57 | else | ||
| 58 | while [ $# -ge 1 ]; do | ||
| 59 | if [ -d $1 ]; then | ||
| 60 | do_test $1 | ||
| 61 | fi | ||
| 62 | shift | ||
| 63 | done | ||
| 64 | fi | ||
